com.atlassian.httpclient.base.concurrent
Class DefaultSettableFutureHandler<V>

java.lang.Object
  extended by com.atlassian.httpclient.base.concurrent.DefaultSettableFutureHandler<V>
All Implemented Interfaces:
SettableFutureHandler<V>

public final class DefaultSettableFutureHandler<V>
extends java.lang.Object
implements SettableFutureHandler<V>

Simple handler that just creates and wraps a normal future


Constructor Summary
DefaultSettableFutureHandler()
           
 
Method Summary
 com.google.common.util.concurrent.SettableFuture<V> getFuture()
           
 boolean set(V value)
          Sets the value of this future.
 boolean setException(java.lang.Throwable throwable)
          Sets the future to having failed with the given exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSettableFutureHandler

public DefaultSettableFutureHandler()
Method Detail

set

public boolean set(@Nullable
                   V value)
Description copied from interface: SettableFutureHandler
Sets the value of this future. This method will return true if the value was successfully set, or false if the future has already been set or cancelled.

Specified by:
set in interface SettableFutureHandler<V>
Parameters:
value - the value the future should hold.
Returns:
true if the value was successfully set.

setException

public boolean setException(java.lang.Throwable throwable)
Description copied from interface: SettableFutureHandler
Sets the future to having failed with the given exception. This exception will be wrapped in an ExecutionException and thrown from the get methods. This method will return true if the exception was successfully set, or false if the future has already been set or cancelled.

Specified by:
setException in interface SettableFutureHandler<V>
Parameters:
throwable - the exception the future should hold.
Returns:
true if the exception was successfully set.

getFuture

public com.google.common.util.concurrent.SettableFuture<V> getFuture()
Specified by:
getFuture in interface SettableFutureHandler<V>
Returns:
The underlying future


Copyright © 2012 Atlassian. All Rights Reserved.