Class DiscardOldestPolicy<E>

java.lang.Object
org.apache.dubbo.common.concurrent.DiscardOldestPolicy<E>
All Implemented Interfaces:
Rejector<E>

public class DiscardOldestPolicy<E> extends Object implements Rejector<E>
A handler for rejected element that discards the oldest element.
  • Constructor Details

    • DiscardOldestPolicy

      public DiscardOldestPolicy()
  • Method Details

    • reject

      public void reject(E e, Queue<E> queue)
      Description copied from interface: Rejector
      Method that may be invoked by a Queue when Queue has remained memory return true. This may occur when no more memory are available because their bounds would be exceeded.

      In the absence of other alternatives, the method may throw an unchecked RejectException, which will be propagated to the caller.

      Specified by:
      reject in interface Rejector<E>
      Parameters:
      e - the element requested to be added
      queue - the queue attempting to add this element