Class TransferQueueBundler

java.lang.Object
org.jgroups.protocols.BaseBundler
org.jgroups.protocols.TransferQueueBundler
All Implemented Interfaces:
Runnable, Bundler
Direct Known Subclasses:
AlternatingBundler, SimplifiedTransferQueueBundler

public class TransferQueueBundler extends BaseBundler implements 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.redhat.com/browse/JGRP-1540
  • Field Details

    • queue

      protected BlockingQueue<Message> queue
    • remove_queue

      protected final List<Message> remove_queue
    • bundler_thread

      protected volatile Thread bundler_thread
    • drop_when_full

      protected boolean drop_when_full
    • running

      protected volatile boolean running
    • num_sends_because_full_queue

      protected long num_sends_because_full_queue
    • num_sends_because_no_msgs

      protected long num_sends_because_no_msgs
    • num_drops_on_full_queue

      protected long num_drops_on_full_queue
    • avg_fill_count

      protected final AverageMinMax avg_fill_count
    • THREAD_NAME

      protected static final String THREAD_NAME
      See Also:
  • Constructor Details

    • TransferQueueBundler

      public TransferQueueBundler()
  • Method Details

    • 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
      Overrides:
      getQueueSize in class BaseBundler
    • removeQueueSize

      public int removeQueueSize()
    • dropWhenFull

      public boolean dropWhenFull()
    • dropWhenFull

      public <T extends Bundler> T dropWhenFull(boolean d)
    • resetStats

      public void resetStats()
      Specified by:
      resetStats in interface Bundler
      Overrides:
      resetStats in class BaseBundler
    • 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
    • start

      public void start()
      Description copied from interface: Bundler
      Called after Bundler.init(TP)
      Specified by:
      start in interface Bundler
      Overrides:
      start in class BaseBundler
    • stop

      public void stop()
      Specified by:
      stop in interface Bundler
      Overrides:
      stop in class BaseBundler
    • renameThread

      public void renameThread()
      Specified by:
      renameThread in interface Bundler
    • 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
    • send

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

      public void run()
      Specified by:
      run in interface 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