Package fr.dyade.aaa.agent
Class Notification
- java.lang.Object
-
- fr.dyade.aaa.agent.Notification
-
- All Implemented Interfaces:
Encodable,Serializable,Cloneable
- Direct Known Subclasses:
AcquisitionNot,AdminNotification,AgentCreateReply,AgentCreateRequest,AgentDeleteRequest,AMQPRequestNot,AMQPResponseNot,CallbackNotification,ClientSubscriptionNot,CloseConnectionNot,CloseConnectionNot2,ClusterJoinAck,ClusterJoinNot,ClusterLBNot,ClusterRemoveNot,DeleteAck,DeleteNot,ExceptionNotification,ExpiredNot,FlowControlNot,FwdAdminRequestNot,GetClientSubscriptions,InitJndiServerNot,JndiReplyNot,JndiScriptReplyNot,JndiScriptRequestNot,JndiUpdateNot,PingNot,PongNot,ProxyRequestGroupNot,QueueDeliveryTimeNot,ReconnectSubscribersNot,ResetCollocatedConnectionsNot,RestartNot,ReturnConnectionNot,SchedulerQueueNot,SendRepliesNot,SendReplyNot,SyncNotification,SyncReply,SyncReplyNot,SyncRequestNot,TcpRequestNot,TopicDeliveryTimeNot,UnknownAgent,UnknownNotification,WakeUpNot
public class Notification extends Object implements Serializable, Cloneable, Encodable
Class Notification is the root of the notifications hierarchy. Every notification's class has Notification as a superclass.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private ObjectcontextContext of the notificationprivate static byteContextSet(package private) AgentIddeadNotificationAgentIdThe agentId identifying the agent to which the notification is sent when it is expired.
Default value is null, which means the expired notification is lost.private static byteDeadNotificationAgentIdSetprotected booleandetachableTrue if the notification is detachable, false otherwise.protected booleandetachedTrue if the notification is detached, false otherwise.(package private) longexpirationThe expiration date for this notification.private static byteExpirationSet(package private) StringmessageIdIf the notification is stored independently that its containing message messageId contains the persistent name of this notification.protected booleanpersistentTrue if the notification is persistent, false otherwise.(package private) intpriorityThe priority for this notification from 0 to 9, 9 being the highest.(package private) static longserialVersionUIDdefine serialVersionUID for interoperability-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description Notification()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns a clone of this notification.voiddecode(Decoder decoder)Decodes the object.voidencode(Encoder encoder)Encodes the object.ObjectgetContext()Returns the context of the notification.AgentIdgetDeadNotificationAgentId()intgetEncodableClassId()The class id is still not defined.intgetEncodedSize()Returns the size of the encoded object.longgetExpiration()Gets the notification's expiration value.StringgetMessageId()intgetPriority()Gets the notification's priority value.booleanisPersistent()Return true if notification is persistent.private voidreadObject(ObjectInputStream in)The readObject method is responsible for reading from the stream and restoring the classes fields.voidsetContext(Object context)Sets the context of the notification.voidsetDeadNotificationAgentId(AgentId deadNotificationAgentId)Sets the forwardExpiredNotAgentId value which enable sending expired notifications to a specific agentvoidsetExpiration(long expiration)Sets the expiration date for this notification.voidsetPriority(int priority)Sets the priority for this notification.StringtoString()Provides a string image for this object.StringBuildertoString(StringBuilder output)Appends a string image for this object to the StringBuffer parameter.private voidwriteObject(ObjectOutputStream out)The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
persistent
protected transient boolean persistent
True if the notification is persistent, false otherwise. By default, this field is set to true during object creation and disk loading. This field is carry by network protocol. There is no public setter for this attribute. According the fact that a notification class is or not persistent this attribute should be statically fixed in the subclass constructor.
-
detachable
protected transient boolean detachable
True if the notification is detachable, false otherwise. A detachable notification is saved in a different object that its containing message.
-
detached
protected transient boolean detached
True if the notification is detached, false otherwise. A detached notification is not destroyed in the same way that its containing message.
-
expiration
long expiration
The expiration date for this notification. This field is handled by the network protocol in order to fit the time synchronization problem.
-
priority
int priority
The priority for this notification from 0 to 9, 9 being the highest. By default, the priority is 4
-
deadNotificationAgentId
AgentId deadNotificationAgentId
The agentId identifying the agent to which the notification is sent when it is expired.
Default value is null, which means the expired notification is lost.
-
messageId
transient String messageId
If the notification is stored independently that its containing message messageId contains the persistent name of this notification.
-
context
private Object context
Context of the notification. /!\ Be careful, the related object must be serialized either through Serializable or Encodable interfaces, depending of the notification serialization mode. It seems difficult to use, may be we should use a byte array handled by the application. TODO (AF): It seems never used in Joram/JoramMQ.
-
ExpirationSet
private static final byte ExpirationSet
- See Also:
- Constant Field Values
-
ContextSet
private static final byte ContextSet
- See Also:
- Constant Field Values
-
DeadNotificationAgentIdSet
private static final byte DeadNotificationAgentIdSet
- See Also:
- Constant Field Values
-
-
Method Detail
-
setExpiration
public void setExpiration(long expiration)
Sets the expiration date for this notification. A value of 0L (default) indicates that the notification does not expire.- Parameters:
expiration- the expiration date for this notification.
-
getExpiration
public long getExpiration()
Gets the notification's expiration value. This field is handled by the network protocol in order to fit the time synchronization problem. If the expiration date is set to 0L (default), it indicates that the notification does not expire. When a notification's expiration time is reached, the MOM should discard it without any form of notification of message expiration. Agents should not receive messages that have expired; however, the MOM does not guarantee that this will not happen.- Returns:
- The notification's expiration value.
-
setPriority
public void setPriority(int priority)
Sets the priority for this notification. A value between 0 (lowest) and 9 (highest), by default 4 (normal).- Parameters:
priority- the priority for this notification.
-
getPriority
public int getPriority()
Gets the notification's priority value.- Returns:
- The notification's priority value.
-
getMessageId
public String getMessageId()
-
setContext
public final void setContext(Object context)
Sets the context of the notification.- Parameters:
context- the context of the notification.
-
getContext
public final Object getContext()
Returns the context of the notification.- Returns:
- the context of the notification.
-
clone
public Object clone()
Returns a clone of this notification.
-
isPersistent
public boolean isPersistent()
Return true if notification is persistent.- Returns:
- persistent of this notification.
-
getDeadNotificationAgentId
public AgentId getDeadNotificationAgentId()
- Returns:
- The agentId identifying the agent to which the notification is sent when it is expired.
-
setDeadNotificationAgentId
public void setDeadNotificationAgentId(AgentId deadNotificationAgentId)
Sets the forwardExpiredNotAgentId value which enable sending expired notifications to a specific agent- Parameters:
deadNotificationAgentId- the AgentId to which the dead notification is forwarded
-
writeObject
private void writeObject(ObjectOutputStream out) throws IOException
The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it.- Parameters:
out- The stream to write out.- Throws:
IOException- if an errors occurs.
-
readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
The readObject method is responsible for reading from the stream and restoring the classes fields.- Parameters:
in- the stream to read from.- Throws:
IOException- if an errors occurs during read.ClassNotFoundException- a needed class cannot be found.
-
toString
public StringBuilder toString(StringBuilder output)
Appends a string image for this object to the StringBuffer parameter.- Parameters:
output- buffer to fill in.- Returns:
- the resulting buffer.
-
toString
public final String toString()
Provides a string image for this object.
-
getEncodableClassId
public int getEncodableClassId()
The class id is still not defined.- Specified by:
getEncodableClassIdin interfaceEncodable- Returns:
- a unique class identifier
-
getEncodedSize
public int getEncodedSize() throws ExceptionReturns the size of the encoded object.- Specified by:
getEncodedSizein interfaceEncodable- Returns:
- the size of the encoded object
- Throws:
Exception- if an error occurs
-
-