Class BidiActivityGate

java.lang.Object
com.shaft.capture.collector.BidiActivityGate
All Implemented Interfaces:
BooleanSupplier

public final class BidiActivityGate extends Object implements BooleanSupplier
Tracks whether a BidiBrowserEventCollector running alongside a PollingBrowserEventCollector has delivered a signal recently, so the polling collector can skip its own redundant script round-trips while BiDi is proven healthy, and resume full-rate polling the moment BiDi goes quiet.
  • Constructor Details

    • BidiActivityGate

      public BidiActivityGate()
      Creates a gate using the default two-second grace period.
    • BidiActivityGate

      public BidiActivityGate(Duration gracePeriod)
      Creates a gate with a custom grace period.
      Parameters:
      gracePeriod - how long BiDi activity keeps reporting healthy after the last signal
  • Method Details

    • recordActivity

      public void recordActivity()
      Records that a BiDi collector just delivered a signal.
    • getAsBoolean

      public boolean getAsBoolean()
      Reports whether BiDi has delivered a signal within the grace period.
      Specified by:
      getAsBoolean in interface BooleanSupplier
      Returns:
      true while BiDi is proven healthy