Top Inners Fields Constructors Methods
com.google.common.util.concurrent

pack-priv abstract Class InterruptibleTask<T extends @Nullable Object>

extends AtomicReference<@Nullable Runnable>
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Known Direct Subclasses
com.google.common.util.concurrent.TrustedListenableFutureTask.TrustedFutureInterruptibleTask, com.google.common.util.concurrent.TrustedListenableFutureTask.TrustedFutureInterruptibleAsyncTask, com.google.common.util.concurrent.CombinedFuture.CombinedFutureInterruptibleTask
Annotations
@GwtCompatible
emulated:true
@ReflectionSupport:FULL
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.util.concurrent.NullnessCasts.uncheckedCastNullableTToT, .Platform.restoreInterruptIfIsInterruptedException

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
InterruptibleTask.Blocker

Using this as the blocker object allows introspection and debugging tools to see that the currentRunner thread is blocked on the progress of the interruptor thread, which can help identify deadlocks.

private static class

Field Summary

Modifier and TypeField and Description
private static final Runnable
private static final int
private static final Runnable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
afterRanInterruptiblyFailure(Throwable error)

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.

pack-priv abstract void
afterRanInterruptiblySuccess(T result)

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.

pack-priv final void
interruptTask()

Interrupts the running task.

pack-priv abstract boolean
isDone()

Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not be called.

public final void
run()

Implements java.lang.Runnable.run.

Runs this operation.
pack-priv abstract T
runInterruptibly()

Do interruptible work here - do not complete Futures here, as their listeners could be interrupted.

pack-priv abstract String
public final String
toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.
private void
waitForInterrupt(Thread currentThread)

Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleaseupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

DONEback to summary
private static final Runnable DONE
MAX_BUSY_WAIT_SPINSback to summary
private static final int MAX_BUSY_WAIT_SPINS
PARKEDback to summary
private static final Runnable PARKED

Constructor Detail

InterruptibleTaskback to summary
pack-priv InterruptibleTask()

Method Detail

afterRanInterruptiblyFailureback to summary
pack-priv abstract void afterRanInterruptiblyFailure(Throwable error)

Any interruption that happens as a result of calling interruptTask will arrive before this method is called. Complete Futures here.

afterRanInterruptiblySuccessback to summary
pack-priv abstract void afterRanInterruptiblySuccess(T result)

Any interruption that happens as a result of calling interruptTask will arrive before this method is called. Complete Futures here.

interruptTaskback to summary
pack-priv final void interruptTask()

Interrupts the running task. Because this internally calls Thread#interrupt() which can in turn invoke arbitrary code it is not safe to call while holding a lock.

isDoneback to summary
pack-priv abstract boolean isDone()

Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not be called.

runback to summary
public final void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@SuppressWarnings:ThreadPriorityCheck
@Override
runInterruptiblyback to summary
pack-priv abstract T runInterruptibly() throws Exception

Do interruptible work here - do not complete Futures here, as their listeners could be interrupted.

Annotations
@ParametricNullness
toPendingStringback to summary
pack-priv abstract String toPendingString()
toStringback to summary
public final String toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Doc from java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override
waitForInterruptback to summary
private void waitForInterrupt(Thread currentThread)
com.google.common.util.concurrent back to summary

pack-priv final Class InterruptibleTask.Blocker

extends AbstractOwnableSynchronizer
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Annotations
@VisibleForTesting

Using this as the blocker object allows introspection and debugging tools to see that the currentRunner thread is blocked on the progress of the interruptor thread, which can help identify deadlocks.

Field Summary

Modifier and TypeField and Description
private final InterruptibleTask<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv Thread
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
private void
setOwner(Thread thread)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.util.concurrent.locks.AbstractOwnableSynchronizer:
getExclusiveOwnerThreadsetExclusiveOwnerThread

Field Detail

taskback to summary
private final InterruptibleTask<?> task

Constructor Detail

Blockerback to summary
private Blocker(InterruptibleTask<?> task)

Method Detail

getOwnerback to summary
pack-priv Thread getOwner()
Annotations
@VisibleForTesting
@CheckForNull
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
setOwnerback to summary
private void setOwner(Thread thread)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.google.common.util.concurrent back to summary

private final Class InterruptibleTask.DoNothingRunnable

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • com.google.common.util.concurrent.InterruptibleTask.DoNothingRunnable
All Implemented Interfaces
java.lang.Runnable

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DoNothingRunnableback to summary
private DoNothingRunnable()

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override