Class PublishMessageQueue<E>

java.lang.Object
org.serviceconnector.registry.PublishMessageQueue<E>
Type Parameters:
E - the element type to handle in the queue

public class PublishMessageQueue<E> extends Object
The Class PublishMessageQueue. The PublishMessageQueue is responsible for queuing incoming data from server, to inform subscriptions about new arrived messages, to observe there timeouts and to know there current position in queue (TimeAwareDataPointer). The queue needs also to handle the deleting of consumed messages and to assure queue does not overflow.
Author:
JTraber
  • Constructor Details

    • PublishMessageQueue

      public PublishMessageQueue()
      Instantiates a new PublishMessageQueue.
  • Method Details

    • nodeIterator

      public Iterator<LinkedNode<E>> nodeIterator()
      Iterator<LinkedNode<E>>.
      Returns:
      the iterator
    • getTotalSize

      public int getTotalSize()
      Gets the total size of the queue.
      Returns:
      the size
    • getReferencedNodesCount

      public int getReferencedNodesCount()
      Gets the referenced node count.
      Returns:
      the referenced node count
    • insert

      public void insert(E message)
      Inserts a new message into the queue.
      Parameters:
      message - the message
    • hasNext

      public boolean hasNext(String sessionId)
      Checks for next.
      Parameters:
      sessionId - the session id
      Returns:
      true, if successful
    • getMessage

      public E getMessage(String sessionId)
      Return message if any. If no message is available null will be returned.
      Parameters:
      sessionId - the session id
      Returns:
      the e
    • getMessageOrListen

      public E getMessageOrListen(String sessionId, IRequest request, IResponse response)
      Return message if any. If no message is available null will be returned.
      Parameters:
      sessionId - the session id
      request - the request
      response - the response
      Returns:
      the e
    • removeNonreferencedNodes

      public void removeNonreferencedNodes()
      Removes the non referenced nodes. Starts removing nodes in first position of queue - stops at the position a node is referenced.
    • subscribe

      public void subscribe(String sessionId, SubscriptionMask mask, ReceivePublicationTimeout crpTimeout)
      Subscribe. Sets up subscription, create data pointer.
      Parameters:
      sessionId - the session id
      mask - the filter mask
      crpTimeout - the timer run
    • changeSubscription

      public void changeSubscription(String sessionId, SubscriptionMask mask)
      Change subscription.
      Parameters:
      sessionId - the session id
      mask - the mask
    • unsubscribe

      public void unsubscribe(String sessionId)
      Unsubscribe. Deletes subscription, remove data pointer.
      Parameters:
      sessionId - the session id
    • getPeak

      public int getPeak()
      Gets the peak the queue ever reached.
      Returns:
      the peak
    • dump

      public void dump(XMLDumpWriter writer) throws Exception
      Dump publish message queue.
      Parameters:
      writer - the writer
      Throws:
      Exception - the exception