[PATCH 0/2] Class- and class loader-local storage (Bug ID #6493635)
Bob Lee
openjdk at crazybob.org
Fri Feb 27 18:10:33 UTC 2009
I have a simpler and more secure solution. I just need one method on
ClassLoader:
public class ClassLoader {
public void keepReferenceTo(Object o) { ... }
...
}
The ClassLoader would keep a strong reference to the passed reference
indefinitely (using some sort of minimal memory footprint, wait-free
data structure internally). We could add a convenience method to
Class, too, but it would just delegate to the same method on the
Class's loader.
Now, my library code can just keep a weak reference to the object, and
I know it won't be cleared until the class loader is reclaimed.
Bob
More information about the core-libs-dev
mailing list