Class ReplyQueue


  • public class ReplyQueue
    extends java.lang.Object
    The Broker reply queue is handle synchronous and asynchronous delivery of Broker replies.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReplyQueue()
      Constructs a new Broker reply queue.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connectionMarkedForClose​(boolean exceptionOccured)
      Indicates that the connection has been marked for closure.
      Notification get​(int requestID)
      Get a notification request from the reply queue.
      void interrupt()
      Interrupts the threads which have been waiting on the notifications.
      Reply listen​(Notification notification, long idleSocketTimeout, long maxTimeout, long timeoutAfterConnectionClose)
      Synchronously listen for a reply to a notification request.
      void post​(Reply reply)
      Post a Broker reply.
      void put​(Notification notification)
      Put a notification request into the reply queue.
      void registerLastSocketReceiveActivity​(long lastSocketReceiveActivity)
      Register the last socket receive activity.
      Notification remove​(int requestID)
      Remove a notification request from the reply queue.
      java.lang.String toString()
      Returns a string representation of this object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ReplyQueue

        public ReplyQueue()
        Constructs a new Broker reply queue.
    • Method Detail

      • put

        public void put​(Notification notification)
        Put a notification request into the reply queue.
        Parameters:
        notification - a notification request
      • get

        public Notification get​(int requestID)
        Get a notification request from the reply queue.
        Parameters:
        requestID - the request ID of the notification to get
        Returns:
        the notification request
      • remove

        public Notification remove​(int requestID)
        Remove a notification request from the reply queue.
        Parameters:
        requestID - the request ID of the notification to get
        Returns:
        the notification request
      • listen

        public Reply listen​(Notification notification,
                            long idleSocketTimeout,
                            long maxTimeout,
                            long timeoutAfterConnectionClose)
        Synchronously listen for a reply to a notification request.
        Parameters:
        notification - the notification to listen on
        idleSocketTimeout - how long to listen for the reply when no data is read on socket
        maxTimeout - how long to listen for the reply
        timeoutAfterConnectionClose - how long to listen for the reply after connection has been marked for closure. This timeout is used instead of idleSocketTimeout/maxTimeout if connection is marked for closure.
        Returns:
        the Broker reply
      • connectionMarkedForClose

        public void connectionMarkedForClose​(boolean exceptionOccured)
        Indicates that the connection has been marked for closure.
      • registerLastSocketReceiveActivity

        public void registerLastSocketReceiveActivity​(long lastSocketReceiveActivity)
        Register the last socket receive activity.
      • post

        public void post​(Reply reply)
        Post a Broker reply. If a notification request is associated with the reply's request ID then it will be notified.
        Parameters:
        reply - the Broker reply to post
      • interrupt

        public void interrupt()
        Interrupts the threads which have been waiting on the notifications. This should also cater to the threads which are waiting on the callback. So that is some MessageConsumer is waiting on the message, and then the connection is to be closed- that thread is let off.
      • toString

        public java.lang.String toString()
        Returns a string representation of this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this object