EHC ❯ Should have better control of deserialization classloader with ehcache-terracotta
-
Bug
-
Status: Closed
-
0 Showstopper
-
Resolution: Fixed
-
ehcache-terracotta
-
-
hsingh
-
Reporter: amiller
-
November 16, 2009
-
0
-
Watchers: 1
-
January 17, 2013
-
December 07, 2009
Description
This question first arose in the context of using ehcache-terracotta in OSGi. Currently, when using terracotta clustering, the object will be deserialized out of the clustered cache using the defining loader of ehcache-terracotta.jar. However, in cases like OSGi or other app server scenarios, it would be desirable for the loader to be some other classloader.
One way to deal with this is to use the thread-context classloader (TCCL) to allow callers to effectively influence the classloader to use. This would probably be a change that would allow many of these use cases to work (possibly with client changes).
Another jira coming for a longer-term fix.
Added test in terracotta-ehcache/system-tests (OtherClassloaderCacheTest) and made Ehcache clustered serialized value deserialization look at the thread context classloader during deserialization. (Use Thread.currentThread().setContextClassLoader() to control that)