Class RED

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.RED
All Implemented Interfaces:
Lifecycle

@Deprecated(since="5.6.0", forRemoval=true) public class RED extends Protocol
Deprecated, for removal: This API element is subject to removal in a future version.
Functionality replaced by PerDestinationBundler, see https://redhat.atlassian.net/browse/JGRP-3027
Implementation of Random Early Drop: messages are discarded when the bundler's queue in the transport nears exhaustion. See Floyd and Van Jacobsen's paper for details.
Since:
5.0.0, 4.2.2
Author:
Bela Ban
  • Field Details

    • enabled

      protected boolean enabled
      Deprecated, for removal: This API element is subject to removal in a future version.
    • queue_capacity

      protected int queue_capacity
      Deprecated, for removal: This API element is subject to removal in a future version.
    • min_threshold

      protected double min_threshold
      Deprecated, for removal: This API element is subject to removal in a future version.
    • min

      protected long min
      Deprecated, for removal: This API element is subject to removal in a future version.
    • max_threshold

      protected double max_threshold
      Deprecated, for removal: This API element is subject to removal in a future version.
    • max

      protected long max
      Deprecated, for removal: This API element is subject to removal in a future version.
    • avg_queue_size

      protected double avg_queue_size
      Deprecated, for removal: This API element is subject to removal in a future version.
    • weight_factor

      protected double weight_factor
      Deprecated, for removal: This API element is subject to removal in a future version.
    • dropped_msgs

      protected final LongAdder dropped_msgs
      Deprecated, for removal: This API element is subject to removal in a future version.
    • total_msgs

      protected final LongAdder total_msgs
      Deprecated, for removal: This API element is subject to removal in a future version.
    • bundler

      protected Bundler bundler
      Deprecated, for removal: This API element is subject to removal in a future version.
    • lock

      protected final Lock lock
      Deprecated, for removal: This API element is subject to removal in a future version.
    • span

      protected long span
      Deprecated, for removal: This API element is subject to removal in a future version.
    • weight

      protected double weight
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • RED

      public RED()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setEnabled

      public RED setEnabled(boolean e)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getMinThreshold

      public double getMinThreshold()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDroppedMessages

      @Deprecated public long getDroppedMessages()
      Deprecated.
      Don't remove! https://issues.redhat.com/browse/JGRP-2814
    • getTotalMessages

      @Deprecated public long getTotalMessages()
      Deprecated.
      Don't remove! https://issues.redhat.com/browse/JGRP-2814
    • getDropRate

      public double getDropRate()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • start

      public void start() throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • resetStats

      public void resetStats()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      resetStats in class Protocol
    • down

      public Object down(Message msg)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • up

      public void up(MessageBatch batch)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: Protocol
      Sends up a multiple messages in a MessageBatch. The sender of the batch is always the same, and so is the destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed messages, although the transport itself will create initial MessageBatches that contain only either OOB or regular messages.

      The default processing below sends messages up the stack individually, based on a matching criteria (calling Protocol.accept(Message)), and - if true - calls Protocol.up(org.jgroups.Event) for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.

      Subclasses should check if there are any messages destined for them (e.g. using MessageBatch.iterator(Predicate)), then possibly remove and process them and finally pass the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all encrypted messages in the batch, not remove them, and pass the batch up when done.

      Overrides:
      up in class Protocol
      Parameters:
      batch - The message batch
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Protocol
    • computeAverage

      protected double computeAverage(double old_avg, int new_queue_size)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • computeDropProbability

      protected double computeDropProbability(double avg)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Computes a probability P with which the message should get dropped. min_threshold less than avg less than max_threshold. Probability increases linearly with min moving toward max
    • drop

      protected boolean drop(double avg)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • checkRange

      protected static double checkRange(double val, double min, double max, String name)
      Deprecated, for removal: This API element is subject to removal in a future version.