Class PerDestinationBundler

  • All Implemented Interfaces:
    java.lang.Runnable, Bundler

    public class PerDestinationBundler
    extends BaseBundler
    implements java.lang.Runnable
    Queues messages per destination ('null' is a special destination). Uses 1 thread per destination to process queued messages, so it won't scale to many cluster members (unless virtual threads are used).
    See https://issues.redhat.com/browse/JGRP-2639 for details.
    Since:
    5.2.7
    Author:
    Bela Ban
    • Field Detail

      • local_addr

        protected Address local_addr
      • NULL

        protected static final Address NULL
      • single_thread_runner

        protected Runner single_thread_runner
      • not_empty

        protected final java.util.concurrent.locks.Condition not_empty
      • msgs_available

        protected final java.util.concurrent.atomic.AtomicBoolean msgs_available
      • use_single_sender_thread

        protected boolean use_single_sender_thread
    • Constructor Detail

      • PerDestinationBundler

        public PerDestinationBundler()
    • Method Detail

      • isRunning

        public boolean isRunning()
      • useSingleSenderThread

        public boolean useSingleSenderThread()
      • useSingleSenderThread

        public PerDestinationBundler useSingleSenderThread​(boolean use_single_thread)
      • 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
      • 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
      • dump

        public java.lang.String dump()
      • active

        public java.lang.String active()
      • dests

        public java.lang.String dests()
      • init

        public void init​(TP transport)
        Description copied from interface: Bundler
        Called after creation of the bundler
        Specified by:
        init in interface Bundler
        Overrides:
        init in class BaseBundler
        Parameters:
        transport - the transport, for further reference
      • 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()
        Iterates through the send buffers and sends when messages are available. When an iteration found no messages to send, the thread blocks on a condition that is signalled as soon as messages are available in any of the buffers
        Specified by:
        run in interface java.lang.Runnable
      • signalNotEmpty

        protected void signalNotEmpty()
      • waitUntilMessagesAreAvailable

        protected void waitUntilMessagesAreAvailable()