@Override public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException { Object injectorInstance = objects.get(instance); if (injectorInstance != null) { try { if (log.isDebugEnabled()) { log.debug("Destroying the OpenWebBeans injector instance"); } TomcatUtil.destroy(injectorInstance, loader); } catch (Exception e) { log.error("Erros is occured while destroying the OpenWebBeans injector instance", e); } } this.processor.destroyInstance(instance); }
@Override public <T extends Filter> T createFilter(Class<T> c) throws ServletException { try { @SuppressWarnings("unchecked") T filter = (T) context.getInstanceManager().newInstance(c.getName()); return filter; } catch (InvocationTargetException e) { ExceptionUtils.handleThrowable(e.getCause()); throw new ServletException(e); } catch (ReflectiveOperationException | NamingException e) { throw new ServletException(e); } }
@Override public <T extends Filter> T createFilter(Class<T> c) throws ServletException { try { @SuppressWarnings("unchecked") T filter = (T) context.getInstanceManager().newInstance(c.getName()); return filter; } catch (IllegalAccessException e) { throw new ServletException(e); } catch (InvocationTargetException e) { throw new ServletException(e); } catch (NamingException e) { throw new ServletException(e); } catch (InstantiationException e) { throw new ServletException(e); } catch (ClassNotFoundException e) { throw new ServletException(e); } }
@SuppressWarnings("unchecked") @Override public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException { check(); T listener = null; try { listener = (T) context.getInstanceManager().newInstance( clazz.getName(), clazz.getClassLoader()); } catch (ReflectiveOperationException | NamingException e) { ServletException se = new ServletException(e); throw se; } catch (Exception e) { ExceptionUtils.handleThrowable(e.getCause()); ServletException se = new ServletException(e); throw se; } return listener; }
throw new ServletException (sm.getString("standardWrapper.notClass", getName())); InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager(); try { servlet = (Servlet) instanceManager.newInstance(servletClass); } catch (ClassCastException e) { unavailable(null); throw new ServletException (sm.getString("standardWrapper.notServlet", servletClass), e); } catch (Throwable e) { e = ExceptionUtils.unwrapInvocationTargetException(e); ExceptionUtils.handleThrowable(e); unavailable(null); if(log.isDebugEnabled()) { log.debug(sm.getString("standardWrapper.instantiate", servletClass), e); throw new ServletException (sm.getString("standardWrapper.instantiate", servletClass), e);
public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException { if (restricted) { throw new UnsupportedOperationException(sm.getString("applicationContext.restricted")); } if (!context.isStarting()) { throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized", getContextPath())); } T listenerInstance = null; try { listenerInstance = (T) context.getInstanceManager().newInstance(clazz); } catch (Throwable t) { throw new ServletException(sm.getString("applicationContext.create"), t); } checkListenerType(listenerInstance); return listenerInstance; }
public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException { T listenerInstance = null; try { listenerInstance = (T) context.getInstanceManager().newInstance(clazz); } catch (Exception e) { throw new ServletException(MESSAGES.listenerCreationFailed(clazz.getName()), e); } asyncListenerInstances.add(listenerInstance); return listenerInstance; }
if (log.isDebugEnabled()) log.debug("Sending application stop events"); (ServletContextListener) listeners[j]; try { fireContainerEvent("beforeContextDestroyed", listener); getInstanceManager().destroyInstance(listeners[j]); } catch (Throwable t) { t = ExceptionUtils.unwrapInvocationTargetException(t); ExceptionUtils.handleThrowable(t); getLogger().error (sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()), t); ok = false; continue; try { getInstanceManager().destroyInstance(listeners[j]); (sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()), t); ok = false;
ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString( "applicationFilterConfig.release", filterDef.getFilterName(), ((StandardContext) context).getInstanceManager().destroyInstance(this.filter); } catch (Exception e) { Throwable t = ExceptionUtils .unwrapInvocationTargetException(e); ExceptionUtils.handleThrowable(t); context.getLogger().error("ApplicationFilterConfig.preDestroy", t);
@Override public void backgroundProcess() { if (!getState().isAvailable()) return; Loader loader = getLoader(); if (loader != null) { try { loader.backgroundProcess(); } catch (Exception e) { log.warn(sm.getString( "standardContext.backgroundProcess.loader", loader), e); resources.backgroundProcess(); } catch (Exception e) { log.warn(sm.getString( "standardContext.backgroundProcess.resources", resources), e); if (instanceManager != null) { try { instanceManager.backgroundProcess(); } catch (Exception e) { log.warn(sm.getString(
/** * Calls the release() method of all available tag handlers in this tag * handler pool. */ public synchronized void release() { for (int i = current; i >= 0; i--) { handlers[i].release(); try { instanceManager.destroyInstance(handlers[i]); } catch (Exception e) { log.warn("Error processing preDestroy on tag instance of " + handlers[i].getClass().getName(), e); } } }
/** * Release the Filter instance associated with this FilterConfig, * if there is one. */ void release() { unregisterJMX(); if (this.filter != null) { if (Globals.IS_SECURITY_ENABLED) { try { SecurityUtil.doAsPrivilege("destroy", filter); } catch(java.lang.Exception ex){ context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex); } SecurityUtil.remove(filter); } else { filter.destroy(); } if (!context.getIgnoreAnnotations()) { try { ((StandardContext) context).getInstanceManager().destroyInstance(this.filter); } catch (Exception e) { context.getLogger().error("ApplicationFilterConfig.preDestroy", e); } } } this.filter = null; }
public void destroy() { if (theServlet != null) { theServlet.destroy(); InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config); try { instanceManager.destroyInstance(theServlet); } catch (Exception e) { // Log any exception, since it can't be passed along log.error(Localizer.getMessage("jsp.error.file.not.found", e.getMessage()), e); } } }
Object obj = context.getInstanceManager().newInstance(className); throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.wrongType", className)); addListener(listener); } catch (IllegalAccessException e) { throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.cnfe", className), e); } catch (InvocationTargetException e) { throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.cnfe", className), e);
public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException { InstanceManager manager = instanceManagers .get(ClassUtils.getContextClassLoader()); if (manager != null) { manager.destroyInstance(instance); } }
@Override public Object newInstance(String fqcn, ClassLoader classLoader) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException, NoSuchMethodException { Object a = super.newInstance(fqcn, classLoader); secondProcessor.newInstance(a); return a; }
@Override public <T extends Filter> T createFilter(Class<T> c) throws ServletException { try { @SuppressWarnings("unchecked") T filter = (T) context.getInstanceManager().newInstance(c.getName()); return filter; } catch (IllegalAccessException e) { throw new ServletException(e); } catch (InvocationTargetException e) { throw new ServletException(e); } catch (NamingException e) { throw new ServletException(e); } catch (InstantiationException e) { throw new ServletException(e); } catch (ClassNotFoundException e) { throw new ServletException(e); } }
@SuppressWarnings("unchecked") @Override public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException { check(); T listener = null; try { listener = (T) context.getInstanceManager().newInstance( clazz.getName(), clazz.getClassLoader()); } catch (ReflectiveOperationException | NamingException e) { ServletException se = new ServletException(e); throw se; } catch (Exception e) { ExceptionUtils.handleThrowable(e.getCause()); ServletException se = new ServletException(e); throw se; } return listener; }
throw new ServletException (sm.getString("standardWrapper.notClass", getName())); InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager(); try { servlet = (Servlet) instanceManager.newInstance(servletClass); } catch (ClassCastException e) { unavailable(null); throw new ServletException (sm.getString("standardWrapper.notServlet", servletClass), e); } catch (Throwable e) { ExceptionUtils.handleThrowable(e); unavailable(null); if(log.isDebugEnabled()) { log.debug(sm.getString("standardWrapper.instantiate", servletClass), e); throw new ServletException (sm.getString("standardWrapper.instantiate", servletClass), e);
public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException { if (restricted) { throw MESSAGES.restrictedListenerCannotCallMethod(); } if (!context.isStarting()) { throw MESSAGES.contextAlreadyInitialized(getContextPath()); } T listenerInstance = null; try { listenerInstance = (T) context.getInstanceManager().newInstance(clazz); } catch (Throwable t) { throw new ServletException(MESSAGES.contextObjectCreationError(), t); } checkListenerType(listenerInstance); return listenerInstance; }