On 8 Jun 2011, at 11:42, Dan Berindei wrote:
>
> Yes, no reason why the delegate Cache can't do this. These setters would need to
exist on the Cache interface though. For now, we should just restrict to
setClassLoader().
>
>> From an implementation perspective, given where we are with 5.0 now, I suggest we
implement by holding the ClassLoader in the CacheDelegate impl, and each method invocation
impl would:
>
> 1) Set TCCL with the instance's ClassLoader field
> 2) Do work
> 3) In a finally block, reset TCCL.
>
> This is just a temp measure, since I don't want to re-work how Marshallers, etc
get a hold of the class loader. They use TCCLs right now, and while sub-optimal in many
ways, this approach gives us an easy mechanism to implement while still preventing any
leaks, etc otherwise common with TCCLs.
>
The CacheDelegate instance returned by CM.getCache() is shared between
all the users that called getCache(), so if we want different users to
have different classloaders I think we need another Cache wrapper
class that will set/reset the TCCL.
Yes, that's what I have in mind.
--
Manik Surtani
manik(a)jboss.org
twitter.com/maniksurtani
Lead, Infinispan
http://www.infinispan.org