Method Summary
 void execute(Runnable command)
Execute command with zero required delay.
 boolean getContinueExistingPeriodicTasksAfterShutdownPolicy()
Get the policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
 boolean getExecuteExistingDelayedTasksAfterShutdownPolicy()
Get policy on whether to execute existing delayed tasks even when this executor has been shutdown.
 BlockingQueue<Runnable> getQueue()
Returns the task queue used by this executor.
 boolean remove(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.
  ScheduledFuture
schedule(Callable<V> callable, long delay, TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay.
 ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
 ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, 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<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, 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(boolean value)
Set policy on whether to continue executing existing periodic tasks even when this executor has been shutdown.
 void setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean value)
Set policy on whether to execute existing delayed tasks even when this executor has been shutdown.
 void shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
 List<Runnable> 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.
  Future
submit(Callable<T> task)
Submits a value-returning task for execution and returns a Future representing the pending results of the task.
 Future<?> submit(Runnable task)
Submits a Runnable task for execution and returns a Future representing that task.
  Future
submit(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
• 本文已收录于以下专栏：