@GwtCompatible(emulated=true) abstract class InterruptibleTask<T> extends java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> implements java.lang.Runnable
Modifier and Type | Class and Description |
---|---|
private static class |
InterruptibleTask.DoNothingRunnable |
Modifier and Type | Field and Description |
---|---|
private static java.lang.Runnable |
DONE |
private static java.lang.Runnable |
INTERRUPTING |
private static int |
MAX_BUSY_WAIT_SPINS |
private static java.lang.Runnable |
PARKED |
Constructor and Description |
---|
InterruptibleTask() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract void |
afterRanInterruptibly(T result,
java.lang.Throwable error)
Any interruption that happens as a result of calling interruptTask will arrive before this
method is called.
|
(package private) void |
interruptTask()
Interrupts the running task.
|
(package private) abstract boolean |
isDone()
Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not
be called.
|
void |
run() |
(package private) abstract T |
runInterruptibly()
Do interruptible work here - do not complete Futures here, as their listeners could be
interrupted.
|
(package private) abstract java.lang.String |
toPendingString() |
java.lang.String |
toString() |
private static final java.lang.Runnable DONE
private static final java.lang.Runnable INTERRUPTING
private static final java.lang.Runnable PARKED
private static final int MAX_BUSY_WAIT_SPINS
public final void run()
run
in interface java.lang.Runnable
abstract boolean isDone()
abstract T runInterruptibly() throws java.lang.Exception
java.lang.Exception
abstract void afterRanInterruptibly(T result, java.lang.Throwable error)
final void interruptTask()
Thread.interrupt()
which can
in turn invoke arbitrary code it is not safe to call while holding a lock.public final java.lang.String toString()
toString
in class java.util.concurrent.atomic.AtomicReference<java.lang.Runnable>
abstract java.lang.String toPendingString()