java.util.concurrent
Class ScheduledThreadPoolExecutor

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.concurrent.AbstractExecutorService sample code for java.util.concurrent.AbstractExecutorService definition code for java.util.concurrent.AbstractExecutorService 
      extended by java.util.concurrent.ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor 
          extended by java.util.concurrent.ScheduledThreadPoolExecutor
All Implemented Interfaces:
Executor sample code for java.util.concurrent.Executor definition code for java.util.concurrent.Executor , ExecutorService sample code for java.util.concurrent.ExecutorService definition code for java.util.concurrent.ExecutorService , ScheduledExecutorService sample code for java.util.concurrent.ScheduledExecutorService definition code for java.util.concurrent.ScheduledExecutorService

public class ScheduledThreadPoolExecutor
extends ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor
implements ScheduledExecutorService sample code for java.util.concurrent.ScheduledExecutorService definition code for java.util.concurrent.ScheduledExecutorService

A ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor that can additionally schedule commands to run after a given delay, or to execute periodically. This class is preferable to Timer sample code for java.util.Timer definition code for java.util.Timer when multiple worker threads are needed, or when the additional flexibility or capabilities of ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor (which this class extends) are required.

Delayed tasks execute no sooner than they are enabled, but without any real-time guarantees about when, after they are enabled, they will commence. Tasks scheduled for exactly the same execution time are enabled in first-in-first-out (FIFO) order of submission.

While this class inherits from ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor , a few of the inherited tuning methods are not useful for it. In particular, because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect.

Since:
1.5

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy sample code for java.util.concurrent.ThreadPoolExecutor.AbortPolicy definition code for java.util.concurrent.ThreadPoolExecutor.AbortPolicy , ThreadPoolExecutor.CallerRunsPolicy sample code for java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy definition code for java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy , ThreadPoolExecutor.DiscardOldestPolicy sample code for java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy definition code for java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy , ThreadPoolExecutor.DiscardPolicy sample code for java.util.concurrent.ThreadPoolExecutor.DiscardPolicy definition code for java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
 
Constructor Summary
ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int) (int corePoolSize)
          Creates a new ScheduledThreadPoolExecutor with the given core pool size.
ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler) (int corePoolSize, RejectedExecutionHandler sample code for java.util.concurrent.RejectedExecutionHandler definition code for java.util.concurrent.RejectedExecutionHandler  handler)
          Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory) (int corePoolSize, ThreadFactory sample code for java.util.concurrent.ThreadFactory definition code for java.util.concurrent.ThreadFactory  threadFactory)
          Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler) (int corePoolSize, ThreadFactory sample code for java.util.concurrent.ThreadFactory definition code for java.util.concurrent.ThreadFactory  threadFactory, RejectedExecutionHandler sample code for java.util.concurrent.RejectedExecutionHandler definition code for java.util.concurrent.RejectedExecutionHandler  handler)
          Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
 
Method Summary
 void execute sample code for java.util.concurrent.ScheduledThreadPoolExecutor.execute(java.lang.Runnable) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.execute(java.lang.Runnable) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  command)
          Execute command with zero required delay.
 boolean getContinueExistingPeriodicTasksAfterShutdownPolicy sample code for java.util.concurrent.ScheduledThreadPoolExecutor.getContinueExistingPeriodicTasksAfterShutdownPolicy() definition code for java.util.concurrent.ScheduledThreadPoolExecutor.getContinueExistingPeriodicTasksAfterShutdownPolicy() ()
          Get the policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
 boolean getExecuteExistingDelayedTasksAfterShutdownPolicy sample code for java.util.concurrent.ScheduledThreadPoolExecutor.getExecuteExistingDelayedTasksAfterShutdownPolicy() definition code for java.util.concurrent.ScheduledThreadPoolExecutor.getExecuteExistingDelayedTasksAfterShutdownPolicy() ()
          Get policy on whether to execute existing delayed tasks even when this executor has been shutdown.
 BlockingQueue sample code for java.util.concurrent.BlockingQueue definition code for java.util.concurrent.BlockingQueue <Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable > getQueue sample code for java.util.concurrent.ScheduledThreadPoolExecutor.getQueue() definition code for java.util.concurrent.ScheduledThreadPoolExecutor.getQueue() ()
          Returns the task queue used by this executor.
 boolean remove sample code for java.util.concurrent.ScheduledThreadPoolExecutor.remove(java.lang.Runnable) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.remove(java.lang.Runnable) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  task)
          Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.
