[PATCH 0/2] Class- and class loader-local storage (Bug ID #6493635)
David M. Lloyd
david.lloyd at redhat.com
Thu Feb 26 08:02:44 PST 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).
More information about the core-libs-dev