java.lang.Object
net.i2p.router.tunnel.pool.TestJob.BatchState
Enclosing class:
TestJob

static final class TestJob.BatchStateextends Object
Runtime state owned by a single router context: the first-test buffer and its pump flag, the instance and in-flight gauges, and the running-test map. State is keyed by context because RouterContext documents multiple router instances in one JVM — a static buffer would let a pump for context A drain context B's candidates using A's clock, queue, stats, and dispatcher.
  • Field Details

    • totalTestJobs

      final AtomicInteger totalTestJobs
      TestJob instances (queued + running) in this context; the memory bound checked against TestJob.getHardLimit(RouterContext).
    • runningTests

      final ConcurrentHashMap<Long,TestJob> runningTests
      Which tunnels currently have a test instance registered, so a duplicate cannot be created. Key: tunnel key, Value: the instance.
    • poolTestCounts

      final ConcurrentHashMap<String, AtomicInteger> poolTestCounts
      Outstanding test-instance claims per pool, one per created TestJob (queued or running), released exactly once when the instance terminates. Feeds the per-pool budget in TestJob.shouldSchedule(RouterContext, PooledTunnelCreatorConfig). Key: pool identifier, Value: outstanding claims in that pool.
    • inFlight

      final AtomicInteger inFlight
      Tests dispatched to the network and awaiting a reply or timeout, across all pools. Unlike runningTests (which also counts delayed retests parked in the queue), this measures pressure actually on the wire and is the capacity gate for the batched first-test pump.
    • poolInFlight

      final ConcurrentHashMap<String, AtomicInteger> poolInFlight
      Per-pool dispatched tests awaiting completion, for the client and exploratory per-pool budget gates. Key: pool identifier, Value: in-flight tests in that pool.
    • bufferLock

      final Object bufferLock
      Guards firstTestBuffer and bufferedKeys.
    • firstTestBuffer

      final Deque<TestJob.PendingTest> firstTestBuffer
      First-test candidates awaiting batched dispatch, oldest first.
    • bufferedKeys

      final Set<Long> bufferedKeys
      Tunnel keys currently in firstTestBuffer, for offer-time dedupe.
    • pumpQueued

      final AtomicBoolean pumpQueued
      Set while a PumpJob is queued or running; cleared when the buffer drains.
    • lastDenialLog

      final AtomicLong lastDenialLog
      Last time a batch-denial INFO line was logged (global rate limit).
    • quiesced

      volatile boolean quiesced
      True while a restart or shutdown is draining the subsystem: offers and dispatch are refused until the reset finishes.
  • Constructor Details

    • BatchState

      BatchState()
      Holds nothing beyond the field initializers below.