public class FutureResponse extends BaseFutureImpl<FutureResponse>
BaseFuture.FutureTypecompleted, lock, reason, type| Constructor and Description |
|---|
FutureResponse(Message requestMessage)
Create the future and set the request message.
|
FutureResponse(Message requestMessage,
FutureSuccessEvaluator futureSuccessEvaluator)
Create the future and set the request message.
|
FutureResponse(Message requestMessage,
FutureSuccessEvaluator futureSuccessEvaluator,
ProgressListener progressListener)
Create the future and set the request message.
|
FutureResponse(Message requestMessage,
ProgressListener progressListener)
Create the future and set the request message.
|
| Modifier and Type | Method and Description |
|---|---|
Message |
getRequest()
The future response always keeps a reference to the request.
|
Message |
getResponse()
Returns the response message.
|
FutureResponse |
progress()
This will be called by the user, when the user provides more data.
|
void |
progress(Message interMediateMessage)
This will be called by the TomP2P library when a partial message is ready.
|
FutureResponse |
progressFirst()
Do not call this directly, as this is called from the TomP2P library.
|
protected boolean |
setCompletedAndNotify()
Make sure that the calling method has synchronized (lock).
|
boolean |
setFailedLater(Throwable cause) |
FutureResponse |
setProgressHandler(ProgresHandler progressHandler)
Set the user based progres handler, where the user can add more data and call
progress() when data has
been added. |
FutureResponse |
setResponse()
If we don't get a reply message, which is the case for fire-and-forget messages, then set the reply to null and
set this future to complete with the type Success.
|
FutureResponse |
setResponse(Message responseMessage)
Gets called if a peer responds.
|
boolean |
setResponseLater(Message responseMessage) |
FutureResponse |
setResponseNow() |
String |
toString() |
addCancel, addListener, addListener, await, await, awaitListeners, awaitListenersUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cancel, getFailedReason, getType, isCompleted, isFailed, isSuccess, notifyListeners, removeCancel, removeListener, self, setFailed, setFailed, setFailed, setFailed, setFailedpublic FutureResponse(Message requestMessage)
requestMessage - The request message that will be send over the wire.public FutureResponse(Message requestMessage, FutureSuccessEvaluator futureSuccessEvaluator)
requestMessage - The request message that will be send over the wire.futureSuccessEvaluator - Evaluates if the future was a success or failurepublic FutureResponse(Message requestMessage, ProgressListener progressListener)
requestMessage - The request message that will be send over the wire.progressListener - The progress listener for streaming supportpublic FutureResponse(Message requestMessage, FutureSuccessEvaluator futureSuccessEvaluator, ProgressListener progressListener)
requestMessage - The request message that will be send over the wire.futureSuccessEvaluator - Evaluates if the future was a success or failureprogressListener - The progress listener for streaming supportpublic FutureResponse setResponse()
public FutureResponse setResponse(Message responseMessage)
responseMessage - The received messagepublic boolean setResponseLater(Message responseMessage)
public boolean setFailedLater(Throwable cause)
public FutureResponse setResponseNow()
protected boolean setCompletedAndNotify()
BaseFutureImplsetCompletedAndNotify in class BaseFutureImpl<FutureResponse>public Message getResponse()
public Message getRequest()
public FutureResponse setProgressHandler(ProgresHandler progressHandler)
progress() when data has
been added.progressHandler - The progress handler that will be added by the TomP2P library.public FutureResponse progressFirst() throws InterruptedException
InterruptedException - .public FutureResponse progress() throws InterruptedException
InterruptedException - If latch is interruptedpublic void progress(Message interMediateMessage)
interMediateMessage - The message that is either incomplete as indicated with Message.isDone() or completed. This
will be called before the future completes.Copyright © 2014. All rights reserved.