We developed an application container that creates a new classloader for each independent application running in the container. When a specific application is invoked, the Thread's context classloader is set appropriately with the application's classloader.
Avoiding the use of ThreadLocal, is it possible to store properties within a classloader, such that you would be able to retrieve, in this case, application-specific properties directly from the classloader.
For example, I want to be able to somehow save and then later retrieve properties when accessing the context classloader:
Thread.currentThread().getContextClassLoader()
Is this possible? Or is ThreadLocal the only viable option?
How about subclassing the context classloader, extending it with the property support you need, then just casting the Thread.currentThread().getContextClassLoader()?