Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. is there a way to recycle a complex java object once the GC has decided it is unreachable
  2. SmartPointer<ObjType> object = pool.getObject(); // hold reference
  3.  
  4. // ... do stuff with object over time.
  5.  
  6. object = nullptr; // that is when reference
  7.                   // count goes to 0
  8.        
  9. SomeReference r = referenceQueue.getReference();
  10.  
  11. pool.recycle(r.takeBackUnusedObjectFromGC()); // ??????????????????????????