Class InterruptibleTask<T>
- java.lang.Object
-
- java.util.concurrent.atomic.AtomicReference<java.lang.Runnable>
-
- com.google.common.util.concurrent.InterruptibleTask<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Runnable
- Direct Known Subclasses:
CombinedFuture.CombinedFutureInterruptibleTask
,TrustedListenableFutureTask.TrustedFutureInterruptibleAsyncTask
,TrustedListenableFutureTask.TrustedFutureInterruptibleTask
@GwtCompatible(emulated=true) abstract class InterruptibleTask<T> extends java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> implements java.lang.Runnable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
InterruptibleTask.DoNothingRunnable
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Runnable
DONE
private static java.lang.Runnable
INTERRUPTING
-
Constructor Summary
Constructors Constructor Description InterruptibleTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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()
(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()
-
Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
-
-
-
-
Method Detail
-
run
public final void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
isDone
abstract boolean isDone()
Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not be called.
-
runInterruptibly
abstract T runInterruptibly() throws java.lang.Exception
Do interruptible work here - do not complete Futures here, as their listeners could be interrupted.- Throws:
java.lang.Exception
-
afterRanInterruptibly
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. Complete Futures here.
-
interruptTask
final void interruptTask()
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.atomic.AtomicReference<java.lang.Runnable>
-
toPendingString
abstract java.lang.String toPendingString()
-
-