final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(executor, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(executor, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(executor, terminationTimeout, timeUnit); return service; }
@Override protected ExecutorService initializeExecutor( ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) { BlockingQueue<Runnable> queue = createQueue(this.queueCapacity); ThreadPoolExecutor executor = createExecutor(this.corePoolSize, this.maxPoolSize, this.keepAliveSeconds, queue, threadFactory, rejectedExecutionHandler); if (this.allowCoreThreadTimeOut) { executor.allowCoreThreadTimeOut(true); } // Wrap executor with an unconfigurable decorator. this.exposedExecutor = (this.exposeUnconfigurableExecutor ? Executors.unconfigurableExecutorService(executor) : executor); return executor; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(executor, terminationTimeout, timeUnit); return service; }
@Override public ExecutorService getOrderedExecutor(String poolAlias, BlockingQueue<Runnable> queue) { ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS, queue, ThreadFactoryUtil.threadFactory(poolAlias), OnDemandExecutionService::rejectedExecutionHandler); executor.allowCoreThreadTimeOut(true); return unconfigurableExecutorService(executor); }
@Override public ExecutorService getUnorderedExecutor(String poolAlias, BlockingQueue<Runnable> queue) { ThreadPoolExecutor executor = new ThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors(), 30, TimeUnit.SECONDS, queue, ThreadFactoryUtil.threadFactory(poolAlias), OnDemandExecutionService::rejectedExecutionHandler); executor.allowCoreThreadTimeOut(true); return unconfigurableExecutorService(executor); }
@Override protected ExecutorService initializeExecutor( ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) { BlockingQueue<Runnable> queue = createQueue(this.queueCapacity); ThreadPoolExecutor executor = createExecutor(this.corePoolSize, this.maxPoolSize, this.keepAliveSeconds, queue, threadFactory, rejectedExecutionHandler); if (this.allowCoreThreadTimeOut) { executor.allowCoreThreadTimeOut(true); } // Wrap executor with an unconfigurable decorator. this.exposedExecutor = (this.exposeUnconfigurableExecutor ? Executors.unconfigurableExecutorService(executor) : executor); return executor; }
ExecutorService executorService6 = Executors.newWorkStealingPool(4); ExecutorService executorService7 = Executors.unconfigurableExecutorService(executorService4); ExecutorService executorService8 = Executors.unconfigurableScheduledExecutorService(executorService5);
/** * Creates an Executor that uses a single worker thread operating off an unbounded queue. (Note * however that if this single thread terminates due to a failure during execution prior to * shutdown, a new one will take its place if needed to execute subsequent tasks.) Tasks are * guaranteed to execute sequentially, and no more than one task will be active at any given * time. Unlike the otherwise equivalent <tt>newFixedThreadPool(1)</tt> the returned executor is * guaranteed not to be reconfigurable to use additional threads. * * @return the newly created single-threaded Executor */ public static ExecutorService newSingleThreadExecutor() { return Executors.unconfigurableExecutorService(newFixedThreadPool(1)); }
/** * Creates an Executor that uses a single worker thread operating off an unbounded queue, and * uses the provided ThreadFactory to create a new thread when needed. Unlike the otherwise * equivalent <tt>newFixedThreadPool(1, threadFactory)</tt> the returned executor is guaranteed * not to be reconfigurable to use additional threads. * * @param threadFactory the factory to use when creating new threads * @return the newly created single-threaded Executor * @throws NullPointerException if threadFactory is null */ public static ExecutorService newSingleThreadExecutor(ThreadFactory threadFactory) { return Executors.unconfigurableExecutorService(newFixedThreadPool(1, threadFactory)); }
/** * Creates an Executor that uses a single worker thread operating off an unbounded queue. (Note * however that if this single thread terminates due to a failure during execution prior to * shutdown, a new one will take its place if needed to execute subsequent tasks.) Tasks are * guaranteed to execute sequentially, and no more than one task will be active at any given * time. Unlike the otherwise equivalent <tt>newFixedThreadPool(1)</tt> the returned executor is * guaranteed not to be reconfigurable to use additional threads. * * @param isDaemon denotes if the thread should be run as a daemon or not * @return the newly created single-threaded Executor */ public static ExecutorService newSingleThreadExecutor(boolean isDaemon) { return Executors.unconfigurableExecutorService(newFixedThreadPool(1, newNamedThreadFactory(isDaemon))); }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }
final ExecutorService getExitingExecutorService( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { useDaemonThreadFactory(executor); ExecutorService service = Executors.unconfigurableExecutorService(executor); addDelayedShutdownHook(service, terminationTimeout, timeUnit); return service; }