| Modifier and Type | Field and Description |
|---|---|
| private static WeakHashMap | _contextMap
Map of classloaders to contexts. |
| private static ThreadLocal | _threadContext
Threadlocal for injecting a context to use instead of looking up the map. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | getObjectInstance(Object
The possibly null object containing location or reference
information that can be used in creating an object. obj, Name The name of this object relative to name, Context nameCtx,
or null if no name is specified.The context relative to which the nameCtx, Hashtable<K, V> name
parameter is specified, or null if name is
relative to the default initial context.The possibly null environment that is used in
creating the object. env)Implements javax. |
| public Context | getParentClassLoaderContext(ClassLoader loader)
Keep trying ancestors of the given classloader to find one to which the context is bound. |
| public static void | resetComponentContext(final Context
the context to associate to the current thread. ctx)Set back the context with the given value. |
| public static Context | Returns: the previous context associated on the thread (can be null)the context to associate to the current thread. ctx)Associate the given Context with the current thread. |
| _contextMap | back to summary |
|---|---|
| private static WeakHashMap<K, V> _contextMap Map of classloaders to contexts. | |
| _threadContext | back to summary |
|---|---|
| private static ThreadLocal<T> _threadContext Threadlocal for injecting a context to use instead of looking up the map. | |
| ContextFactory | back to summary |
|---|---|
| public ContextFactory() | |
| getObjectInstance | back to summary |
|---|---|
| public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<K, V> env) throws Exception Implements javax. Find or create a context which pertains to a classloader. We use either the classloader for the current ContextHandler if we are handling a request, OR we use the thread context classloader if we are not processing a request.
| |
| getParentClassLoaderContext | back to summary |
|---|---|
| public Context getParentClassLoaderContext(ClassLoader loader) Keep trying ancestors of the given classloader to find one to which the context is bound. | |
| resetComponentContext | back to summary |
|---|---|
| public static void resetComponentContext(final Context ctx) Set back the context with the given value. Don't return the previous context, use setComponentContext() method for this.
| |
| setComponentContext | back to summary |
|---|---|
| public static Context setComponentContext(final Context ctx) Associate the given Context with the current thread. resetComponentContext method should be called to reset the context. | |