home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / io / ObjectInputStream$CallbackContext.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1006 b   |  34 lines

  1. package java.io;
  2.  
  3. import java.util.concurrent.atomic.AtomicBoolean;
  4.  
  5. class ObjectInputStream$CallbackContext {
  6.    private final Object obj;
  7.    private final ObjectStreamClass desc;
  8.    private final AtomicBoolean used = new AtomicBoolean();
  9.  
  10.    public ObjectInputStream$CallbackContext(Object var1, ObjectStreamClass var2) {
  11.       this.obj = var1;
  12.       this.desc = var2;
  13.    }
  14.  
  15.    public Object getObj() throws NotActiveException {
  16.       this.checkAndSetUsed();
  17.       return this.obj;
  18.    }
  19.  
  20.    public ObjectStreamClass getDesc() {
  21.       return this.desc;
  22.    }
  23.  
  24.    private void checkAndSetUsed() throws NotActiveException {
  25.       if (!this.used.compareAndSet(false, true)) {
  26.          throw new NotActiveException("not in readObject invocation or fields already read");
  27.       }
  28.    }
  29.  
  30.    public void setUsed() {
  31.       this.used.set(true);
  32.    }
  33. }
  34.