<V> ScheduledFuture sample code for java.util.concurrent.ScheduledFuture definition code for java.util.concurrent.ScheduledFuture <V>
schedule sample code for java.util.concurrent.ScheduledThreadPoolExecutor.schedule(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.schedule(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit) (Callable sample code for java.util.concurrent.Callable definition code for java.util.concurrent.Callable <V> callable, long delay, TimeUnit sample code for java.util.concurrent.TimeUnit definition code for java.util.concurrent.TimeUnit  unit)
          Creates and executes a ScheduledFuture that becomes enabled after the given delay.
 ScheduledFuture sample code for java.util.concurrent.ScheduledFuture definition code for java.util.concurrent.ScheduledFuture <?> schedule sample code for java.util.concurrent.ScheduledThreadPoolExecutor.schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  command, long delay, TimeUnit sample code for java.util.concurrent.TimeUnit definition code for java.util.concurrent.TimeUnit  unit)
          Creates and executes a one-shot action that becomes enabled after the given delay.
 ScheduledFuture sample code for java.util.concurrent.ScheduledFuture definition code for java.util.concurrent.ScheduledFuture <?> scheduleAtFixedRate sample code for java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  command, long initialDelay, long period, TimeUnit sample code for java.util.concurrent.TimeUnit definition code for java.util.concurrent.TimeUnit  unit)
          Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.
 ScheduledFuture sample code for java.util.concurrent.ScheduledFuture definition code for java.util.concurrent.ScheduledFuture <?> scheduleWithFixedDelay sample code for java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  command, long initialDelay, long delay, TimeUnit sample code for java.util.concurrent.TimeUnit definition code for java.util.concurrent.TimeUnit  unit)
          Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.
 void setContinueExistingPeriodicTasksAfterShutdownPolicy sample code for java.util.concurrent.ScheduledThreadPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean) (boolean value)
          Set policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
 void setExecuteExistingDelayedTasksAfterShutdownPolicy sample code for java.util.concurrent.ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean) (boolean value)
          Set policy on whether to execute existing delayed tasks even when this executor has been shutdown.
 void shutdown sample code for java.util.concurrent.ScheduledThreadPoolExecutor.shutdown() definition code for java.util.concurrent.ScheduledThreadPoolExecutor.shutdown() ()
          Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
 List sample code for java.util.List definition code for java.util.List <Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable > shutdownNow sample code for java.util.concurrent.ScheduledThreadPoolExecutor.shutdownNow() definition code for java.util.concurrent.ScheduledThreadPoolExecutor.shutdownNow() ()
          Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
<T> Future sample code for java.util.concurrent.Future definition code for java.util.concurrent.Future <T>
submit sample code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.util.concurrent.Callable) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.util.concurrent.Callable) (Callable sample code for java.util.concurrent.Callable definition code for java.util.concurrent.Callable <T> task)
          Submits a value-returning task for execution and returns a Future representing the pending results of the task.
 Future sample code for java.util.concurrent.Future definition code for java.util.concurrent.Future <?> submit sample code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.lang.Runnable) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.lang.Runnable) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  task)
          Submits a Runnable task for execution and returns a Future representing that task.
