java.lang.Object
java.util.EventObject
cl.netswitch.lib.server.ReplyEvent
- All Implemented Interfaces:
Serializable
ReplyEvent is used to notify that a reply message has arrived.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionReplyEvent
(RequestEvent request, Message message) Constructs a newReplyEvent
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Logs a fine message with supplied format and arguments.Returns the reply message ornull
if the reply timeout.<T extends Serializable>
TReturns the object contained in thesuccess message
of this ReplyEvent.Returns the request event of this ReplyEvent.Returns the server channel of this ReplyEvent.Returns the reply message with aSUCCESS
status.void
Logs an information message with supplied format and arguments.boolean
isLoggable
(Level level) Returnstrue
if the given message level is being logged.void
Logs a severe message with supplied format and arguments.void
Logs a severe message with supplied throwable, format and arguments.void
Logs a warning message with supplied format and arguments.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
ReplyEvent
Constructs a newReplyEvent
instance.- Parameters:
request
- the request sending the async subrequest.message
- the reply message of this event (null if timeout).- Throws:
NullPointerException
- ifrequest
isnull
.
-
-
Method Details
-
getServerChannel
Returns the server channel of this ReplyEvent.- Returns:
- the server channel of this ReplyEvent.
-
getRequest
Returns the request event of this ReplyEvent.- Returns:
- the request event of this ReplyEvent.
-
getMessage
Returns the reply message ornull
if the reply timeout.- Returns:
- the reply message or
null
if the reply timeout.
-
getSuccessMessage
Returns the reply message with aSUCCESS
status. It throws aServiceException
if thestatus
of the message is anERROR
. TheServiceException
includes thestatus
,text
anduserMessage
of the reply message. It throws aReplyTimeoutException
if the reply timeout.- Returns:
- the success reply message of this event.
- Throws:
ReplyTimeoutException
- if the reply timeout.ServiceException
- if the reply message has an error status.
-
getObject
Returns the object contained in thesuccess message
of this ReplyEvent.Warning: to reduce memory consumption, this method returns a reference to (not a copy of) the mutable object stored in the reply message. If the returned object is later modified, the reply message object will be modified.
- Type Parameters:
T
- the type of the returned object.- Parameters:
type
- the class of the returned object.- Returns:
- a typed object or
null
if not defined. - Throws:
NullPointerException
- iftype
isnull
.ReplyTimeoutException
- if the reply timeout.ServiceException
- if the reply message has an error status.ClassCastException
- if object is not an instance oftype
.- See Also:
-
isLoggable
Returnstrue
if the given message level is being logged.- Parameters:
level
- a message logging level.- Returns:
true
if the given message level is being logged.- Throws:
NullPointerException
- iflevel
isnull
.
-
fine
Logs a fine message with supplied format and arguments.- Parameters:
message
- the text of the message or format.args
- an array of optional format arguments.
-
info
Logs an information message with supplied format and arguments.- Parameters:
message
- the text of the message or format.args
- an array of optional format arguments.
-
warning
Logs a warning message with supplied format and arguments.- Parameters:
message
- the text of the message or format.args
- an array of optional format arguments.
-
severe
Logs a severe message with supplied format and arguments.- Parameters:
message
- the text of the message or format.args
- an array of optional format arguments.
-
severe
Logs a severe message with supplied throwable, format and arguments.- Parameters:
thrown
- the associatted throwable instance.message
- the text of the message or format.args
- an array of optional format arguments.
-