Example #1
0
 /**
  * Returns a pointer to the object referenced by this Ref. If the object has been thrown away by
  * the garbage collector, it will be reconstituted. This method does everything necessary to
  * ensure that the garbage collector throws things away in Least Recently Used(LRU) order.
  * Applications should never override this method. The get() method effectively caches calls to
  * reconstitute().
  */
 public synchronized Object get() {
   Object t = check();
   if (t == null) {
     t = reconstitute();
     setThing(t);
   }
   return t;
 }
Example #2
0
 /** Constructs a new Ref that initially points to thing. */
 public Ref(Object thing) {
   setThing(thing);
 }