net.tomp2p.futures
Class FutureLateJoin<K extends BaseFuture>
java.lang.Object
net.tomp2p.futures.BaseFutureImpl<FutureLateJoin<K>>
net.tomp2p.futures.FutureLateJoin<K>
- Type Parameters:
K
-
- All Implemented Interfaces:
- BaseFuture, Cancellable
public class FutureLateJoin<K extends BaseFuture>
- extends BaseFutureImpl<FutureLateJoin<K>>
- implements BaseFuture
FutureLateJoin is similar to FutureForkJoin. The main difference is that with this class you don't need to specify
all the futures in advance. You can just tell how many futures you expect and add them later on.
- Author:
- Thomas Bocek
Constructor Summary |
FutureLateJoin(int nrMaxFutures)
Create this future and set the minSuccess to the number of expected futures. |
FutureLateJoin(int nrMaxFutures,
int minSuccess)
Create this future. |
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 |
Methods inherited from interface net.tomp2p.futures.BaseFuture |
addCancellation, addListener, addListener, await, await, awaitListeners, awaitUninterruptibly, awaitUninterruptibly, getFailedReason, getType, isCompleted, isFailed, isSuccess, removeListener, setFailed, setFailed, setFailed, setFailed, setFailed |
FutureLateJoin
public FutureLateJoin(int nrMaxFutures)
- Create this future and set the minSuccess to the number of expected futures.
- Parameters:
nrMaxFutures
- The number of expected futures.
FutureLateJoin
public FutureLateJoin(int nrMaxFutures,
int minSuccess)
- Create this future.
- Parameters:
nrMaxFutures
- The number of expected futures.minSuccess
- The number of expected successful futures.
add
public boolean add(K future)
- Add a future when ready. This is why its called FutureLateJoin, since you can add futures later on.
- Parameters:
future
- The future to be added.
- Returns:
- True if the future was added to the futurelist, false if the latejoin future is already finished and the
future was not added.
getFuturesDone
public List<K> getFuturesDone()
- Returns the finished futures.
- Returns:
- All the futures that are done.
getLastSuceessFuture
public K getLastSuceessFuture()
- Returns:
- the last successful finished future.
Copyright © 2013. All Rights Reserved.