<T> Future sample code for java.util.concurrent.Future definition code for java.util.concurrent.Future <T>
submit sample code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.lang.Runnable, T) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.submit(java.lang.Runnable, T) (Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  task, T result)
          Submits a Runnable task for execution and returns a Future representing that task that will upon completion return the given result
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor
afterExecute sample code for java.util.concurrent.ThreadPoolExecutor.afterExecute(java.lang.Runnable, java.lang.Throwable) definition code for java.util.concurrent.ThreadPoolExecutor.afterExecute(java.lang.Runnable, java.lang.Throwable) , awaitTermination sample code for java.util.concurrent.ThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit) , beforeExecute sample code for java.util.concurrent.ThreadPoolExecutor.beforeExecute(java.lang.Thread, java.lang.Runnable) definition code for java.util.concurrent.ThreadPoolExecutor.beforeExecute(java.lang.Thread, java.lang.Runnable) , finalize sample code for java.util.concurrent.ThreadPoolExecutor.finalize() definition code for java.util.concurrent.ThreadPoolExecutor.finalize() , getActiveCount sample code for java.util.concurrent.ThreadPoolExecutor.getActiveCount() definition code for java.util.concurrent.ThreadPoolExecutor.getActiveCount() , getCompletedTaskCount sample code for java.util.concurrent.ThreadPoolExecutor.getCompletedTaskCount() definition code for java.util.concurrent.ThreadPoolExecutor.getCompletedTaskCount() , getCorePoolSize sample code for java.util.concurrent.ThreadPoolExecutor.getCorePoolSize() definition code for java.util.concurrent.ThreadPoolExecutor.getCorePoolSize() , getKeepAliveTime sample code for java.util.concurrent.ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit) , getLargestPoolSize sample code for java.util.concurrent.ThreadPoolExecutor.getLargestPoolSize() definition code for java.util.concurrent.ThreadPoolExecutor.getLargestPoolSize() , getMaximumPoolSize sample code for java.util.concurrent.ThreadPoolExecutor.getMaximumPoolSize() definition code for java.util.concurrent.ThreadPoolExecutor.getMaximumPoolSize() , getPoolSize sample code for java.util.concurrent.ThreadPoolExecutor.getPoolSize() definition code for java.util.concurrent.ThreadPoolExecutor.getPoolSize() , getRejectedExecutionHandler sample code for java.util.concurrent.ThreadPoolExecutor.getRejectedExecutionHandler() definition code for java.util.concurrent.ThreadPoolExecutor.getRejectedExecutionHandler() , getTaskCount sample code for java.util.concurrent.ThreadPoolExecutor.getTaskCount() definition code for java.util.concurrent.ThreadPoolExecutor.getTaskCount() , getThreadFactory sample code for java.util.concurrent.ThreadPoolExecutor.getThreadFactory() definition code for java.util.concurrent.ThreadPoolExecutor.getThreadFactory() , isShutdown sample code for java.util.concurrent.ThreadPoolExecutor.isShutdown() definition code for java.util.concurrent.ThreadPoolExecutor.isShutdown() , isTerminated sample code for java.util.concurrent.ThreadPoolExecutor.isTerminated() definition code for java.util.concurrent.ThreadPoolExecutor.isTerminated() , isTerminating sample code for java.util.concurrent.ThreadPoolExecutor.isTerminating() definition code for java.util.concurrent.ThreadPoolExecutor.isTerminating() , prestartAllCoreThreads sample code for java.util.concurrent.ThreadPoolExecutor.prestartAllCoreThreads() definition code for java.util.concurrent.ThreadPoolExecutor.prestartAllCoreThreads() , prestartCoreThread sample code for java.util.concurrent.ThreadPoolExecutor.prestartCoreThread() definition code for java.util.concurrent.ThreadPoolExecutor.prestartCoreThread() , purge sample code for java.util.concurrent.ThreadPoolExecutor.purge() definition code for java.util.concurrent.ThreadPoolExecutor.purge() , setCorePoolSize sample code for java.util.concurrent.ThreadPoolExecutor.setCorePoolSize(int) definition code for java.util.concurrent.ThreadPoolExecutor.setCorePoolSize(int) , setKeepAliveTime sample code for java.util.concurrent.ThreadPoolExecutor.setKeepAliveTime(long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ThreadPoolExecutor.setKeepAliveTime(long, java.util.concurrent.TimeUnit) , setMaximumPoolSize sample code for java.util.concurrent.ThreadPoolExecutor.setMaximumPoolSize(int) definition code for java.util.concurrent.ThreadPoolExecutor.setMaximumPoolSize(int) , setRejectedExecutionHandler sample code for java.util.concurrent.ThreadPoolExecutor.setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler) definition code for java.util.concurrent.ThreadPoolExecutor.setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler) , setThreadFactory sample code for java.util.concurrent.ThreadPoolExecutor.setThreadFactory(java.util.concurrent.ThreadFactory) definition code for java.util.concurrent.ThreadPoolExecutor.setThreadFactory(java.util.concurrent.ThreadFactory) , terminated sample code for java.util.concurrent.ThreadPoolExecutor.terminated() definition code for java.util.concurrent.ThreadPoolExecutor.terminated()
 
