net.tomp2p.futures
Class FutureWrapper<K extends BaseFuture>

java.lang.Object
  extended by net.tomp2p.futures.BaseFutureImpl<K>
      extended by net.tomp2p.futures.FutureWrapper<K>
Type Parameters:
K -
All Implemented Interfaces:
BaseFuture, Cancellable
Direct Known Subclasses:
FutureWrappedBootstrap

public class FutureWrapper<K extends BaseFuture>
extends BaseFutureImpl<K>

Wraps a future into an other future. This is useful for futures that are created later on. You can create a wrapper, return it to the user, create an other future, wrap this created future and the wrapper will tell the user if the newly created future has finished.

Author:
Thomas Bocek

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.tomp2p.futures.BaseFuture
BaseFuture.FutureType
 
Field Summary
 
Fields inherited from class net.tomp2p.futures.BaseFutureImpl
completed, lock, reason, type
 
Constructor Summary
FutureWrapper()
           
 
Method Summary
 K getWrappedFuture()
           
 void waitFor(K future)
          Wait for the future, which will cause this future to complete if the wrapped future completes.
 
Methods inherited from class net.tomp2p.futures.BaseFutureImpl
addCancellation, addListener, addListener, await, await, awaitListeners, awaitUninterruptibly, awaitUninterruptibly, cancel, getFailedReason, getType, isCompleted, isFailed, isSuccess, notifyListerenrs, removeListener, self, setCompletedAndNotify, setFailed, setFailed, setFailed, setFailed, setFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureWrapper

public FutureWrapper()
Method Detail

waitFor

public void waitFor(K future)
Wait for the future, which will cause this future to complete if the wrapped future completes.

Parameters:
future - The future to wrap

getWrappedFuture

public K getWrappedFuture()
Returns:
The wrapped (original) future.


Copyright © 2013. All Rights Reserved.