[PATCH 0/2] Class- and class loader-local storage (Bug ID #6493635)
David M. Lloyd
david.lloyd at redhat.com
Thu Feb 26 16:02:44 UTC 2009
After running into the problem described in this bug for the umpteenth
time, I decided to get off my duff and do something about it.
Following are two patches. The first one adds the notion of class-local
storage, and the second adds class loader-local storage; both mechanisms
work basically the same way. There's a map on the Class or ClassLoader
that's lazily created, weakly keyed by an object which is private to the
ClassLocal or ClassLoaderLocal instance. The *Local instance itself has
operations to read and write the values with operations similar to what one
might find on Map and ConcurrentMap.
A possible future optimization might be to replace the simple
synchronization I am using with a more complex mechanism (like one of the
concurrent reference map implementations floating out there).
References:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6493635
http://crazybob.org/2006/12/caching-class-related-information.html
http://weblogs.java.net/blog/jhook/archive/2006/12/class_metadata.html
http://dmlloyd.blogspot.com/2009/02/class-local-data.html
- DML
More information about the core-libs-dev
mailing list