public class ReplyMessage extends Object implements org.jgroups.util.Streamable, Externalizable
Constructor and Description |
---|
ReplyMessage()
Default constructor required by the
Streamable and Externalizable interfaces. |
ReplyMessage(String commandIdentifier,
Object returnValue,
Throwable error,
Serializer serializer)
Constructs a message containing a reply to the command with given
commandIdentifier , containing
either given returnValue or error , which uses the given serializer to
deserialize its contents. |
Modifier and Type | Method and Description |
---|---|
String |
getCommandIdentifier()
Returns the identifier of the command for which this message is a reply.
|
Throwable |
getError(Serializer serializer)
Returns the error of the command processing.
|
Object |
getReturnValue(Serializer serializer)
Returns the returnValue of the command processing.
|
boolean |
isSuccess()
Whether the reply message represents a successfully executed command.
|
void |
readExternal(ObjectInput in) |
void |
readFrom(DataInput in) |
void |
writeExternal(ObjectOutput out) |
void |
writeTo(DataOutput out) |
public ReplyMessage()
Streamable
and Externalizable
interfaces. Do not use
directly.public ReplyMessage(String commandIdentifier, Object returnValue, Throwable error, Serializer serializer)
commandIdentifier
, containing
either given returnValue
or error
, which uses the given serializer
to
deserialize its contents.commandIdentifier
- The identifier of the command to which the message is a replyreturnValue
- The return value of command processerror
- The error that occuered during event processing. When provided (i.e. not
null
, the given returnValue
is ignored.serializer
- The serializer to serialize the message contents withpublic boolean isSuccess()
true
if this reply contains a return value, false
if it contains an error.public Object getReturnValue(Serializer serializer)
isSuccess()
return false
, this
method returns null
. This method also returns null
if response processing returned
a null
value.serializer
- The serializer to deserialize the result withpublic Throwable getError(Serializer serializer)
serializer
- The serializer to deserialize the result withpublic String getCommandIdentifier()
public void writeTo(DataOutput out) throws IOException
writeTo
in interface org.jgroups.util.Streamable
IOException
public void readFrom(DataInput in) throws IOException
readFrom
in interface org.jgroups.util.Streamable
IOException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
Copyright © 2010-2014. All Rights Reserved.