Class TransferQueueBundler

  • All Implemented Interfaces:
    java.lang.Runnable, Bundler
    Direct Known Subclasses:
    AlternatingBundler, SimplifiedTransferQueueBundler

    public class TransferQueueBundler
    extends BaseBundler
    implements java.lang.Runnable
    This bundler adds all (unicast or multicast) messages to a queue until max size has been exceeded, but does send messages immediately when no other messages are available. https://issues.jboss.org/browse/JGRP-1540
    • Field Detail

      • queue

        protected java.util.concurrent.BlockingQueue<Message> queue
      • remove_queue

        protected java.util.List<Message> remove_queue
      • bundler_thread

        protected volatile java.lang.Thread bundler_thread
      • running

        protected volatile boolean running
      • num_sends_because_full_queue

        protected int num_sends_because_full_queue
      • num_sends_because_no_msgs

        protected int num_sends_because_no_msgs
    • Constructor Detail

      • TransferQueueBundler

        public TransferQueueBundler()
      • TransferQueueBundler

        protected TransferQueueBundler​(java.util.concurrent.BlockingQueue<Message> queue)
      • TransferQueueBundler

        public TransferQueueBundler​(int capacity)
    • Method Detail

      • getThread

        public java.lang.Thread getThread()
      • getBufferSize

        public int getBufferSize()
      • removeQueueSize

        public int removeQueueSize()
      • getStats

        public java.util.Map<java.lang.String,​java.lang.Object> getStats()
        Description copied from interface: Bundler
        Returns stats about the bundler itself.
        Specified by:
        getStats in interface Bundler
        Returns:
        Stats, may be null
      • resetStats

        public void resetStats()
        Specified by:
        resetStats in interface Bundler
      • init

        public void init​(TP tp)
        Description copied from interface: Bundler
        Called after creation of the bundler
        Specified by:
        init in interface Bundler
        Overrides:
        init in class BaseBundler
        Parameters:
        tp - the transport, for further reference
      • size

        public int size()
        Description copied from class: BaseBundler
        Returns the total number of messages in the hashmap
        Specified by:
        size in interface Bundler
        Overrides:
        size in class BaseBundler
      • getQueueSize

        public int getQueueSize()
        Description copied from interface: Bundler
        If the bundler has a queue and it should be managed by a queuing discipline (like Random Early Detection), then return the number of elements in the queue, else -1. In the latter case, the queue won't be managed.
        This method needs to be fast as it might get called on every message to be sent.
        Specified by:
        getQueueSize in interface Bundler
      • send

        public void send​(Message msg)
                  throws java.lang.Exception
        Specified by:
        send in interface Bundler
        Overrides:
        send in class BaseBundler
        Throws:
        java.lang.Exception
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • addAndSendIfSizeExceeded

        protected void addAndSendIfSizeExceeded​(Message msg)
      • drain

        protected void drain()
        Takes all messages from the queue, adds them to the hashmap and then sends all bundled messages
      • _sendBundledMessages

        protected void _sendBundledMessages()
      • _addMessage

        protected void _addMessage​(Message msg,
                                   long size)
      • assertPositive

        protected static int assertPositive​(int value,
                                            java.lang.String message)