T
- the type of the repsonse.public class Response<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
long |
createTime |
int |
id |
static java.lang.Object |
NO_RESULT |
MessageProcessor |
processor |
int |
type |
java.lang.Object |
user |
Constructor and Description |
---|
Response(MessageDecoder<T> decoder,
MessageProcessor messageProcessor,
int id,
int type,
java.lang.Object user)
Create a new response.
|
Modifier and Type | Method and Description |
---|---|
MessageContext |
context()
Returns the message context of the response.
|
protected ResponseException |
decodeError(MessageContext ctx,
MessageReader mr)
Decodes an error into an exception
|
T |
get()
Gets the object from the response.
|
boolean |
hasException() |
boolean |
hasValue()
Deprecated.
use isCompleted();
|
boolean |
isCompleted()
Returns whether or not the response is complete.
|
boolean |
isLost() |
T |
poll() |
java.lang.Object |
pollAny() |
void |
setHandler(ResponseHandler<T> handler) |
java.lang.String |
toString() |
public static final java.lang.Object NO_RESULT
public final MessageProcessor processor
public final int id
public final int type
public final java.lang.Object user
public final long createTime
public Response(MessageDecoder<T> decoder, MessageProcessor messageProcessor, int id, int type, java.lang.Object user)
decoder
- The decoder used to decode the message into an object or value.user
- Custom user objectid
- The ID of the transactionmessageProcessor
- The message processorpublic boolean isCompleted()
public boolean hasValue()
public boolean hasException()
public boolean isLost()
public T poll()
public java.lang.Object pollAny()
public MessageContext context()
protected ResponseException decodeError(MessageContext ctx, MessageReader mr)
mr
- Message reader containing the body of the message.public void setHandler(ResponseHandler<T> handler)
public T get() throws CommandException
ResponseException
- When the command executed failed on the remote side.CommandException
public java.lang.String toString()
toString
in class java.lang.Object