Class RATE_LIMITER2

  • All Implemented Interfaces:
    Lifecycle

    public class RATE_LIMITER2
    extends Protocol
    Rate limiter based credits (max_bytes). Senders send until max_bytes is exceeded; a replenisher task replenishes periodically.
    See https://issues.redhat.com/browse/JGRP-2779 for details
    Since:
    5.3.5
    Author:
    Bela Ban
    • Field Detail

      • max_bytes

        protected int max_bytes
      • interval

        protected long interval
      • drop_dont_block_msgs

        protected boolean drop_dont_block_msgs
      • bytes_left

        protected long bytes_left
      • num_replenishments

        protected int num_replenishments
      • num_dropped_msgs

        protected final java.util.concurrent.atomic.LongAdder num_dropped_msgs
      • num_blockings

        protected final java.util.concurrent.atomic.LongAdder num_blockings
      • lock

        protected java.util.concurrent.locks.Lock lock
      • cond

        protected java.util.concurrent.locks.Condition cond
      • running

        protected boolean running
      • f

        protected java.util.concurrent.Future<?> f
      • task

        protected final java.lang.Runnable task
    • Constructor Detail

      • RATE_LIMITER2

        public RATE_LIMITER2()
    • Method Detail

      • maxBytes

        public int maxBytes()
      • interval

        public long interval()
      • dropDontBlockMessages

        public boolean dropDontBlockMessages()
      • dropDontBlockMessages

        public RATE_LIMITER2 dropDontBlockMessages​(boolean p)
      • init

        public void init()
                  throws java.lang.Exception
        Description copied from class: Protocol
        Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
        Specified by:
        init in interface Lifecycle
        Overrides:
        init in class Protocol
        Throws:
        java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
      • start

        public void start()
                   throws java.lang.Exception
        Description copied from class: Protocol
        This method is called on a JChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top.
        Specified by:
        start in interface Lifecycle
        Overrides:
        start in class Protocol
        Throws:
        java.lang.Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so JChannel.connect(String) will throw an exception
      • replenish

        public void replenish()
      • changeInterval

        public void changeInterval​(long new_interval)
      • down

        public java.lang.Object down​(Message msg)
        Description copied from class: Protocol
        A message is sent down the stack. Protocols may examine the message and do something (e.g. add a header) with it, before passing it down.
        Overrides:
        down in class Protocol