|
Joram 5.2.6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.objectweb.joram.mom.dest.DestinationImpl
org.objectweb.joram.mom.dest.QueueImpl
public class QueueImpl
The QueueImpl class implements the MOM queue behaviour,
basically storing messages and delivering them upon clients requests.
| Field Summary | |
|---|---|
protected long |
arrivalsCounter
Counter of messages arrivals. |
protected java.util.Hashtable |
consumers
Table keeping the messages' consumers identifiers. |
protected java.util.Hashtable |
contexts
Table keeping the messages' consumers contexts. |
protected java.util.Hashtable |
deliveredMsgs
Table holding the delivered messages before acknowledgement. |
static org.objectweb.util.monolog.api.Logger |
logger
|
protected java.util.Vector |
messages
Vector holding the messages before delivery. |
protected int |
nbMaxMsg
nb Max of Message store in queue (-1 no limit). |
protected long |
period
period to run task at regular interval: cleaning, load-balancing, etc. |
protected boolean |
receiving
true if the queue is currently receiving messages. |
protected java.util.Vector |
requests
Vector holding the requests before reply or expiry. |
| Fields inherited from class org.objectweb.joram.mom.dest.DestinationImpl |
|---|
_rights, agent, clients, creationDate, dmqId, freeReading, freeWriting, nbMsgsDeliverSinceCreation, nbMsgsReceiveSinceCreation, nbMsgsSentToDMQSinceCreation, READ, READWRITE, WRITE |
| Constructor Summary | |
|---|---|
QueueImpl(fr.dyade.aaa.agent.AgentId adminId,
java.util.Properties prop)
Constructs a QueueImpl instance. |
|
| Method Summary | |
|---|---|
void |
abortReceiveRequest(fr.dyade.aaa.agent.AgentId from,
AbortReceiveRequest not)
|
void |
acknowledgeRequest(fr.dyade.aaa.agent.AgentId from,
AcknowledgeRequest not)
Method implementing the reaction to an AcknowledgeRequest
instance, requesting messages to be acknowledged. |
protected boolean |
addMessage(Message message)
Adds a message in the list of messages to deliver. |
void |
browseRequest(fr.dyade.aaa.agent.AgentId from,
BrowseRequest not)
Method implementing the queue reaction to a BrowseRequest
instance, requesting an enumeration of the messages on the queue. |
protected boolean |
checkDelivery(Message msg)
Returns true if conditions are ok to deliver the message. |
void |
cleanPendingMessage()
Removes all messages that the time-to-live is expired. |
protected DMQManager |
cleanPendingMessage(long currentTime)
Cleans the pending messages list. |
void |
cleanWaitingRequest()
Removes all request that the expiration time is expired. |
protected void |
cleanWaitingRequest(long currentTime)
Cleans the waiting request list. |
protected void |
deliverMessages(int index)
Actually tries to answer the pending "receive" requests. |
void |
denyRequest(fr.dyade.aaa.agent.AgentId from,
DenyRequest not)
Method implementing the reaction to a DenyRequest
instance, requesting messages to be denied. |
void |
destinationAdminRequestNot(fr.dyade.aaa.agent.AgentId from,
DestinationAdminRequestNot not)
|
protected void |
doClientMessages(fr.dyade.aaa.agent.AgentId from,
ClientMessages not)
Method specifically processing a ClientMessages instance. |
protected void |
doDeleteNot(fr.dyade.aaa.agent.DeleteNot not)
Method specifically processing a fr.dyade.aaa.agent.DeleteNot instance. |
protected void |
doRightRequest(SetRightRequest not)
Method specifically processing a SetRightRequest instance. |
protected void |
doUnknownAgent(fr.dyade.aaa.agent.UnknownAgent uA)
Method specifically processing an UnknownAgent instance. |
protected ClientMessages |
getClientMessages(int nb,
java.lang.String selector,
boolean remove)
Get a client message contain nb messages. |
static fr.dyade.aaa.agent.AgentId |
getDefaultDMQId()
Static method returning the default DMQ identifier. |
static java.lang.Integer |
getDefaultThreshold()
Static method returning the default threshold. |
int |
getDeliveredMessageCount()
Returns the number of messages delivered and waiting for acknowledge. |
javax.management.openmbean.CompositeData |
getMessage(java.lang.String msgId)
Returns the description of a particular pending message. |
javax.management.openmbean.TabularData |
getMessages()
Returns the description of all pending messages. |
protected java.lang.StringBuffer |
getMsgTxPrefix()
|
int |
getNbMaxMsg()
Returns the maximum number of message for the destination. |
long |
getNbMsgsReceiveSinceCreation()
Returns the number of messages received since creation time of this destination. |
int |
getPendingMessageCount()
Returns the number of pending messages in the queue. |
long |
getPeriod()
Returns the period value of this queue, -1 if not set. |
protected Message |
getQueueMessage(java.lang.String msgId,
boolean remove)
get mom message, delete if remove = true. |
protected java.util.Hashtable |
getStatisticHashtable()
Overrides the destination method to add pending message counter |
int |
getThreshold()
Returns the threshold value of this queue, -1 if not set. |
int |
getWaitingRequestCount()
Returns the number of waiting requests in the queue. |
protected void |
handleExpiredNot(fr.dyade.aaa.agent.AgentId from,
fr.dyade.aaa.agent.ExpiredNot not)
|
void |
initialize(boolean firstTime)
Initializes the destination. |
protected boolean |
isUndeliverable(Message message)
Returns true if a given message is considered as
undeliverable, because its delivery count matches the queue's
threshold, if any, or the server's default threshold value (if any). |
protected void |
messageDelivered(java.lang.String msgId)
call in deliverMessages just after forward(msg), overload this method to process a specific treatment. |
protected void |
messageRemoved(java.lang.String msgId)
call in deliverMessages just after a remove message (invalid), overload this method to process a specific treatment. |
void |
monitGetDMQSettings(fr.dyade.aaa.agent.AgentId from,
Monit_GetDMQSettings not)
Overrides this DestinationImpl method for sending back
the threshold along with the DMQ id. |
void |
monitGetNbMaxMsg(fr.dyade.aaa.agent.AgentId from,
Monit_GetNbMaxMsg not)
Method implementing the reaction to a Monit_GetNbMaxMsg notification requesting the
number max of messages in this queue. |
void |
monitGetPendingMessages(fr.dyade.aaa.agent.AgentId from,
Monit_GetPendingMessages not)
Method implementing the reaction to a Monit_GetPendingMessages notification requesting the
number of pending messages. |
void |
monitGetPendingRequests(fr.dyade.aaa.agent.AgentId from,
Monit_GetPendingRequests not)
Method implementing the reaction to a Monit_GetPendingRequests notification requesting the
number of pending requests. |
void |
readBag(java.io.ObjectInputStream in)
|
void |
receiveRequest(fr.dyade.aaa.agent.AgentId from,
ReceiveRequest not)
Method implementing the reaction to a ReceiveRequest
instance, requesting a message. |
protected void |
setMsgTxName(Message msg)
|
void |
setNbMaxMsg(int nbMaxMsg)
Sets the maximum number of message for the destination. |
void |
setNbMaxMsgRequest(fr.dyade.aaa.agent.AgentId from,
SetNbMaxMsgRequest req)
Method implementing the reaction to a SetNbMaxMsgRequest
instance setting the NbMaxMsg value for this queue. |
void |
setPeriod(long period)
Sets or unsets the period for this queue. |
void |
setThreshold(int threshold)
Sets or unsets the threshold for this queue. |
void |
setThreshRequest(fr.dyade.aaa.agent.AgentId from,
SetThreshRequest req)
Method implementing the reaction to a SetThreshRequest
instance setting the threshold value for this queue. |
protected void |
storeMessage(Message message)
Actually stores a message in the deliverables vector. |
protected void |
storeMessageHeader(Message message)
Actually stores a message header in the deliverables vector. |
java.lang.String |
toString()
Returns a string representation of this destination. |
void |
wakeUpNot(WakeUpNot not)
wake up, and cleans the queue. |
void |
writeBag(java.io.ObjectOutputStream out)
|
| Methods inherited from class org.objectweb.joram.mom.dest.DestinationImpl |
|---|
canBeDeleted, clientMessages, deleteNot, forward, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getId, getNbMsgsDeliverSinceCreation, getNbMsgsSentToDMQSinceCreation, getRight, getRights, handleDeniedMessage, isAdministrator, isFreeReading, isFreeWriting, isLocal, isReader, isWriter, monitFreeAccess, monitGetReaders, monitGetStat, monitGetWriters, postProcess, postProcess, preProcess, preProcess, processSetRight, replyToTopic, requestGroupNot, setAgent, setDMQRequest, setFreeReading, setFreeWriting, setRightRequest, specialAdminProcess, specialAdminRequest, unknownAgent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.objectweb.joram.mom.dest.DestinationImplMBean |
|---|
getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getNbMsgsDeliverSinceCreation, getNbMsgsSentToDMQSinceCreation, getRight, getRights, isFreeReading, isFreeWriting, setFreeReading, setFreeWriting |
| Field Detail |
|---|
public static org.objectweb.util.monolog.api.Logger logger
protected long period
protected java.util.Hashtable consumers
protected java.util.Hashtable contexts
protected long arrivalsCounter
protected java.util.Vector requests
protected transient boolean receiving
true if the queue is currently receiving messages.
protected transient java.util.Vector messages
protected transient java.util.Hashtable deliveredMsgs
protected int nbMaxMsg
| Constructor Detail |
|---|
public QueueImpl(fr.dyade.aaa.agent.AgentId adminId,
java.util.Properties prop)
QueueImpl instance.
adminId - Identifier of the administrator of the queue.prop - The initial set of properties.| Method Detail |
|---|
public long getPeriod()
getPeriod in interface QueueImplMBeanpublic void setPeriod(long period)
setPeriod in interface QueueImplMBeanperiod - The period value to be set or -1 for unsetting previous
value.public int getThreshold()
getThreshold in interface QueueImplMBeanpublic static java.lang.Integer getDefaultThreshold()
public static fr.dyade.aaa.agent.AgentId getDefaultDMQId()
public void setThreshold(int threshold)
setThreshold in interface QueueImplMBeanthreshold - The threshold value to be set (-1 for unsetting previous value).public void cleanWaitingRequest()
cleanWaitingRequest in interface QueueImplMBeanprotected void cleanWaitingRequest(long currentTime)
currentTime - The current time.public int getWaitingRequestCount()
getWaitingRequestCount in interface QueueImplMBeanpublic void cleanPendingMessage()
cleanPendingMessage in interface QueueImplMBeanprotected DMQManager cleanPendingMessage(long currentTime)
currentTime - The current time.
DMQManager which contains the expired messages.
null if there wasn't any.public int getPendingMessageCount()
getPendingMessageCount in interface QueueImplMBeanpublic int getDeliveredMessageCount()
getDeliveredMessageCount in interface QueueImplMBeanpublic int getNbMaxMsg()
getNbMaxMsg in interface QueueImplMBeanpublic void setNbMaxMsg(int nbMaxMsg)
setNbMaxMsg in interface QueueImplMBeannbMaxMsg - the maximum number of message (-1 set no limit).public void initialize(boolean firstTime)
initialize in class DestinationImplfirstTime - true when first called by the factorypublic java.lang.String toString()
toString in interface DestinationImplMBeantoString in class java.lang.Objectpublic void wakeUpNot(WakeUpNot not)
public void setThreshRequest(fr.dyade.aaa.agent.AgentId from,
SetThreshRequest req)
throws AccessException
SetThreshRequest
instance setting the threshold value for this queue.
AccessException - If the requester is not the administrator.
public void setNbMaxMsgRequest(fr.dyade.aaa.agent.AgentId from,
SetNbMaxMsgRequest req)
throws AccessException
SetNbMaxMsgRequest
instance setting the NbMaxMsg value for this queue.
AccessException - If the requester is not the administrator.
public void monitGetDMQSettings(fr.dyade.aaa.agent.AgentId from,
Monit_GetDMQSettings not)
throws AccessException
DestinationImpl method for sending back
the threshold along with the DMQ id.
monitGetDMQSettings in class DestinationImplAccessException - If the requester is not the administrator.
public void monitGetPendingMessages(fr.dyade.aaa.agent.AgentId from,
Monit_GetPendingMessages not)
throws AccessException
Monit_GetPendingMessages notification requesting the
number of pending messages.
AccessException - If the requester is not the administrator.
public void monitGetPendingRequests(fr.dyade.aaa.agent.AgentId from,
Monit_GetPendingRequests not)
throws AccessException
Monit_GetPendingRequests notification requesting the
number of pending requests.
AccessException - If the requester is not the administrator.
public void monitGetNbMaxMsg(fr.dyade.aaa.agent.AgentId from,
Monit_GetNbMaxMsg not)
throws AccessException
Monit_GetNbMaxMsg notification requesting the
number max of messages in this queue.
AccessException - If the requester is not the administrator.protected java.util.Hashtable getStatisticHashtable()
getStatisticHashtable in class DestinationImpl
public void receiveRequest(fr.dyade.aaa.agent.AgentId from,
ReceiveRequest not)
throws AccessException
ReceiveRequest
instance, requesting a message.
This method stores the request and launches a delivery sequence.
AccessException - If the sender is not a reader.
public void browseRequest(fr.dyade.aaa.agent.AgentId from,
BrowseRequest not)
throws AccessException
BrowseRequest
instance, requesting an enumeration of the messages on the queue.
The method sends a BrowseReply back to the client. Expired
messages are sent to the DMQ.
AccessException - If the requester is not a reader.
public void acknowledgeRequest(fr.dyade.aaa.agent.AgentId from,
AcknowledgeRequest not)
AcknowledgeRequest
instance, requesting messages to be acknowledged.
public void denyRequest(fr.dyade.aaa.agent.AgentId from,
DenyRequest not)
DenyRequest
instance, requesting messages to be denied.
This method denies the messages and launches a delivery sequence. Messages considered as undeliverable are sent to the DMQ.
public void abortReceiveRequest(fr.dyade.aaa.agent.AgentId from,
AbortReceiveRequest not)
public void destinationAdminRequestNot(fr.dyade.aaa.agent.AgentId from,
DestinationAdminRequestNot not)
destinationAdminRequestNot in class DestinationImplprotected void doRightRequest(SetRightRequest not)
SetRightRequest instance.
When a reader is removed, and receive requests of this reader are still
on the queue, they are replied to by an ExceptionReply.
doRightRequest in class DestinationImpl
protected void doClientMessages(fr.dyade.aaa.agent.AgentId from,
ClientMessages not)
ClientMessages instance.
This method stores the messages and launches a delivery sequence.
doClientMessages in class DestinationImplprotected void doUnknownAgent(fr.dyade.aaa.agent.UnknownAgent uA)
UnknownAgent instance.
The specific processing is done when a QueueMsgReply was
sent to a requester which does not exist anymore. In that case, the
messages sent to this requester and not yet acknowledged are marked as
"denied" for delivery to an other requester, and a new delivery sequence
is launched. Messages considered as undeliverable are removed and sent to
the DMQ.
doUnknownAgent in class DestinationImplprotected void doDeleteNot(fr.dyade.aaa.agent.DeleteNot not)
fr.dyade.aaa.agent.DeleteNot instance.
ExceptionReply replies are sent to the pending receivers,
and the remaining messages are sent to the DMQ and deleted.
doDeleteNot in class DestinationImplprotected final java.lang.StringBuffer getMsgTxPrefix()
protected final void setMsgTxName(Message msg)
protected final void storeMessage(Message message)
message - The message to store.protected final void storeMessageHeader(Message message)
message - The message to store.protected final boolean addMessage(Message message)
message - the message to add.
protected ClientMessages getClientMessages(int nb,
java.lang.String selector,
boolean remove)
nb messages.
nb - number of messages returned in ClientMessage.selector - jms selectorremove - delete all messages returned if true
protected Message getQueueMessage(java.lang.String msgId,
boolean remove)
msgId - message identificationremove - if true delete message
public javax.management.openmbean.CompositeData getMessage(java.lang.String msgId)
throws java.lang.Exception
getMessage in interface QueueImplMBeanmsgId - The unique message's identifier.
java.lang.ExceptionMessageJMXWrapper
public javax.management.openmbean.TabularData getMessages()
throws java.lang.Exception
getMessages in interface QueueImplMBeanjava.lang.ExceptionMessageJMXWrapperprotected void deliverMessages(int index)
The method may send QueueMsgReply replies to clients.
index - Index where starting to "browse" the requests.protected boolean checkDelivery(Message msg)
protected void messageDelivered(java.lang.String msgId)
protected void messageRemoved(java.lang.String msgId)
protected boolean isUndeliverable(Message message)
true if a given message is considered as
undeliverable, because its delivery count matches the queue's
threshold, if any, or the server's default threshold value (if any).
public void readBag(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void writeBag(java.io.ObjectOutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic long getNbMsgsReceiveSinceCreation()
DestinationImpl
getNbMsgsReceiveSinceCreation in interface DestinationImplMBeangetNbMsgsReceiveSinceCreation in class DestinationImpl
protected void handleExpiredNot(fr.dyade.aaa.agent.AgentId from,
fr.dyade.aaa.agent.ExpiredNot not)
|
Joram 5.2.6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||