/** * Invokes {@link Registry#shutdown()}. */ public void destroy() { if (_registry != null) _registry.shutdown(); _filterConfig = null; }
/** * Invoked from {@link #init(ServletConfig)}, after the registry has been constructed, to * bootstrap the application via the <code>tapestry.MasterApplicationInitializer</code> * service. * * @since 4.0 */ protected void initializeApplication() { ApplicationInitializer ai = (ApplicationInitializer) _registry.getService( "tapestry.init.MasterInitializer", ApplicationInitializer.class); ai.initialize(this); _registry.cleanupThread(); _requestServicer = (ServletRequestServicer) _registry.getService( "tapestry.request.ServletRequestServicer", ServletRequestServicer.class); }
_registry.setupThread(); _registry.cleanupThread();
/** * Cleanup the thread, ignoring any exceptions that may be thrown. */ private void cleanupThread() { try { _registry.cleanupThread(); } catch (Exception ex) { LOG.error(ServletMessages.filterCleanupError(ex), ex); } }
/** * Passes the request to the filter chain, but then invokes {@link Registry#cleanupThread()} * (from a finally block). */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { // I believe the _registry will only be null in a couple of test situations. if (_registry != null) _registry.setupThread(); request.setAttribute(REQUEST_KEY, _registry); chain.doFilter(request, response); } finally { cleanupThread(); checkRegistryRebuild(request); } }
component = registry.getService((String)key, Object.class); logger.debug("Called " + key + " obtained " + component.getClass().getName()); component = registry.getService((Class)key); logger.debug("Called " + ((Class)key).getName() + " obtained " + component.getClass().getName());
_registry.setupThread(); _registry.cleanupThread();
/** * Shutdown the registry so to notify every * {@link org.apache.hivemind.events.RegistryShutdownListener}. */ public void dispose() { if (registry != null) { registry.shutdown(); logger.debug("Registry halted"); } } }
/** * Invoked from {@link #init(ServletConfig)}, after the registry has been constructed, to * bootstrap the application via the <code>tapestry.MasterApplicationInitializer</code> * service. * * @since 4.0 */ protected void initializeApplication() { ApplicationInitializer ai = (ApplicationInitializer) _registry.getService( "tapestry.init.MasterInitializer", ApplicationInitializer.class); ai.initialize(this); _registry.cleanupThread(); _requestServicer = (ServletRequestServicer) _registry.getService( "tapestry.request.ServletRequestServicer", ServletRequestServicer.class); }
private synchronized void checkRegistryRebuild(ServletRequest request) { if (request.getAttribute(REBUILD_REQUEST_KEY) == null) return; Registry oldRegistry = _registry; // Replace the old Registry with a new one. All other threads, but this // one, will begin using the new Registry. Hopefully, we didn't get // rebuild requests on multiple threads. initializeRegistry(); // Shutdown the old Registry. Perhaps we should sleep for a moment, first, // to help ensure that other threads have "cleared out". If not, we'll see some // instability at the instant we shutdown (i.e., all the proxies will get disabled). // Alternately, we should create a WeakReference based monitor that shuts down the // old registry when it is no longer used by any other threads. For the moment, // this functionality is limited to development-time only (not production), so it isn't // urgent. oldRegistry.shutdown(); }
/** * Shuts down the registry (if it exists). * * @since 4.0 */ public void destroy() { getServletContext().removeAttribute(_registryKey); if (_registry != null) { _registry.shutdown(); _registry = null; } super.destroy(); } }
/** * Shuts down the registry (if it exists). * * @since 4.0 */ public void destroy() { getServletContext().removeAttribute(_registryKey); if (_registry != null) { _registry.shutdown(); _registry = null; } super.destroy(); } }