API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. ScheduledThreadPoolExecutor View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      AbstractExecutorService
          ThreadPoolExecutor
              ScheduledThreadPoolExecutor
Implements
 ScheduledExecutorService
Subclasses
Description
public class ScheduledThreadPoolExecutor
  A ThreadPoolExecutor that can additionally schedule commands to run after a given delay, or to execute periodically.
See also:   
Constructors
public ScheduledThreadPoolExecutor (int corePoolSize)
  Creates a new ScheduledThreadPoolExecutor with the given core pool size.
public ScheduledThreadPoolExecutor (int corePoolSize, RejectedExecutionHandler handler)
  Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
public ScheduledThreadPoolExecutor (int corePoolSize, ThreadFactory threadFactory)
  Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
public ScheduledThreadPoolExecutor (int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler)
  Creates a new ScheduledThreadPoolExecutor with the given initial parameters.
Methods
Hide/Show inherited methods
protected void afterExecute (Runnable r, Throwable t) [Inherited From ThreadPoolExecutor]
  Method invoked upon completion of execution of the given Runnable.
public void allowCoreThreadTimeOut (boolean value) [Inherited From ThreadPoolExecutor]
  Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive.
public boolean allowsCoreThreadTimeOut () [Inherited From ThreadPoolExecutor]
  Returns true if this pool allows core threads to time out and terminate if no tasks arrive within the keepAlive time, being replaced if needed when new tasks arrive.
public boolean awaitTermination (long timeout, TimeUnit unit) throws InterruptedException [Inherited From ThreadPoolExecutor]
protected void beforeExecute (Thread t, Runnable r) [Inherited From ThreadPoolExecutor]
  Method invoked prior to executing the given Runnable in the given thread.
protected RunnableScheduledFuture< V> decorateTask (Callable< V> callable, RunnableScheduledFuture< V> task)
  Modifies or replaces the task used to execute a callable.
protected RunnableScheduledFuture< V> decorateTask (Runnable runnable, RunnableScheduledFuture< V> task)
  Modifies or replaces the task used to execute a runnable.
public void execute (Runnable command) [Overrides ThreadPoolExecutor]
  Executes command with zero required delay.
protected void finalize () [Inherited From ThreadPoolExecutor]
Invokes shutdown when this executor is no longer referenced.
public int getActiveCount () [Inherited From ThreadPoolExecutor]
  Returns the approximate number of threads that are actively executing tasks.
public long getCompletedTaskCount () [Inherited From ThreadPoolExecutor]
  Returns the approximate total number of tasks that have completed execution.
public boolean getContinueExistingPeriodicTasksAfterShutdownPolicy ()
  Gets the policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
public int getCorePoolSize () [Inherited From ThreadPoolExecutor]
  Returns the core number of threads.
public boolean getExecuteExistingDelayedTasksAfterShutdownPolicy ()
  Gets the policy on whether to execute existing delayed tasks even when this executor has been shutdown.
public long getKeepAliveTime (TimeUnit unit) [Inherited From ThreadPoolExecutor]
  Returns the thread keep-alive time, which is the amount of time that threads in excess of the core pool size may remain idle before being terminated.
public int getLargestPoolSize () [Inherited From ThreadPoolExecutor]
  Returns the largest number of threads that have ever simultaneously been in the pool.
public int getMaximumPoolSize () [Inherited From ThreadPoolExecutor]
  Returns the maximum allowed number of threads.
public int getPoolSize () [Inherited From ThreadPoolExecutor]
  Returns the current number of threads in the pool.
public BlockingQueue<Runnable> getQueue () [Overrides ThreadPoolExecutor]
  Returns the task queue used by this executor.
public RejectedExecutionHandler getRejectedExecutionHandler () [Inherited From ThreadPoolExecutor]
  Returns the current handler for unexecutable tasks.
pack-private Runnable getTask () [Inherited From ThreadPoolExecutor]
  Gets the next task for a worker thread to run.
public long getTaskCount () [Inherited From ThreadPoolExecutor]
  Returns the approximate total number of tasks that have ever been scheduled for execution.
public ThreadFactory getThreadFactory () [Inherited From ThreadPoolExecutor]
  Returns the thread factory used to create new threads.
pack-private void interruptIdleWorkers () [Inherited From ThreadPoolExecutor]
  Wakes up all threads that might be waiting for tasks so they can check for termination.
