Class PerDestinationBundler

  • All Implemented Interfaces:
    Bundler

    public class PerDestinationBundler
    extends java.lang.Object
    implements Bundler
    Queues messages per destination ('null' is a special destination), sending when the last sender thread to the same destination returns or max_size has been reached. This uses 1 thread per destination, 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

      • max_size

        protected int max_size
        Maximum number of bytes for messages to be queued until they are sent. This value needs to be smaller than the largest datagram packet size in case of UDP
      • total_msgs_sent

        protected final java.util.concurrent.atomic.LongAdder total_msgs_sent
      • num_single_msgs_sent

        protected final java.util.concurrent.atomic.LongAdder num_single_msgs_sent
      • num_batches_sent

        protected final java.util.concurrent.atomic.LongAdder num_batches_sent
      • num_send_due_to_no_msgs

        protected final java.util.concurrent.atomic.LongAdder num_send_due_to_no_msgs
      • num_sends_due_to_max_size

        protected final java.util.concurrent.atomic.LongAdder num_sends_due_to_max_size
      • transport

        protected TP transport
      • log

        protected Log log
      • local_addr

        protected Address local_addr
      • NULL

        protected static final Address NULL
    • Constructor Detail

      • PerDestinationBundler

        public PerDestinationBundler()
    • Method Detail

      • size

        public int size()
        Description copied from interface: Bundler
        The number of unsent messages in the bundler
        Specified by:
        size in interface Bundler
      • 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
      • getMaxSize

        public int getMaxSize()
        Description copied from interface: Bundler
        Maximum number of bytes for messages to be queued until they are sent
        Specified by:
        getMaxSize in interface Bundler
      • avgBatchSize

        public double avgBatchSize()
      • resetStats

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

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

        public void stop()
        Specified by:
        stop in interface Bundler
      • send

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