Enum Class OverflowStrategy

java.lang.Object
java.lang.Enum<OverflowStrategy>
io.higson.runtime.diagnostic.queue.OverflowStrategy
All Implemented Interfaces:
Serializable, Comparable<OverflowStrategy>, Constable

public enum OverflowStrategy extends Enum<OverflowStrategy>
Strategy applied when the diagnostic queue is full and a new event arrives.
  • Enum Constant Details

    • DROP_OLDEST

      public static final OverflowStrategy DROP_OLDEST
      Remove the oldest element from the head of the queue to make room for the new one.
    • DROP_NEWEST

      public static final OverflowStrategy DROP_NEWEST
      Discard the new event; the queue contents remain unchanged.
    • BLOCK

      public static final OverflowStrategy BLOCK
      Block the producer thread until space becomes available in the queue.
  • Method Details

    • values

      public static OverflowStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OverflowStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • enqueue

      public abstract boolean enqueue(DiagnosticEvent event, LinkedBlockingDeque<DiagnosticEvent> deque, DiagnosticQueueMetrics metrics)
      Place the given event into the deque according to this strategy's overflow semantics.
      Parameters:
      event - the event to enqueue; must not be null
      deque - the backing deque
      metrics - metrics recorder
      Returns:
      true if the event was placed in the queue, false if dropped