public void setThreadLifeTime(long threadLifeTime) { this.threadLifeTime = threadLifeTime; if (threadLifeTime > 0) { long keepAliveTime = getKeepAliveTime(TimeUnit.SECONDS); if (keepAliveTime == 0 || threadLifeTime < keepAliveTime) { setKeepAliveTime(threadLifeTime, TimeUnit.SECONDS); allowCoreThreadTimeOut(true); } } }
@Override public long getCompletedTaskCount() { return threadPoolExecutor.getCompletedTaskCount(); }
@Override public long getTaskCount() { return threadPoolExecutor.getTaskCount(); }
contextService != null? contextService.getContextSetupProvider(): null, rejectPolicy); threadPoolExecutor = new ManagedThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, queue, this.managedThreadFactory); threadPoolExecutor.setThreadLifeTime(threadLifeTime); adapter = new ManagedExecutorServiceAdapter(this); threadPoolExecutor = new ManagedThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, queue, this.managedThreadFactory); threadPoolExecutor.setThreadLifeTime(threadLifeTime); adapter = new ManagedExecutorServiceAdapter(this);
@Override public void execute(Runnable command) { ManagedFutureTask<Void> task = getNewTaskFor(command, null); task.submitted(); threadPoolExecutor.execute(task); }