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

pack-priv final Class TimeoutFuture<V extends @Nullable Object>

extends FluentFuture.TrustedFuture<V extends @Nullable Object>
Class Inheritance
Annotations
@J2ktIncompatible
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.util.concurrent.MoreExecutors.directExecutor

Implementation of Futures#withTimeout.

Future that delegates to another but will finish early (via a TimeoutException wrapped in an ExecutionException) if the specified duration expires. The delegate future is interrupted and cancelled if it times out.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
TimeoutFuture.Fire<V extends @Nullable Object>

A runnable that is called when the delegate or the timer completes.

private static class

Field Summary

Modifier and TypeField and Description
private ListenableFuture<V>
private ScheduledFuture<?>

Constructor Summary

AccessConstructor and Description
private

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> ListenableFuture<V>
create(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor)

protected String
pendingToString()

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

Provide a human-readable explanation of why this future has not yet completed.
Inherited from com.google.common.util.concurrent.FluentFuture.TrustedFuture:
addListenercancelgetgetisCancelledisDone

Field Detail

delegateRefback to summary
private ListenableFuture<V> delegateRef
Annotations
@CheckForNull
timerback to summary
private ScheduledFuture<?> timer
Annotations
@CheckForNull

Constructor Detail

TimeoutFutureback to summary
private TimeoutFuture(ListenableFuture<V> delegate)

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> ListenableFuture<V> create(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor)
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
com.google.common.util.concurrent back to summary

private final Class TimeoutFuture.Fire<V extends @Nullable Object>

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

A runnable that is called when the delegate or the timer completes.

Field Summary

Modifier and TypeField and Description
pack-priv TimeoutFuture<V>

Constructor Summary

AccessConstructor and Description
pack-priv
Fire(TimeoutFuture<V> timeoutFuture)

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

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

Field Detail

timeoutFutureRefback to summary
pack-priv TimeoutFuture<V> timeoutFutureRef
Annotations
@CheckForNull

Constructor Detail

Fireback to summary
pack-priv Fire(TimeoutFuture<V> timeoutFuture)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

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

private final Class TimeoutFuture.TimeoutFutureException

extends TimeoutException
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public synchronized Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.

Constructor Detail

TimeoutFutureExceptionback to summary
private TimeoutFutureException(String message)

Method Detail

fillInStackTraceback to summary
public synchronized Throwable fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Doc from java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread.

If the stack trace of this Throwable is not writable, calling this method has no effect.

Returns:Throwable

a reference to this Throwable instance.

Annotations
@Override