|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.futures.BaseFutureImpl<FutureResponse>
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,
boolean raw)
|
|
FutureResponse(Message requestMessage,
FutureSuccessEvaluator futureSuccessEvaluator)
|
|
FutureResponse(Message requestMessage,
FutureSuccessEvaluator futureSuccessEvaluator,
boolean raw)
Create the future and set the request message |
Method Summary | |
---|---|
org.jboss.netty.buffer.ChannelBuffer |
getBuffer()
Returns the raw buffer or null if the answer was empty. |
Object |
getObject()
Returns the object or null if the underlying buffer was raw or the answer was empty. |
Message |
getRequest()
The future response always keeps a reference to the request. |
Message |
getResponse()
Returns the response message. |
boolean |
isShared()
|
FutureResponse |
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. |
void |
share()
|
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 |
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, boolean raw)
public FutureResponse(Message requestMessage, FutureSuccessEvaluator futureSuccessEvaluator)
public FutureResponse(Message requestMessage, FutureSuccessEvaluator futureSuccessEvaluator, boolean raw)
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 org.jboss.netty.buffer.ChannelBuffer getBuffer()
public Object getObject()
public FutureResponse setFailed(String reason)
BaseFuture
setFailed
in interface BaseFuture
setFailed
in class BaseFutureImpl<FutureResponse>
reason
- The reason of failure
public Message getResponse()
public Message getRequest()
public void setReplyTimeoutHandler(ReplyTimeoutHandler replyTimeoutHandler)
replyTimeoutHandler
- The timeout that needs to be canceled if the future returns successfully.public void share()
public boolean isShared()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |