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

pack-priv Class TrustedListenableFutureTask<V extends @Nullable Object>

extends FluentFuture.TrustedFuture<V extends @Nullable Object>
implements RunnableFuture<V extends @Nullable Object>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.RunnableFuture, java.util.concurrent.Future, java.lang.Runnable
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

A RunnableFuture that also implements the ListenableFuture interface.

This should be used in preference to ListenableFutureTask when possible for performance reasons.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private volatile InterruptibleTask<?>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
afterDone()

Overrides com.google.common.util.concurrent.AbstractFuture.afterDone.

Callback method that is called exactly once after the future is completed.
pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V>
create(AsyncCallable<V> callable)

pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V>
create(Callable<V> callable)

pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V>
create(Runnable
the runnable task
runnable
,
V
the result to return on successful completion. If you don't need a particular result, consider using constructions of the form: ListenableFuture<?> f = ListenableFutureTask.create(runnable, null)
result
)

Creates a ListenableFutureTask that will upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.

protected String
pendingToString()

Overrides com.google.common.util.concurrent.AbstractFuture.pendingToString.

Provide a human-readable explanation of why this future has not yet completed.
public void
run()

Implements java.util.concurrent.RunnableFuture.run.

Sets this Future to the result of its computation unless it has been cancelled.
Inherited from com.google.common.util.concurrent.FluentFuture.TrustedFuture:
addListenercancelgetgetisCancelledisDone

Field Detail

taskback to summary
private volatile InterruptibleTask<?> task
Annotations
@CheckForNull

Constructor Detail

TrustedListenableFutureTaskback to summary
pack-priv TrustedListenableFutureTask(Callable<V> callable)
TrustedListenableFutureTaskback to summary
pack-priv TrustedListenableFutureTask(AsyncCallable<V> callable)

Method Detail

afterDoneback to summary
protected void afterDone()

Overrides com.google.common.util.concurrent.AbstractFuture.afterDone.

Doc from com.google.common.util.concurrent.AbstractFuture.afterDone.

Callback method that is called exactly once after the future is completed.

If interruptTask is also run during completion, afterDone runs after it.

The default implementation of this method in AbstractFuture does nothing. This is intended for very lightweight cleanup work, for example, timing statistics or clearing fields. If your task does anything heavier consider, just using a listener with an executor.

Annotations
@Override
createback to summary
pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V> create(AsyncCallable<V> callable)
createback to summary
pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V> create(Callable<V> callable)
createback to summary
pack-priv static <V extends @Nullable Object> TrustedListenableFutureTask<V> create(Runnable runnable, V result)

Creates a ListenableFutureTask that will upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.

Parameters
runnable:Runnable

the runnable task

result:V

the result to return on successful completion. If you don't need a particular result, consider using constructions of the form: ListenableFuture<?> f = ListenableFutureTask.create(runnable, null)

pendingToStringback to summary
protected String pendingToString()

Overrides com.google.common.util.concurrent.AbstractFuture.pendingToString.

Doc from com.google.common.util.concurrent.AbstractFuture.pendingToString.

Provide a human-readable explanation of why this future has not yet completed.

Returns:String

null if an explanation cannot be provided (e.g. because the future is done).

Annotations
@Override
@CheckForNull
runback to summary
public void run()

Implements java.util.concurrent.RunnableFuture.run.

Doc from java.util.concurrent.RunnableFuture.run.

Sets this Future to the result of its computation unless it has been cancelled.

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

private final Class TrustedListenableFutureTask.TrustedFutureInterruptibleAsyncTask

extends InterruptibleTask<ListenableFuture<V extends @Nullable Object>>
Class Inheritance
Annotations
@WeakOuter

Field Summary

Modifier and TypeField and Description
private final AsyncCallable<V>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.
pack-priv void
afterRanInterruptiblySuccess(ListenableFuture<V> result)

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.
pack-priv final boolean
isDone()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.isDone.

Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not be called.
pack-priv ListenableFuture<V>
runInterruptibly()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

Do interruptible work here - do not complete Futures here, as their listeners could be interrupted.
pack-priv String
Inherited from com.google.common.util.concurrent.InterruptibleTask:
interruptTaskruntoString

Field Detail

callableback to summary
private final AsyncCallable<V> callable

Constructor Detail

TrustedFutureInterruptibleAsyncTaskback to summary
pack-priv TrustedFutureInterruptibleAsyncTask(AsyncCallable<V> callable)

Method Detail

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

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

Doc from com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

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

Annotations
@Override
afterRanInterruptiblySuccessback to summary
pack-priv void afterRanInterruptiblySuccess(ListenableFuture<V> result)

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

Doc from com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

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

Annotations
@Override
isDoneback to summary
pack-priv final boolean isDone()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.isDone.

Doc from com.google.common.util.concurrent.InterruptibleTask.isDone.

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

Annotations
@Override
runInterruptiblyback to summary
pack-priv ListenableFuture<V> runInterruptibly() throws Exception

Implements abstract com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

Doc from com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

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

Annotations
@Override
toPendingStringback to summary
pack-priv String toPendingString()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.toPendingString.

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

private final Class TrustedListenableFutureTask.TrustedFutureInterruptibleTask

extends InterruptibleTask<V extends @Nullable Object>
Class Inheritance
Annotations
@WeakOuter

Field Summary

Modifier and TypeField and Description
private final Callable<V>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.
pack-priv void
afterRanInterruptiblySuccess(V result)

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

Any interruption that happens as a result of calling interruptTask will arrive before this method is called.
pack-priv final boolean
isDone()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.isDone.

Called before runInterruptibly - if true, runInterruptibly and afterRanInterruptibly will not be called.
pack-priv V
runInterruptibly()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

Do interruptible work here - do not complete Futures here, as their listeners could be interrupted.
pack-priv String
Inherited from com.google.common.util.concurrent.InterruptibleTask:
interruptTaskruntoString

Field Detail

callableback to summary
private final Callable<V> callable

Constructor Detail

TrustedFutureInterruptibleTaskback to summary
pack-priv TrustedFutureInterruptibleTask(Callable<V> callable)

Method Detail

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

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

Doc from com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblyFailure.

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

Annotations
@Override
afterRanInterruptiblySuccessback to summary
pack-priv void afterRanInterruptiblySuccess(V result)

Implements abstract com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

Doc from com.google.common.util.concurrent.InterruptibleTask.afterRanInterruptiblySuccess.

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

Annotations
@Override
isDoneback to summary
pack-priv final boolean isDone()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.isDone.

Doc from com.google.common.util.concurrent.InterruptibleTask.isDone.

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

Annotations
@Override
runInterruptiblyback to summary
pack-priv V runInterruptibly() throws Exception

Implements abstract com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

Doc from com.google.common.util.concurrent.InterruptibleTask.runInterruptibly.

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

Annotations
@Override
@ParametricNullness
toPendingStringback to summary
pack-priv String toPendingString()

Implements abstract com.google.common.util.concurrent.InterruptibleTask.toPendingString.

Annotations
@Override