Class RATE_LIMITER2

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.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
  • Field Details

    • 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 LongAdder num_dropped_msgs
    • num_blockings

      protected final LongAdder num_blockings
    • avg_block_time

      protected final AverageMinMax avg_block_time
    • lock

      protected Lock lock
    • cond

      protected Condition cond
    • running

      protected boolean running
    • timer

      protected TimeScheduler timer
    • f

      protected Future<?> f
    • task

      protected final Runnable task
  • Constructor Details

    • RATE_LIMITER2

      public RATE_LIMITER2()
  • Method Details

    • maxBytes

      public int maxBytes()
    • maxBytes

      public RATE_LIMITER2 maxBytes(int m)
    • interval

      public long interval()
    • interval

      public RATE_LIMITER2 interval(long i)
    • dropDontBlockMessages

      public boolean dropDontBlockMessages()
    • dropDontBlockMessages

      public RATE_LIMITER2 dropDontBlockMessages(boolean p)
    • init

      public void init() throws 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:
      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 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:
      Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so JChannel.connect(String) will throw an exception
    • stop

      public void stop()
      Description copied from class: Protocol
      Called on a JChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
      Specified by:
      stop in interface Lifecycle
      Overrides:
      stop in class Protocol
    • resetStats

      public void resetStats()
      Overrides:
      resetStats in class Protocol
    • replenish

      public void replenish()
    • changeInterval

      public void changeInterval(long new_interval)
    • down

      public 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