public class ThreadSingletonServiceImpl extends java.lang.Object implements ThreadSingletonService
Constructor and Description |
---|
ThreadSingletonServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
clear(java.lang.Object key) |
java.lang.Object |
contextEntered(WebBeansContext newOWBContext) |
void |
contextExited(java.lang.Object oldContext) |
static WebBeansContext |
enter(WebBeansContext newOWBContext) |
static void |
exit(java.lang.Object oldContext) |
static WebBeansContext |
get(java.lang.ClassLoader cl)
Generally contexts.get() is enough since we set the current context from a request (see webbeanslistener)
but sometimes matching the classloader is better (manager webapps of tomcat deploys for instance)
so here the algorithm:
1) try to match with the classloader
2) if not matched try to use the threadlocal
3) (shouldn't happen) simply return the biggest webbeancontext
|
WebBeansContext |
get(java.lang.Object key) |
void |
initialize(StartupObject startupObject) |
void |
threadSingletonServiceAdded(ComponentAdded<ThreadSingletonService> componentAdded) |
void |
threadSingletonServiceRemoved(ComponentRemoved componentRemoved) |
public static final Logger logger
public void threadSingletonServiceAdded(@Observes ComponentAdded<ThreadSingletonService> componentAdded)
public void threadSingletonServiceRemoved(@Observes ComponentRemoved componentRemoved)
public void initialize(StartupObject startupObject)
initialize
in interface ThreadSingletonService
public java.lang.Object contextEntered(WebBeansContext newOWBContext)
contextEntered
in interface ThreadSingletonService
public static WebBeansContext enter(WebBeansContext newOWBContext)
public void contextExited(java.lang.Object oldContext)
contextExited
in interface ThreadSingletonService
public static void exit(java.lang.Object oldContext)
public static WebBeansContext get(java.lang.ClassLoader cl)
cl
- the key (generally TCCL)public WebBeansContext get(java.lang.Object key)
public void clear(java.lang.Object key)