Class PollerTracker

java.lang.Object
io.temporal.internal.worker.PollerTracker

public class PollerTracker extends Object
Tracks in-flight poll count and last successful poll time for heartbeat reporting.

A single counter feeds both the metrics system and heartbeat population, avoiding the need for separate counters tracking the same value.

This object bridges the gap between poll tasks (created inside start()) and heartbeat building: the intermediate worker (e.g. ActivityWorker) creates it, passes it to the poll task, and later reads it when building heartbeats.

pollStarted() and pollCompleted() return the updated count so callers can forward the value to the Tally gauge in a single operation.

  • Constructor Details

    • PollerTracker

      public PollerTracker()
  • Method Details

    • pollStarted

      public int pollStarted()
      Increments in-flight count. Returns the new value for forwarding to the Tally gauge.
    • pollCompleted

      public int pollCompleted()
      Decrements in-flight count. Returns the new value for forwarding to the Tally gauge.
    • pollSucceeded

      public void pollSucceeded()
      Records the current time as the last successful poll (a poll that returned a task).
    • getInFlightPolls

      public int getInFlightPolls()
    • getLastSuccessfulPollTime

      public Instant getLastSuccessfulPollTime()