# ThreadPoolExecutor.AbortPolicy

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# AbortPolicy

```
open class AbortPolicy : RejectedExecutionHandler
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                             ||
| ↳ | [java.util.concurrent.ThreadPoolExecutor.AbortPolicy](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor.AbortPolicy#) |

A handler for rejected tasks that throws a[RejectedExecutionException](https://developer.android.com/reference/kotlin/java/util/concurrent/RejectedExecutionException). This is the default handler for[ThreadPoolExecutor](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor)and[ScheduledThreadPoolExecutor](https://developer.android.com/reference/kotlin/java/util/concurrent/ScheduledThreadPoolExecutor).

## Summary

|                                                                       Public constructors                                                                       ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [AbortPolicy](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor.AbortPolicy#AbortPolicy())`()` Creates an`AbortPolicy`. |

|                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                       ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [rejectedExecution](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor.AbortPolicy#rejectedExecution(java.lang.Runnable,%20java.util.concurrent.ThreadPoolExecutor))`(`r:` `[Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)!`, `e:` `[ThreadPoolExecutor](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor)!`)` Always throws RejectedExecutionException. |

## Public constructors

### AbortPolicy

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
AbortPolicy()
```

Creates an`AbortPolicy`.

## Public methods

### rejectedExecution

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun rejectedExecution(
    r: Runnable!, 
    e: ThreadPoolExecutor!
): Unit
```

Always throws RejectedExecutionException.

|                                                                               Parameters                                                                               ||
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `r`        | [Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)!:the runnable task requested to be executed                            |
| `executor` | the executor attempting to execute this task                                                                                                               |
| `e`        | [ThreadPoolExecutor](https://developer.android.com/reference/kotlin/java/util/concurrent/ThreadPoolExecutor)!:the executor attempting to execute this task |

|                        Exceptions                         ||
|---------------------------------------------------|--------|
| `java.util.concurrent.RejectedExecutionException` | always |