private void initializeServlet(Context context, String name) { Container child = context.findChild(name); if (child instanceof StandardWrapper) { try { StandardWrapper wrapper = (StandardWrapper) child; wrapper.deallocate(wrapper.allocate()); } catch (ServletException ex) { // Continue } } }
/** * Return <code>true</code> if the servlet class represented by this * component implements the <code>SingleThreadModel</code> interface. */ public boolean isSingleThreadModel() { // Short-cuts // If singleThreadModel is true, must have already checked this // If instance != null, must have already loaded if (singleThreadModel || instance != null) { return singleThreadModel; } // The logic to determine this safely is more complex than one might // expect. allocate() already has the necessary logic so re-use it. try { Servlet s = allocate(); deallocate(s); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } return (singleThreadModel); }
/** * Return <code>true</code> if the servlet class represented by this * component implements the <code>SingleThreadModel</code> interface. */ public boolean isSingleThreadModel() { // Short-cuts // If singleThreadModel is true, must have already checked this // If instance != null, must have already loaded if (singleThreadModel || instance != null) { return singleThreadModel; } // The logic to determine this safely is more complex than one might // expect. allocate() already has the necessary logic so re-use it. // Make sure the Servlet is loaded with the right class loader ClassLoader old = Thread.currentThread().getContextClassLoader(); ClassLoader webappClassLoader = ((Context) getParent()).getLoader().getClassLoader(); try { Thread.currentThread().setContextClassLoader(webappClassLoader); Servlet s = allocate(); deallocate(s); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } finally { Thread.currentThread().setContextClassLoader(old); } return singleThreadModel; }
/** * Return <code>true</code> if the servlet class represented by this * component implements the <code>SingleThreadModel</code> interface. */ public boolean isSingleThreadModel() { // Short-cuts // If singleThreadModel is true, must have already checked this // If instance != null, must have already loaded if (singleThreadModel || instance != null) { return singleThreadModel; } // The logic to determine this safely is more complex than one might // expect. allocate() already has the necessary logic so re-use it. // Make sure the Servlet is loaded with the right class loader ClassLoader old = Thread.currentThread().getContextClassLoader(); ClassLoader webappClassLoader = ((Context) getParent()).getLoader().getClassLoader(); try { Thread.currentThread().setContextClassLoader(webappClassLoader); Servlet s = allocate(); deallocate(s); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } finally { Thread.currentThread().setContextClassLoader(old); } return singleThreadModel; }
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();
servlet = wrapper.allocate();