[infinispan-dev] [Pull Request] Modular Classloading Compatibility
Jason T. Greene
jason.greene at redhat.com
Fri May 20 10:28:00 EDT 2011
On 5/18/11 11:06 AM, Manik Surtani wrote:
>
> 1) Class loader per session/cache.
>
> I like Jason/Sanne/Trustin's suggestions of a session-like contract, and specifically I think this is best achieved as a delegate to a cache, again as suggested elsewhere by Pete, etc. E.g.,
>
> Cache<?, ?> myCache = cacheManager.getCache("myCache", myClassLoader);
-snip-
I would recommend leaving this open to store other per-session
configuration values (perhaps with a builder), and some of them mutable.
This will allow you to completely eliminate the ThreadLocal context
stuff used today which is both faster and more robust (the gc will clean
up the state for you).
> 2) Class loader per invocation.
>
If this "session" notion has some mutable values, you could also make CL
mutable:
cacheSession.setClassLoader(blah);
cacheSession.setFlags(FORCE_WRITE_LOCK)
cacheSession.put/get
repeat
>
> 3) Can all OSGi requirements be handled by (1)? I would guess so, from what I have read here, since the class loader is explicitly passed in when getting a handle on a cache.
Definitely.
--
Jason T. Greene
JBoss, a division of Red Hat
More information about the infinispan-dev
mailing list