public void registerForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { cleanup(); shutdown = true; } }); }
public void registerForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { cleanup(); shutdown = true; } }); }
@PostInjection public void listenForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { registryDidShutdown(); } }); }
@PostInjection public void listenForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { registryDidShutdown(); } }); }
@PostInjection public void listenForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { sessionFactory.close(); } }); }
@PostInjection public void start(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { registryDidShutdown(); } }); thread.start(); }
@PostInjection public void listenForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { sessionFactory.close(); } }); }
@PostInjection public void listenForShutdown(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { registryDidShutdown(); } }); }
@PostInjection public void start(RegistryShutdownHub hub) { hub.addRegistryShutdownListener(new Runnable() { @Override public void run() { registryDidShutdown(); } }); thread.start(); }
@Scope(ScopeConstants.PERTHREAD) public static MultipartDecoder buildMultipartDecoder(PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, @Autobuild MultipartDecoderImpl multipartDecoder) { // This is proabably overkill since the FileCleaner should catch temporary files, but lets // be safe. perthreadManager.addThreadCleanupListener(multipartDecoder); if (needToAddShutdownListener.getAndSet(false)) { shutdownHub.addRegistryShutdownListener(new Runnable() { @Override public void run() { FileCleaner.exitWhenFinished(); } }); } return multipartDecoder; }
@Scope(ScopeConstants.PERTHREAD) public static MultipartDecoder buildMultipartDecoder(PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, @Autobuild MultipartDecoderImpl multipartDecoder) { // This is proabably overkill since the FileCleaner should catch temporary files, but lets // be safe. perthreadManager.addThreadCleanupListener(multipartDecoder); if (needToAddShutdownListener.getAndSet(false)) { shutdownHub.addRegistryShutdownListener(new Runnable() { @Override public void run() { FileCleaner.exitWhenFinished(); } }); } return multipartDecoder; }
public static ParallelExecutor buildDeferredExecution(@Symbol(IOCSymbols.THREAD_POOL_CORE_SIZE) int coreSize, @Symbol(IOCSymbols.THREAD_POOL_MAX_SIZE) int maxSize, @Symbol(IOCSymbols.THREAD_POOL_KEEP_ALIVE) @IntermediateType(TimeInterval.class) int keepAliveMillis, @Symbol(IOCSymbols.THREAD_POOL_ENABLED) boolean threadPoolEnabled, @Symbol(IOCSymbols.THREAD_POOL_QUEUE_SIZE) int queueSize, PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, ThunkCreator thunkCreator) { if (!threadPoolEnabled) return new NonParallelExecutor(); LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(queueSize); final ThreadPoolExecutor executorService = new ThreadPoolExecutor(coreSize, maxSize, keepAliveMillis, TimeUnit.MILLISECONDS, workQueue); shutdownHub.addRegistryShutdownListener(new Runnable() { @Override public void run() { executorService.shutdown(); } }); return new ParallelExecutorImpl(executorService, thunkCreator, perthreadManager); }
public static ParallelExecutor buildDeferredExecution(@Symbol(IOCSymbols.THREAD_POOL_CORE_SIZE) int coreSize, @Symbol(IOCSymbols.THREAD_POOL_MAX_SIZE) int maxSize, @Symbol(IOCSymbols.THREAD_POOL_KEEP_ALIVE) @IntermediateType(TimeInterval.class) int keepAliveMillis, @Symbol(IOCSymbols.THREAD_POOL_ENABLED) boolean threadPoolEnabled, @Symbol(IOCSymbols.THREAD_POOL_QUEUE_SIZE) int queueSize, PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, ThunkCreator thunkCreator) { if (!threadPoolEnabled) return new NonParallelExecutor(); LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(queueSize); final ThreadPoolExecutor executorService = new ThreadPoolExecutor(coreSize, maxSize, keepAliveMillis, TimeUnit.MILLISECONDS, workQueue); shutdownHub.addRegistryShutdownListener(new Runnable() { @Override public void run() { executorService.shutdown(); } }); return new ParallelExecutorImpl(executorService, thunkCreator, perthreadManager); }