Class AcquisitionQueue

    • 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
    • Constructor Detail

      • AcquisitionQueue

        public AcquisitionQueue()
    • Method Detail

      • getHandledMsgCount

        public final long getHandledMsgCount()
        Returns the number of acquired messages processed by the destination.
        Specified by:
        getHandledMsgCount in interface AcquisitionQueueMBean
        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:
        getDiffMax in interface AcquisitionQueueMBean
        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:
        getDiffMin in interface AcquisitionQueueMBean
        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:
        getPendingMax in interface AcquisitionQueueMBean
        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:
        getPendingMin in interface AcquisitionQueueMBean
        Returns:
        the minimum threshold of waiting messages in the destination.
      • initialize

        public void initialize​(boolean firstTime)
                        throws Exception
        Description copied from class: Queue
        Initializes the destination.
        Overrides:
        initialize in class Queue
        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:
        getAcquiredMsgCount in interface AcquisitionQueueMBean
        Returns:
        the number of messages acquired by the acquisition handler.
      • react

        public void react​(AgentId from,
                          Notification not)
                   throws Exception
        Description copied from class: Queue
        Distributes the received notifications to the appropriate reactions.
        Overrides:
        react in class Queue
        Parameters:
        from - agent sending notification
        not - notification to react to
        Throws:
        Exception - unspecialized exception
      • agentFinalize

        public void agentFinalize​(boolean lastTime)
        Description copied from class: Destination
        Finalizes the agent before it is garbaged.
        Overrides:
        agentFinalize in class Destination
        Parameters:
        lastTime - true if the destination is deleted
      • isHandlerRunning

        public boolean isHandlerRunning()
        Returns the acquisition handler status. To be use by MBean interface.
        Specified by:
        isHandlerRunning in interface AcquisitionQueueMBean
        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:
        start in interface AcquisitionQueueMBean
      • 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:
        stop in interface AcquisitionQueueMBean
      • 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 -
      • getExpiration

        public long getExpiration()
        Description copied from interface: AcquisitionMBean
        Returns the expiration value for produced messages.
        Specified by:
        getExpiration in interface AcquisitionMBean
        Returns:
        the expiration value for produced messages.
      • getPriority

        public int getPriority()
        Description copied from interface: AcquisitionMBean
        Returns the priority of produced messages.
        Specified by:
        getPriority in interface AcquisitionMBean
        Returns:
        the priority of produced messages.
      • isMessagePersistent

        public boolean isMessagePersistent()
        Description copied from interface: AcquisitionMBean
        Returns true if the messages produced are persistent.
        Specified by:
        isMessagePersistent in interface AcquisitionMBean
        Returns:
        true if the messages produced are persistent.
      • setExpiration

        public void setExpiration​(long expiration)
        Description copied from interface: AcquisitionMBean
        Sets the expiration value for produced messages.
        Specified by:
        setExpiration in interface AcquisitionMBean
        Parameters:
        expiration - the expiration to set.
      • setMessagePersistent

        public void setMessagePersistent​(boolean isPersistent)
        Description copied from interface: AcquisitionMBean
        Sets the DeliveryMode value for the produced messages. If the parameter is true the messages produced are persistent.
        Specified by:
        setMessagePersistent in interface AcquisitionMBean
        Parameters:
        isPersistent - if true the messages produced are persistent.
      • setPriority

        public void setPriority​(int priority)
        Description copied from interface: AcquisitionMBean
        Sets the priority of produced messages.
        Specified by:
        setPriority in interface AcquisitionMBean
        Parameters:
        priority - the priority to set.
      • close

        private void close()