public List<Future< T>> invokeAll (Collection<Callable> tasks) throws InterruptedException [Inherited From AbstractExecutorService]
public List<Future< T>> invokeAll (Collection<Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException [Inherited From AbstractExecutorService]
public T invokeAny (Collection<Callable> tasks) throws InterruptedException ExecutionException [Inherited From AbstractExecutorService]
public T invokeAny (Collection<Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException ExecutionException TimeoutException [Inherited From AbstractExecutorService]
public boolean isShutdown () [Inherited From ThreadPoolExecutor]
public boolean isTerminated () [Inherited From ThreadPoolExecutor]
public boolean isTerminating () [Inherited From ThreadPoolExecutor]
  Returns true if this executor is in the process of terminating after shutdown or shutdownNow but has not completely terminated.
protected RunnableFuture< T> newTaskFor (Callable< T> callable) [Inherited From AbstractExecutorService]
  Returns a RunnableFuture for the given callable task.
protected RunnableFuture< T> newTaskFor (Runnable runnable, T value) [Inherited From AbstractExecutorService]
  Returns a RunnableFuture for the given runnable and default value.
pack-privatefinal long now ()
Returns nanosecond time offset by origin
public int prestartAllCoreThreads () [Inherited From ThreadPoolExecutor]
  Starts all core threads, causing them to idly wait for work.
public boolean prestartCoreThread () [Inherited From ThreadPoolExecutor]
  Starts a core thread, causing it to idly wait for work.
public void purge () [Inherited From ThreadPoolExecutor]
  Tries to remove from the work queue all Future tasks that have been cancelled.
pack-private void reject (Runnable command) [Inherited From ThreadPoolExecutor]
Invokes the rejected execution handler for the given command.
public boolean remove (Runnable task) [Overrides ThreadPoolExecutor]
public ScheduledFuture< V> schedule (Callable< V> callable, long delay, TimeUnit unit) [Specified in ScheduledExecutorService]
public ScheduledFuture<Object> schedule (Runnable command, long delay, TimeUnit unit) [Specified in ScheduledExecutorService]
public ScheduledFuture<Object> scheduleAtFixedRate (Runnable command, long initialDelay, long period, TimeUnit unit) [Specified in ScheduledExecutorService]
public ScheduledFuture<Object> scheduleWithFixedDelay (Runnable command, long initialDelay, long delay, TimeUnit unit) [Specified in ScheduledExecutorService]
public void setContinueExistingPeriodicTasksAfterShutdownPolicy (boolean value)
  Sets the policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
public void setCorePoolSize (int corePoolSize) [Inherited From ThreadPoolExecutor]
  Sets the core number of threads.
public void setExecuteExistingDelayedTasksAfterShutdownPolicy (boolean value)
  Sets the policy on whether to execute existing delayed tasks even when this executor has been shutdown.
public void setKeepAliveTime (long time, TimeUnit unit) [Inherited From ThreadPoolExecutor]
  Sets the time limit for which threads may remain idle before being terminated.
public void setMaximumPoolSize (int maximumPoolSize) [Inherited From ThreadPoolExecutor]
  Sets the maximum allowed number of threads.
public void setRejectedExecutionHandler (RejectedExecutionHandler handler) [Inherited From ThreadPoolExecutor]
  Sets a new handler for unexecutable tasks.
public void setThreadFactory (ThreadFactory threadFactory) [Inherited From ThreadPoolExecutor]
  Sets the thread factory used to create new threads.
public void shutdown () [Overrides ThreadPoolExecutor]
  Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
public List<Runnable> shutdownNow () [Overrides ThreadPoolExecutor]
  Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
public Future< T> submit (Callable< T> task) [Overrides AbstractExecutorService]
public Future<Object> submit (Runnable task) [Overrides AbstractExecutorService]
public Future< T> submit (Runnable task, T result) [Overrides AbstractExecutorService]
protected void terminated () [Inherited From ThreadPoolExecutor]
  Method invoked when the Executor has terminated.
pack-private void workerDone (Worker w) [Inherited From ThreadPoolExecutor]
  Performs bookkeeping for an exiting worker thread.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int RUNNING = "0" [Inherited From ThreadPoolExecutor]
pack-privatevolatile int runState [Inherited From ThreadPoolExecutor]
  runState provides the main lifecyle control, taking on values: RUNNING: Accept new tasks and process queued tasks SHUTDOWN: Don't accept new tasks, but process queued tasks STOP: Don't accept new tasks, don't process queued tasks, and interrupt in-progress tasks TERMINATED: Same as STOP, plus all threads have terminated The numerical order among these values matters, to allow ordered comparisons.
pack-privatefinalstatic int SHUTDOWN = "1" [Inherited From ThreadPoolExecutor]
pack-privatefinalstatic int STOP = "2" [Inherited From ThreadPoolExecutor]
pack-privatefinalstatic int TERMINATED = "3" [Inherited From ThreadPoolExecutor]
Nested Classes
  ThreadPoolExecutor.CallerRunsPolicy
A handler for rejected tasks that runs the rejected task directly in the calling thread of the execute method, unless the executor has been shut down, in which case the task is discarded.
  ThreadPoolExecutor.AbortPolicy
A handler for rejected tasks that throws a RejectedExecutionException.
  ThreadPoolExecutor.DiscardPolicy
A handler for rejected tasks that silently discards the rejected task.
  ThreadPoolExecutor.DiscardOldestPolicy
A handler for rejected tasks that discards the oldest unhandled request and then retries execute, unless the executor is shut down, in which case the task is discarded.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar