private void startShutdownDeadlineExecutor() { shutdownDeadlineExecutor = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory("Shutdown deadline timer")); shutdownDeadlineExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); long delayMillis = 50 * 1000; shutdownDeadlineExecutor.schedule(new Runnable() { @Override public void run() { com.yahoo.protect.Process.logAndDie( "Timed out waiting for application shutdown. Please check that all your request handlers " + "drain their request content channels.", true); } }, delayMillis, TimeUnit.MILLISECONDS); }
public DocprocThreadPoolExecutor(int maxNumThreads, BlockingQueue<Runnable> queue, DocprocThreadManager threadMgr) { super((maxNumThreads > 0) ? maxNumThreads : Runtime.getRuntime().availableProcessors(), (maxNumThreads > 0) ? maxNumThreads : Runtime.getRuntime().availableProcessors(), 5, TimeUnit.MINUTES, queue, new DaemonThreadFactory("docproc-")); this.threadManager = threadMgr; allowCoreThreadTimeOut(false); log.log(LogLevel.DEBUG, "Created docproc thread pool with " + super.getCorePoolSize() + " worker threads."); }
private DocprocThreadPoolExecutor threadPool; private final ScheduledThreadPoolExecutor laterExecutor = new ScheduledThreadPoolExecutor(2, new DaemonThreadFactory("docproc-later-")); private ContainerDocumentConfig containerDocConfig; private final DocumentTypeManager documentTypeManager;