public static void clearInstances(Object key) { singletonService.clear(key); }
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 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) {}; } }