Package org.objectweb.joram.mom.dest
Class AcquisitionQueue
- java.lang.Object
-
- fr.dyade.aaa.agent.Agent
-
- org.objectweb.joram.mom.dest.Destination
-
- org.objectweb.joram.mom.dest.Queue
-
- org.objectweb.joram.mom.dest.AcquisitionQueue
-
- All Implemented Interfaces:
AgentMBean,Encodable,Serializable,AcquisitionMBean,AcquisitionQueueMBean,DestinationMBean,QueueMBean
public class AcquisitionQueue extends Queue implements AcquisitionQueueMBean
TheAcquisitionQueueclass implements the MOM acquisition queue behavior, basically acquiring messages periodically or on client request, using anAcquisitionModule.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.objectweb.joram.mom.dest.Queue
Queue.QueueFactory
-
-
Field Summary
Fields Modifier and Type Field Description private StringacquisitionClassNameThe acquisition class name.private AcquisitionModuleacquisitionModuleThe acquisition module.private longacquisitionNotNbprivate static booleanDEBUGprivate longdiff_maxThe threshold of messages send by the handler in the engineprivate longdiff_minprivate StringlastMessageIdStores the id of the last message received to avoid duplicates.private static Loggerloggerprivate longmsgCountThe number of produced messages.private booleanpauseprivate longpending_maxThe threshold of pending messages in the queueprivate longpending_minprivate PropertiespropertiesStores the last set of properties defined.private static longserialVersionUIDdefine serialVersionUID for interoperability-
Fields inherited from class org.objectweb.joram.mom.dest.Queue
ARRIVAL_STATE_PREFIX, arrivalState, cload, defaultDMQId, defaultRedeliveryDelay, defaultThreshold, delayed, DELIVERY_TABLE_PREFIX, DELIVERY_TIMEOUT, deliveryTable, hcons, hprod, LENIENT_REDELIVERY_DELAY, LENIENT_UNDELIVERABLE, logmsg, messages, msgTxPrefix, msgTxPrefixLength, nbExpirations, nbMaxMsg, nbMsgsDeniedSinceCreation, pload, receiving, requests
-
Fields inherited from class org.objectweb.joram.mom.dest.Destination
clients, dmqId, freeReading, freeWriting, nbMsgsDeliverSinceCreation, nbMsgsSentToDMQSinceCreation, READ, READWRITE, strbuf, strictCounters, task, temporary, WRITE
-
Fields inherited from class fr.dyade.aaa.agent.Agent
agentProfiling, emptyString, fixed, logmon
-
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 AcquisitionQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidacquisitionNot(AcquisitionNot not)This method process messages from the acquisition module.voidagentFinalize(boolean lastTime)Finalizes the agent before it is garbaged.private voidclose()StringdumpProperties()longgetAcquiredMsgCount()Returns the number of messages acquired by the acquisition handler.StringgetAcquisitionClassName()Returns the acquisition handler class name.longgetAcquisitionPeriod()Returns the acquisition period.longgetDiffMax()Returns the maximum number of acquired messages waiting to be handled by the destination.longgetDiffMin()Returns the minimum threshold of acquired messages waiting to be handled by the destination for restarting the acquisition handler.intgetEncodableClassId()Enables the sub classes not to implement this method.longgetExpiration()Returns the expiration value for produced messages.longgetHandledMsgCount()Returns the number of acquired messages processed by the destination.longgetPendingMax()Returns the maximum number of waiting messages in the destination.longgetPendingMin()Returns the minimum threshold of waiting messages in the destination for restarting the acquisition handler.intgetPriority()Returns the priority of produced messages.voidinitialize(boolean firstTime)Initializes the destination.booleanisHandlerRunning()Returns the acquisition handler status.booleanisMessagePersistent()Returns true if the messages produced are persistent.ClientMessagespreProcess(AgentId from, ClientMessages cm)Incoming JMS messages are processed by the acquisition module and a null ClientMessages is always returned to the base implementation.voidreact(AgentId from, Notification not)Distributes the received notifications to the appropriate reactions.voidsetExpiration(long expiration)Sets the expiration value for produced messages.voidsetMessagePersistent(boolean isPersistent)Sets the DeliveryMode value for the produced messages.voidsetPriority(int priority)Sets the priority of produced messages.voidsetProperties(Properties properties, boolean firstTime)Configures anAcquisitionQueueinstance.voidstart()Start the handler.protected PropertiesstartHandler(Properties prop)Start the handler.voidstop()Stop the handler.protected PropertiesstopHandler(Properties prop)Stop the handler.StringtoString()Returns a string representation of this destination.-
Methods inherited from class org.objectweb.joram.mom.dest.Queue
abortReceiveRequest, acknowledgeRequest, addClientMessages, addDeliveryTimeMessage, addMessage, agentSave, browseRequest, checkDelivery, cleanPendingMessage, cleanPendingMessage, cleanWaitingRequest, cleanWaitingRequest, clear, decode, deliverMessages, denyRequest, doAdminSyncNotification, doClientMessages, doDeleteNot, doRightRequest, doUnknownAgent, encode, exportMessages, finalize, getClientMessages, getConsumerLoad, getDefaultDMQId, getDefaultRedeliveryDelay, getDefaultThreshold, getDelayedMessage, getDelayedMessageCount, getDelayedMessages, getDeliveredMessageCount, getDeliveryDelay, getEncodedSize, getMessage, getMessages, getMessagesView, getMsgTxPrefix, getNbMaxMsg, getNbMsgsDeliverSinceCreation, getNbMsgsDeniedSinceCreation, getNbMsgsReceiveSinceCreation, getPendingMessageCount, getProducerLoad, getQueueMessage, getRedeliveryDelay, getStats, getThreshold, getType, getWaitingRequestCount, handleAdminRequestNot, handleExpiredNot, isPause, isSyncExceptionOnFullDest, isUndeliverable, isValidJMXAttribute, messageDelivered, messageRemoved, processDeliveryTime, receiveRequest, setDefaultRedeliveryDelay, setDeliveryDelay, setMsgTxName, setNbMaxMsg, setPause, setRedeliveryDelay, setSyncExceptionOnFullDest, setThreshold, storeMessage, wakeUpNot
-
Methods inherited from class org.objectweb.joram.mom.dest.Destination
agentInitialize, clientMessages, delete, deleteNot, forward, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQAgentId, getDMQId, getJMXStatistics, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getRights, handleDeniedMessage, interceptorsAvailable, isAdministrator, isFreeReading, isFreeWriting, isLocal, isReader, isWriter, postProcess, processAdminCommand, processInterceptors, processPause, processSetRight, processStartHandler, processStopHandler, replyToTopic, requestGroupNot, setAdminId, setFreeReading, setFreeWriting, setPeriod, setRight, unknownAgent
-
Methods inherited from class fr.dyade.aaa.agent.Agent
delete, delete, deploy, deploy, getAgentId, getCommitTime, getId, getLogTopic, getName, getReactNb, getReactTime, hasName, incWorkInProgress, isAgentProfiling, isDeployed, isFixed, isUpdated, load, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName, setNoSave, setSave
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.dyade.aaa.agent.AgentMBean
getAgentId, getCommitTime, getReactNb, getReactTime, isAgentProfiling, isFixed, resetCommitTime, resetReactTime, resetTimer, setAgentProfiling
-
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationMBean
delete, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getName, getNbMsgsDeliverSinceCreation, getNbMsgsReceiveSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getType, isFreeReading, isFreeWriting, setFreeReading, setFreeWriting, setPeriod
-
Methods inherited from interface org.objectweb.joram.mom.dest.QueueMBean
cleanPendingMessage, cleanWaitingRequest, clear, exportMessages, getConsumerLoad, getDelayedMessage, getDelayedMessageCount, getDelayedMessages, getDeliveredMessageCount, getDeliveryDelay, getMessage, getMessages, getNbMaxMsg, getNbMsgsDeniedSinceCreation, getPendingMessageCount, getProducerLoad, getRedeliveryDelay, getThreshold, getWaitingRequestCount, isPause, setDeliveryDelay, setNbMaxMsg, setPause, setRedeliveryDelay, setThreshold
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
acquisitionModule
private transient AcquisitionModule acquisitionModule
The acquisition module.
-
properties
private Properties properties
Stores the last set of properties defined.
-
lastMessageId
private String lastMessageId
Stores the id of the last message received to avoid duplicates.
-
msgCount
private long msgCount
The number of produced messages.
-
diff_max
private long diff_max
The threshold of messages send by the handler in the engine
-
diff_min
private long diff_min
-
pending_max
private long pending_max
The threshold of pending messages in the queue
-
pending_min
private long pending_min
-
pause
private boolean pause
-
acquisitionClassName
private String acquisitionClassName
The acquisition class name.
-
acquisitionNotNb
private transient long acquisitionNotNb
-
-
Method Detail
-
dumpProperties
public String dumpProperties()
- Specified by:
dumpPropertiesin interfaceAcquisitionQueueMBean
-
getHandledMsgCount
public final long getHandledMsgCount()
Returns the number of acquired messages processed by the destination.- Specified by:
getHandledMsgCountin interfaceAcquisitionQueueMBean- Returns:
- the number of acquired messages processed by the destination.
-
getDiffMax
public final long getDiffMax()
Returns the maximum number of acquired messages waiting to be handled by the destination. When the number of messages waiting to be handled is greater the acquisition handler is temporarily stopped.A value lesser or equal to 0 disables the mechanism.
- Specified by:
getDiffMaxin interfaceAcquisitionQueueMBean- Returns:
- the maximum number of acquired messages waiting to be handled by the destination.
-
getDiffMin
public final long getDiffMin()
Returns the minimum threshold of acquired messages waiting to be handled by the destination for restarting the acquisition handler.- Specified by:
getDiffMinin interfaceAcquisitionQueueMBean- Returns:
- the minimum threshold of acquired messages waiting to be handled by the destination.
-
getPendingMax
public final long getPendingMax()
Returns the maximum number of waiting messages in the destination. When the number of waiting messages is greater the acquisition handler is temporarily stopped.A value lesser or equal to 0 disables the mechanism.
- Specified by:
getPendingMaxin interfaceAcquisitionQueueMBean- Returns:
- the maximum number of waiting messages in the destination.
-
getPendingMin
public final long getPendingMin()
Returns the minimum threshold of waiting messages in the destination for restarting the acquisition handler.- Specified by:
getPendingMinin interfaceAcquisitionQueueMBean- Returns:
- the minimum threshold of waiting messages in the destination.
-
getAcquisitionClassName
public String getAcquisitionClassName()
Description copied from interface:AcquisitionMBeanReturns the acquisition handler class name.- Specified by:
getAcquisitionClassNamein interfaceAcquisitionMBean- Returns:
- the acquisition handler class name.
-
setProperties
public void setProperties(Properties properties, boolean firstTime) throws Exception
Configures anAcquisitionQueueinstance.- Overrides:
setPropertiesin classQueue- Parameters:
properties- The initial set of properties.- Throws:
Exception
-
initialize
public void initialize(boolean firstTime) throws ExceptionDescription copied from class:QueueInitializes the destination.- Overrides:
initializein classQueue- Parameters:
firstTime- true when first called by the factory- Throws:
Exception
-
getAcquiredMsgCount
public final long getAcquiredMsgCount()
Returns the number of messages acquired by the acquisition handler. Be careful this counter is reseted at each time the server starts.- Specified by:
getAcquiredMsgCountin interfaceAcquisitionQueueMBean- Returns:
- the number of messages acquired by the acquisition handler.
-
react
public void react(AgentId from, Notification not) throws Exception
Description copied from class:QueueDistributes the received notifications to the appropriate reactions.
-
agentFinalize
public void agentFinalize(boolean lastTime)
Description copied from class:DestinationFinalizes the agent before it is garbaged.- Overrides:
agentFinalizein classDestination- Parameters:
lastTime- true if the destination is deleted
-
preProcess
public ClientMessages preProcess(AgentId from, ClientMessages cm)
Incoming JMS messages are processed by the acquisition module and a null ClientMessages is always returned to the base implementation.- Overrides:
preProcessin classDestination- Parameters:
from- The sender of the messagecm- The incoming messages.- Returns:
- The incoming messages after processing.
- See Also:
AcquisitionModule.processMessages(ClientMessages),Destination.preProcess(AgentId, ClientMessages)
-
isHandlerRunning
public boolean isHandlerRunning()
Returns the acquisition handler status. To be use by MBean interface.- Specified by:
isHandlerRunningin interfaceAcquisitionQueueMBean- Returns:
- the acquisition handler status.
-
startHandler
protected Properties startHandler(Properties prop) throws Exception
Start the handler.- Parameters:
prop- properties for start if needed- Returns:
- properties for the reply.
- Throws:
Exception
-
start
public void start()
Start the handler. To be use by MBean interface- Specified by:
startin interfaceAcquisitionQueueMBean
-
stopHandler
protected Properties stopHandler(Properties prop) throws Exception
Stop the handler.- Parameters:
prop- properties for stop if needed- Returns:
- properties for the reply.
- Throws:
Exception
-
stop
public void stop()
Stop the handler. To be use by MBean interface- Specified by:
stopin interfaceAcquisitionQueueMBean
-
acquisitionNot
private void acquisitionNot(AcquisitionNot not)
This method process messages from the acquisition module. The method addClientMessages of base implementation is used to handle incoming messages.- Parameters:
not-
-
toString
public String toString()
Description copied from class:QueueReturns a string representation of this destination.- Specified by:
toStringin interfaceAgentMBean- Specified by:
toStringin interfaceDestinationMBean- Overrides:
toStringin classQueue- Returns:
- a string representation of this destination.
-
getExpiration
public long getExpiration()
Description copied from interface:AcquisitionMBeanReturns the expiration value for produced messages.- Specified by:
getExpirationin interfaceAcquisitionMBean- Returns:
- the expiration value for produced messages.
-
getPriority
public int getPriority()
Description copied from interface:AcquisitionMBeanReturns the priority of produced messages.- Specified by:
getPriorityin interfaceAcquisitionMBean- Returns:
- the priority of produced messages.
-
isMessagePersistent
public boolean isMessagePersistent()
Description copied from interface:AcquisitionMBeanReturns true if the messages produced are persistent.- Specified by:
isMessagePersistentin interfaceAcquisitionMBean- Returns:
- true if the messages produced are persistent.
-
setExpiration
public void setExpiration(long expiration)
Description copied from interface:AcquisitionMBeanSets the expiration value for produced messages.- Specified by:
setExpirationin interfaceAcquisitionMBean- Parameters:
expiration- the expiration to set.
-
setMessagePersistent
public void setMessagePersistent(boolean isPersistent)
Description copied from interface:AcquisitionMBeanSets the DeliveryMode value for the produced messages. If the parameter is true the messages produced are persistent.- Specified by:
setMessagePersistentin interfaceAcquisitionMBean- Parameters:
isPersistent- if true the messages produced are persistent.
-
setPriority
public void setPriority(int priority)
Description copied from interface:AcquisitionMBeanSets the priority of produced messages.- Specified by:
setPriorityin interfaceAcquisitionMBean- Parameters:
priority- the priority to set.
-
close
private void close()
-
getAcquisitionPeriod
public long getAcquisitionPeriod()
Description copied from interface:AcquisitionMBeanReturns the acquisition period.- Specified by:
getAcquisitionPeriodin interfaceAcquisitionMBean- Returns:
- the acquisition period.
-
getEncodableClassId
public int getEncodableClassId()
Description copied from class:AgentEnables the sub classes not to implement this method.- Specified by:
getEncodableClassIdin interfaceEncodable- Overrides:
getEncodableClassIdin classQueue- Returns:
- -1
-
-