public abstract class SafeTimerTask
extends java.util.TimerTask
| Modifier and Type | Field and Description |
|---|---|
boolean |
cancelled
If true, this task has been cancelled.
|
static int |
MAX_SIMULTANEOUS_RUNS
This is the maximum number of simultaneous runs of this task that we'll allow.
|
| Constructor and Description |
|---|
SafeTimerTask() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel() |
protected java.util.concurrent.ExecutorService |
pool()
An overwritable function for getting the pool that we should run this timer's tasks on.
|
void |
registerCancelCallback(java.lang.Runnable runnable)
Sometimes we want to be notified when things cancel.
|
void |
run() |
void |
run(java.util.concurrent.Executor pool)
Run this task on the given pool.
|
void |
run(java.util.Optional<java.util.concurrent.Executor> pool)
Run this job on an optional pool.
|
abstract void |
runUnsafe()
The implementation of the task, except that we are allowed to throw arbitrary exceptions.
|
public boolean cancelled
public static final int MAX_SIMULTANEOUS_RUNS
public void run()
run in interface java.lang.Runnablerun in class java.util.TimerTaskpublic void run(java.util.Optional<java.util.concurrent.Executor> pool)
pool - The executor pool to run on.public void run(java.util.concurrent.Executor pool)
run(Optional).pool - The pool to run on.public void registerCancelCallback(java.lang.Runnable runnable)
public boolean cancel()
cancel in class java.util.TimerTaskprotected java.util.concurrent.ExecutorService pool()
public abstract void runUnsafe()
throws java.lang.Throwable
java.lang.Throwable - An exception that this runner is allowed to throw.