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 |
|---|---|
protected boolean |
completedAndNotify()
Make sure that the calling method has synchronized (lock).
|
FutureResponse |
emptyResponse()
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.
|
boolean |
failedLater(Throwable cause) |
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.
|
FutureResponse |
progressHandler(ProgresHandler progressHandler)
Set the user based progres handler, where the user can add more data and call
progress() when data has
been added. |
Message |
request()
The future response always keeps a reference to the request.
|
FutureResponse |
response(Message responseMessage)
Gets called if a peer responds.
|
boolean |
responseLater(Message responseMessage) |
Message |
responseMessage()
Returns the response message.
|
FutureResponse |
responseNow() |
String |
toString() |
addCancel, addListener, addListener, await, await, awaitListeners, awaitListenersUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cancel, failed, failed, failed, failed, failed, failedReason, isCompleted, isFailed, isSuccess, notifyListeners, removeCancel, removeListener, self, self, typepublic 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 emptyResponse()
public FutureResponse response(Message responseMessage)
responseMessage - The received messagepublic boolean responseLater(Message responseMessage)
public boolean failedLater(Throwable cause)
public FutureResponse responseNow()
protected boolean completedAndNotify()
BaseFutureImplcompletedAndNotify in class BaseFutureImpl<FutureResponse>public Message responseMessage()
public Message request()
public FutureResponse progressHandler(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.