| Package | Description | 
|---|---|
| java.util.concurrent | Utility classes commonly useful in concurrent programming. | 
| Modifier and Type | Class and Description | 
|---|---|
| static class  | ThreadPoolExecutor.AbortPolicyA handler for rejected tasks that throws a
  RejectedExecutionException. | 
| static class  | ThreadPoolExecutor.CallerRunsPolicyA handler for rejected tasks that runs the rejected task
 directly in the calling thread of the  executemethod,
 unless the executor has been shut down, in which case the task
 is discarded. | 
| static class  | ThreadPoolExecutor.DiscardOldestPolicyA 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. | 
| static class  | ThreadPoolExecutor.DiscardPolicyA handler for rejected tasks that silently discards the
 rejected task. | 
| Modifier and Type | Method and Description | 
|---|---|
| RejectedExecutionHandler | ThreadPoolExecutor. getRejectedExecutionHandler()Returns the current handler for unexecutable tasks. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | ThreadPoolExecutor. setRejectedExecutionHandler(RejectedExecutionHandler handler)Sets a new handler for unexecutable tasks. | 
| Constructor and Description | 
|---|
| ScheduledThreadPoolExecutor(int corePoolSize,
                           RejectedExecutionHandler handler)Creates a new ScheduledThreadPoolExecutor with the given
 initial parameters. | 
| ScheduledThreadPoolExecutor(int corePoolSize,
                           ThreadFactory threadFactory,
                           RejectedExecutionHandler handler)Creates a new ScheduledThreadPoolExecutor with the given
 initial parameters. | 
| ThreadPoolExecutor(int corePoolSize,
                  int maximumPoolSize,
                  long keepAliveTime,
                  TimeUnit unit,
                  BlockingQueue<Runnable> workQueue,
                  RejectedExecutionHandler handler)Creates a new  ThreadPoolExecutorwith the given initial
 parameters and default thread factory. | 
| ThreadPoolExecutor(int corePoolSize,
                  int maximumPoolSize,
                  long keepAliveTime,
                  TimeUnit unit,
                  BlockingQueue<Runnable> workQueue,
                  ThreadFactory threadFactory,
                  RejectedExecutionHandler handler)Creates a new  ThreadPoolExecutorwith the given initial
 parameters. | 
 Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.