Methods inherited from class java.util.concurrent.AbstractExecutorService sample code for java.util.concurrent.AbstractExecutorService definition code for java.util.concurrent.AbstractExecutorService
invokeAll sample code for java.util.concurrent.AbstractExecutorService.invokeAll(java.util.Collection) definition code for java.util.concurrent.AbstractExecutorService.invokeAll(java.util.Collection) , invokeAll sample code for java.util.concurrent.AbstractExecutorService.invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.AbstractExecutorService.invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit) , invokeAny sample code for java.util.concurrent.AbstractExecutorService.invokeAny(java.util.Collection) definition code for java.util.concurrent.AbstractExecutorService.invokeAny(java.util.Collection) , invokeAny sample code for java.util.concurrent.AbstractExecutorService.invokeAny(java.util.Collection, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.AbstractExecutorService.invokeAny(java.util.Collection, long, java.util.concurrent.TimeUnit)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface java.util.concurrent.ExecutorService sample code for java.util.concurrent.ExecutorService definition code for java.util.concurrent.ExecutorService
awaitTermination sample code for java.util.concurrent.ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit) , invokeAll sample code for java.util.concurrent.ExecutorService.invokeAll(java.util.Collection) definition code for java.util.concurrent.ExecutorService.invokeAll(java.util.Collection) , invokeAll sample code for java.util.concurrent.ExecutorService.invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ExecutorService.invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit) , invokeAny sample code for java.util.concurrent.ExecutorService.invokeAny(java.util.Collection) definition code for java.util.concurrent.ExecutorService.invokeAny(java.util.Collection) , invokeAny sample code for java.util.concurrent.ExecutorService.invokeAny(java.util.Collection, long, java.util.concurrent.TimeUnit) definition code for java.util.concurrent.ExecutorService.invokeAny(java.util.Collection, long, java.util.concurrent.TimeUnit) , isShutdown sample code for java.util.concurrent.ExecutorService.isShutdown() definition code for java.util.concurrent.ExecutorService.isShutdown() , isTerminated sample code for java.util.concurrent.ExecutorService.isTerminated() definition code for java.util.concurrent.ExecutorService.isTerminated()
 

Constructor Detail

ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor(int) definition code for java.util.concurrent.ScheduledThreadPoolExecutor(int)

public ScheduledThreadPoolExecutor(int corePoolSize)
Creates a new ScheduledThreadPoolExecutor with the given core pool size.

Parameters:
corePoolSize - the number of threads to keep in the pool, even if they are idle.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if corePoolSize less than or equal to zero

ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory) definition code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory)

public ScheduledThreadPoolExecutor(int corePoolSize,
                                   ThreadFactory sample code for java.util.concurrent.ThreadFactory definition code for java.util.concurrent.ThreadFactory  threadFactory)
Creates a new ScheduledThreadPoolExecutor with the given initial parameters.

Parameters:
corePoolSize - the number of threads to keep in the pool, even if they are idle.
threadFactory - the factory to use when the executor creates a new thread.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if threadFactory is null

ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler) definition code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler)

public ScheduledThreadPoolExecutor(int corePoolSize,
                                   RejectedExecutionHandler sample code for java.util.concurrent.RejectedExecutionHandler definition code for java.util.concurrent.RejectedExecutionHandler  handler)
Creates a new ScheduledThreadPoolExecutor with the given initial parameters.

Parameters:
corePoolSize - the number of threads to keep in the pool, even if they are idle.
handler - the handler to use when execution is blocked because the thread bounds and queue capacities are reached.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if handler is null

ScheduledThreadPoolExecutor sample code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler) definition code for java.util.concurrent.ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler)

public ScheduledThreadPoolExecutor(int corePoolSize,
                                   ThreadFactory sample code for java.util.concurrent.ThreadFactory definition code for java.util.concurrent.ThreadFactory  threadFactory,
                                   RejectedExecutionHandler sample code for java.util.concurrent.RejectedExecutionHandler definition code for java.util.concurrent.RejectedExecutionHandler  handler)
Creates a new ScheduledThreadPoolExecutor with the given initial parameters.

Parameters:
corePoolSize - the number of threads to keep in the pool, even if they are idle.
threadFactory - the factory to use when the executor creates a new thread.
handler - the handler to use when execution is blocked because the thread bounds and queue capacities are reached.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if threadFactory or handler is null
Method Detail

remove sample code for java.util.concurrent.ScheduledThreadPoolExecutor.remove(java.lang.Runnable) definition code for java.util.concurrent.ScheduledThreadPoolExecutor.remove(java.lang.Runnable)

public boolean remove(Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  task)
Description copied from class: ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor.remove(java.lang.Runnable) definition code for java.util.concurrent.ThreadPoolExecutor.remove(java.lang.Runnable)
Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.

This method may be useful as one part of a cancellation scheme. It may fail to remove tasks that have been converted into other forms before being placed on the internal queue. For example, a task entered using submit might be converted into a form that maintains Future status. However, in such cases, method ThreadPoolExecutor.purge() sample code for java.util.concurrent.ThreadPoolExecutor.purge() definition code for java.util.concurrent.ThreadPoolExecutor.purge() may be used to remove those Futures that have been cancelled.

Overrides:
remove sample code for java.util.concurrent.ThreadPoolExecutor.remove(java.lang.Runnable) definition code for java.util.concurrent.ThreadPoolExecutor.remove(java.lang.Runnable) in class ThreadPoolExecutor sample code for java.util.concurrent.ThreadPoolExecutor definition code for java.util.concurrent.ThreadPoolExecutor
Parameters:
task - the task to remove
Returns:
true if the task was removed