Stay organized with collections
Save and categorize content based on your preferences.
AbortPolicy
open class AbortPolicy : RejectedExecutionHandler
A handler for rejected tasks that throws a RejectedExecutionException
. This is the default handler for ThreadPoolExecutor
and ScheduledThreadPoolExecutor
.
Summary
Public constructors |
Creates an AbortPolicy .
|
Public methods |
open Unit |
Always throws RejectedExecutionException.
|
Public constructors
AbortPolicy
AbortPolicy()
Creates an AbortPolicy
.
Public methods
rejectedExecution
open fun rejectedExecution(
r: Runnable!,
e: ThreadPoolExecutor!
): Unit
Always throws RejectedExecutionException.
Parameters |
r |
Runnable!: the runnable task requested to be executed |
executor |
the executor attempting to execute this task |
e |
ThreadPoolExecutor!: the executor attempting to execute this task |
Exceptions |
java.util.concurrent.RejectedExecutionException |
always |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ThreadPoolExecutor.AbortPolicy\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAbortPolicy\n===========\n\n```\nopen class AbortPolicy : RejectedExecutionHandler\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.util.concurrent.ThreadPoolExecutor.AbortPolicy](#) |\n\nA handler for rejected tasks that throws a [RejectedExecutionException](/reference/kotlin/java/util/concurrent/RejectedExecutionException). This is the default handler for [ThreadPoolExecutor](/reference/kotlin/java/util/concurrent/ThreadPoolExecutor) and [ScheduledThreadPoolExecutor](/reference/kotlin/java/util/concurrent/ScheduledThreadPoolExecutor).\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------|---|\n| [AbortPolicy](#AbortPolicy())`()` Creates an `AbortPolicy`. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [rejectedExecution](#rejectedExecution(java.lang.Runnable,%20java.util.concurrent.ThreadPoolExecutor))`(`r:` `[Runnable](../../lang/Runnable.html#)!`, `e:` `[ThreadPoolExecutor](/reference/kotlin/java/util/concurrent/ThreadPoolExecutor)!`)` Always throws RejectedExecutionException. |\n\nPublic constructors\n-------------------\n\n### AbortPolicy\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nAbortPolicy()\n```\n\nCreates an `AbortPolicy`.\n\nPublic methods\n--------------\n\n### rejectedExecution\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun rejectedExecution(\n r: Runnable!, \n e: ThreadPoolExecutor!\n): Unit\n```\n\nAlways throws RejectedExecutionException.\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------|\n| `r` | [Runnable](../../lang/Runnable.html#)!: the runnable task requested to be executed |\n| `executor` | the executor attempting to execute this task |\n| `e` | [ThreadPoolExecutor](/reference/kotlin/java/util/concurrent/ThreadPoolExecutor)!: the executor attempting to execute this task |\n\n| Exceptions ||\n|---------------------------------------------------|--------|\n| `java.util.concurrent.RejectedExecutionException` | always |"]]