Class EventCaptureHandle

java.lang.Object
nl.pim16aap2.lightkeeper.framework.EventCaptureHandle
All Implemented Interfaces:
AutoCloseable

public final class EventCaptureHandle extends Object implements AutoCloseable
Handle for a dynamic event capture session.
  • Method Details

    • eventClassName

      public String eventClassName()
      Returns:
      The captured event class name, without querying the server.
    • getCapturedEvents

      public List<CapturedEventSnapshot> getCapturedEvents()
      Gets all captured events since the last clear or registration.
      Returns:
      List of captured event snapshots.
    • cancelNext

      public EventCaptureHandle cancelNext(int count)
      Arms cancellation of the next count fired events of this capture's class.

      The agent registers a LOWEST-priority listener, so regular plugin listeners — and this capture's MONITOR listener — observe the cancelled state. Deterministic only: exactly the next count events are cancelled, with no predicate filtering. The event class must implement Cancellable.

      Only one cancellation may be armed per event class at a time; arming again while one is active fails. Closing this handle disarms any remaining budget, so unexhausted cancellations never leak into later tests on a shared server.

      Parameters:
      count - How many upcoming events to cancel; must be positive.
      Returns:
      This handle for fluent chaining.
    • clear

      public EventCaptureHandle clear()
      Clears all captured events for this session.
      Returns:
      This handle for fluent chaining.
    • close

      public void close()
      Stops capturing events and unregisters the listener.
      Specified by:
      close in interface AutoCloseable