|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.futures.BaseFutureImpl
net.tomp2p.futures.FutureResponse
public class FutureResponse
Each response has one request messages. The corresponding response message is set only if the request has been successful. This is indicated with isFailed.
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 | |
---|---|
FutureResponse(Message requestMessage)
Create the future and set the request message |
|
FutureResponse(Message requestMessage,
FutureSuccessEvaluator futureSuccessEvaluator)
Create the future and set the request message |
Method Summary | |
---|---|
Message |
getRequest()
The future response always keeps a reference to the request. |
Message |
getResponse()
Returns the response message. |
void |
setFailed(String reason)
Sets the failed flat to true and the completed flag to true. |
void |
setReplyTimeoutHandler(ReplyTimeoutHandler replyTimeoutHandler)
Set the cancel operation for the timeout handler. |
void |
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. |
void |
setResponse(Message responseMessage)
Gets called if a peer responds. |
Methods inherited from class net.tomp2p.futures.BaseFutureImpl |
---|
addCancellation, addListener, await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, getFailedReason, getType, isCompleted, isFailed, isSuccess, notifyListerenrs, removeCancellation, removeListener, setCompletedAndNotify, setFailed, setFailed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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 failureMethod Detail |
---|
public void setResponse()
public void setResponse(Message responseMessage)
message
- The received messagepublic void setFailed(String reason)
BaseFuture
setFailed
in interface BaseFuture
setFailed
in class BaseFutureImpl
public Message getResponse()
public Message getRequest()
public void setReplyTimeoutHandler(ReplyTimeoutHandler replyTimeoutHandler)
replyTimeoutHandler
- The timeout that needs to be canceled if the
future returns successfully.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |