org.apache.openejb.cdi
Class ThreadSingletonServiceImpl
java.lang.Object
org.apache.openejb.cdi.ThreadSingletonServiceImpl
- All Implemented Interfaces:
- ThreadSingletonService, org.apache.webbeans.spi.SingletonService<org.apache.webbeans.config.WebBeansContext>
public class ThreadSingletonServiceImpl
- extends Object
- implements ThreadSingletonService
- Version:
- $Rev:$ $Date:$
|
Method Summary |
void |
clear(Object key)
|
Object |
contextEntered(org.apache.webbeans.config.WebBeansContext newOWBContext)
|
void |
contextExited(Object oldContext)
|
static org.apache.webbeans.config.WebBeansContext |
enter(org.apache.webbeans.config.WebBeansContext newOWBContext)
|
static void |
exit(Object oldContext)
|
static org.apache.webbeans.config.WebBeansContext |
get(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 |
org.apache.webbeans.config.WebBeansContext |
get(Object key)
|
void |
initialize(StartupObject startupObject)
|
String |
sessionContextClass()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public static final Logger logger
ThreadSingletonServiceImpl
public ThreadSingletonServiceImpl()
initialize
public void initialize(StartupObject startupObject)
- Specified by:
initialize in interface ThreadSingletonService
contextEntered
public Object contextEntered(org.apache.webbeans.config.WebBeansContext newOWBContext)
- Specified by:
contextEntered in interface ThreadSingletonService
enter
public static org.apache.webbeans.config.WebBeansContext enter(org.apache.webbeans.config.WebBeansContext newOWBContext)
contextExited
public void contextExited(Object oldContext)
- Specified by:
contextExited in interface ThreadSingletonService
exit
public static void exit(Object oldContext)
get
public static org.apache.webbeans.config.WebBeansContext get(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
- Parameters:
cl - the key (generally TCCL)
- Returns:
- the webbeancontext matching the current context
get
public org.apache.webbeans.config.WebBeansContext get(Object key)
- Specified by:
get in interface org.apache.webbeans.spi.SingletonService<org.apache.webbeans.config.WebBeansContext>
clear
public void clear(Object key)
- Specified by:
clear in interface org.apache.webbeans.spi.SingletonService<org.apache.webbeans.config.WebBeansContext>
sessionContextClass
public String sessionContextClass()
- Specified by:
sessionContextClass in interface ThreadSingletonService
Copyright © 1999–2015 The Apache Software Foundation. All rights reserved.