# ThreadPoolExecutor.DiscardPolicy

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

# DiscardPolicy

```
open class DiscardPolicy : RejectedExecutionHandler
```

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

A handler for rejected tasks that silently discards the rejected task.

## Summary

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

|                                                                                                                                                                                                                                                                               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.DiscardPolicy#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)!`)` Does nothing, which has the effect of discarding task r. |

## Public constructors

### DiscardPolicy

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

```
DiscardPolicy()
```

Creates a`DiscardPolicy`.

## 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
```

Does nothing, which has the effect of discarding task r.

|                                                                               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` | if there is no remedy |