@PreDestroy public void preDestroy() { active = false; SystemInstance.get().removeObserver(this); SystemInstance.get().removeComponent(MetricsService.class); }
@Override public void shutdown(final boolean arg0) { if (threadPoolExecutorUsed) { final ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdown(); if (arg0) { final int timeout = SystemInstance.get().getOptions().get(OPENEJB_EJB_TIMER_POOL_AWAIT_SECONDS, 5); try { tpe.awaitTermination(timeout, TimeUnit.SECONDS); } catch (final InterruptedException e) { logger.error(e.getMessage(), e); } } SystemInstance.get().removeComponent(TimerExecutor.class); } }
private void switchServletContextIfNeeded(final ServletContext sc, final Runnable runnable) { if (sc == null) { runnable.run(); return; } final SystemInstance systemInstance = SystemInstance.get(); final ServletContext old = systemInstance.getComponent(ServletContext.class); systemInstance.setComponent(ServletContext.class, sc); try { runnable.run(); } finally { if (old == null) { systemInstance.removeComponent(ServletContext.class); } else { systemInstance.setComponent(ServletContext.class, old); } } }
public void stop() throws ServiceException { if (assembler != null) { assembler.removeDeploymentListener(this); for (AppInfo appInfo : new ArrayList<AppInfo>(deployedApplications)) { beforeApplicationDestroyed(appInfo); } assembler = null; if (SystemInstance.get().getComponent(WsService.class) == this) { SystemInstance.get().removeComponent(WsService.class); } } }
if (te.decr()) { doShutdownExecutor(waitForJobsToComplete); systemInstance.removeComponent(TimerExecutor.class); } else { // flush jobs, maybe not all dedicated to this threadpool if shared but shouldn't be an issue final ThreadPoolExecutor tpe = ThreadPoolExecutor.class.cast(executor);
@Override public void stop() throws ServiceException { if (assembler != null) { SystemInstance.get().removeObserver(this); for (final AppInfo appInfo : new ArrayList<AppInfo>(deployedApplications.keySet())) { undeploy(new AssemblerBeforeApplicationDestroyed(appInfo, null)); } assembler = null; if (SystemInstance.get().getComponent(WsService.class) == this) { SystemInstance.get().removeComponent(WsService.class); } } }
@Override public void stop() throws ServiceException { if (assembler != null) { SystemInstance.get().removeObserver(this); for (final AppInfo appInfo : new ArrayList<AppInfo>(deployedApplications.keySet())) { undeploy(new AssemblerBeforeApplicationDestroyed(appInfo, null)); } assembler = null; if (SystemInstance.get().getComponent(WsService.class) == this) { SystemInstance.get().removeComponent(WsService.class); } } }
systemInstance.removeComponent(OpenEjbConfiguration.class); systemInstance.removeComponent(JtaEntityManagerRegistry.class); systemInstance.removeComponent(TransactionSynchronizationRegistry.class); systemInstance.removeComponent(EjbResolver.class); systemInstance.fireEvent(new AssemblerDestroyed()); systemInstance.removeObservers();
SystemInstance.get().removeComponent(OpenEjbConfiguration.class); SystemInstance.get().removeComponent(JtaEntityManagerRegistry.class); SystemInstance.get().removeComponent(TransactionSynchronizationRegistry.class); SystemInstance.get().removeComponent(EjbResolver.class); SystemInstance.get().fireEvent(new AssemblerDestroyed()); SystemInstance.reset();
SystemInstance.get().removeComponent(OpenEjbConfiguration.class); SystemInstance.get().removeComponent(JtaEntityManagerRegistry.class); SystemInstance.get().removeComponent(TransactionSynchronizationRegistry.class); SystemInstance.get().removeComponent(EjbResolver.class); SystemInstance.reset();