protected void afterStopApplication(final Object stopObject) throws Exception { //Clear the resource injection service final ResourceInjectionService injectionServices = webBeansContext.getService(ResourceInjectionService.class); if (injectionServices != null) { injectionServices.clear(); } //Comment out for commit OWB-502 //ContextFactory.cleanUpContextFactory(); CdiAppContextsService.class.cast(contextsService).removeThreadLocals(); WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader()); }
@Override protected T produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<T> creationalContext) { if (!isStatic) { return super.produce(interceptors, creationalContext); } return (T) webBeansContext.getService(ResourceInjectionService.class).getResourceReference(ref); } }
private void injectResources(T instance) { try { ResourceInjectionService service = null; try { service = webBeansContext.getService(ResourceInjectionService.class); } catch (Exception e) { // When running in tests } if (service != null) { service.injectJavaEEResources(instance); } } catch (Exception e) { throw new WebBeansException(MessageFormat.format( WebBeansLoggerFacade.getTokenString(OWBLogConst.ERROR_0023), instance), e); } }
/** * {@inheritDoc} */ @Override protected void afterStopApplication(Object stopObject) { ServletContext servletContext; if(stopObject instanceof ServletContext) { servletContext = (ServletContext)stopObject; } else { servletContext = getServletContext(stopObject); } //Clear the resource injection service ResourceInjectionService injectionServices = getWebBeansContext().getService(ResourceInjectionService.class); if(injectionServices != null) { injectionServices.clear(); } //Comment out for commit OWB-502 //ContextFactory.cleanUpContextFactory(); this.cleanupShutdownThreadLocals(); if (logger.isLoggable(Level.INFO)) { logger.log(Level.INFO, OWBLogConst.INFO_0002, ServletCompatibilityUtil.getServletInfo(servletContext)); } }
/** * Called after deserialization to get a new instance for some type of resource bean instance that are * not serializable. * * TODO: broken if producer is wrapped but surely better than actually serializing * * @return a new instance of this resource bean. */ public X getActualInstance() { ResourceInjectionService resourceService = getWebBeansContext().getService(ResourceInjectionService.class); X instance = resourceService.getResourceReference(resourceReference); return instance; }
injectionServices.clear();
@Override public T get() { if (webBeansContext == null) { webBeansContext = WebBeansContext.currentInstance(); } try { ResourceInjectionService resourceService = webBeansContext.getService(ResourceInjectionService.class); return resourceService.getResourceReference(resourceReference); } catch (Exception e) { throw new WebBeansException(e); } }