public static void clearInstances(Object key) { singletonService.clear(key); }
@Override public WebBeansContext get(Object key) { WebBeansContext context = contexts.get(); if (context == null && webApplicationSingletonService != null) { context = webApplicationSingletonService.get(key); if (context != null) { return context; } } if (context == null) { contexts.set(noContext); } return context; }
public static ClassLoader getUsableContainerLoader() { ClassLoader currentCL = Thread.currentThread().getContextClassLoader(); if (currentCL == null) { currentCL = ClassLoaderLock.class.getClassLoader(); } if (Boolean.getBoolean("meecrowave.junit.classloaderlock.off")) { // safeguard for advanced cases return currentCL; } final SingletonService<WebBeansContext> singletonService = WebBeansFinder.getSingletonService(); synchronized (singletonService) { try { if (singletonService instanceof DefaultSingletonService) { synchronized (singletonService) { ((DefaultSingletonService) singletonService).register(currentCL, null); // all fine, it seems we do not have an OWB container for this ClassLoader yet // let's reset it then ; singletonService.clear(currentCL); } return currentCL; } } catch (IllegalArgumentException iae) { // whoops there is already an OWB container registered for this very ClassLoader } return new ClassLoader(currentCL) {}; } }
public static WebBeansContext getSingletonInstance() { return singletonService.get(WebBeansUtil.getCurrentClassLoader()); }
public static ClassLoader getUsableContainerLoader() { ClassLoader currentCL = Thread.currentThread().getContextClassLoader(); if (currentCL == null) { currentCL = ClassLoaderLock.class.getClassLoader(); } if (Boolean.getBoolean("meecrowave.junit.classloaderlock.off")) { // safeguard for advanced cases return currentCL; } final SingletonService<WebBeansContext> singletonService = WebBeansFinder.getSingletonService(); synchronized (singletonService) { try { if (singletonService instanceof DefaultSingletonService) { synchronized (singletonService) { ((DefaultSingletonService) singletonService).register(currentCL, null); // all fine, it seems we do not have an OWB container for this ClassLoader yet // let's reset it then ; singletonService.clear(currentCL); } return currentCL; } } catch (IllegalArgumentException iae) { // whoops there is already an OWB container registered for this very ClassLoader } return new ClassLoader(currentCL) {}; } }