Class ReplyEvent
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 EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionReplyEvent(RequestEvent request, Message message) Constructs a newReplyEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidLogs a fine message with supplied format and arguments.Returns the reply message ornullif the reply timeout.<T extends Serializable>
TReturns the object contained in thesuccess messageof this ReplyEvent.Returns the request event of this ReplyEvent.Returns the server channel of this ReplyEvent.Returns the reply message with aSUCCESSstatus.voidLogs an information message with supplied format and arguments.booleanisLoggable(Level level) Returnstrueif the given message level is being logged.voidLogs a severe message with supplied format and arguments.voidLogs a severe message with supplied throwable, format and arguments.voidLogs a warning message with supplied format and arguments.Methods inherited from class EventObject
getSource, toString
-
Constructor Details
-
ReplyEvent
Constructs a newReplyEventinstance.- Parameters:
request- the request sending the async subrequest.message- the reply message of this event (null if timeout).- Throws:
NullPointerException- ifrequestisnull.
-
-
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 ornullif the reply timeout.- Returns:
- the reply message or
nullif the reply timeout.
-
getSuccessMessage
Returns the reply message with aSUCCESSstatus. It throws aServiceExceptionif thestatusof the message is anERROR. TheServiceExceptionincludes thestatus,textanduserMessageof the reply message. It throws aReplyTimeoutExceptionif 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 messageof 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
nullif not defined. - Throws:
NullPointerException- iftypeisnull.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
Returnstrueif the given message level is being logged.- Parameters:
level- a message logging level.- Returns:
trueif the given message level is being logged.- Throws:
NullPointerException- iflevelisnull.
-
fine
-
info
-
warning
-
severe
-
severe
-