Class RunRegistry.RunHandle

java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.RunRegistry.RunHandle
Enclosing class:
RunRegistry

public static final class RunRegistry.RunHandle extends Object
One run: its thread, journal, and subscribers. Obtain via RunRegistry.start(RunPipelineCrawlRequest, BiConsumer) / RunRegistry.get(String).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Block until the run reaches a terminal state.
    boolean
    Request cancellation: interrupts the run thread.
    Summary snapshot of this run.
    boolean
    Whether the run has finished (successfully or not).
    Registry id for this run.
    void
    subscribe(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> subscriber)
    Attach a subscriber: full journal replay, then live tail, in order, with no gap (replay and appends share the handle lock).
    void
    unsubscribe(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> subscriber)
    Detach a subscriber (client went away).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • subscribe

      public void subscribe(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> subscriber)
      Attach a subscriber: full journal replay, then live tail, in order, with no gap (replay and appends share the handle lock). If the run is already terminal, the subscriber gets the replay followed immediately by onCompleted.
      Parameters:
      subscriber - where events go (SSE bridge or gRPC observer)
    • unsubscribe

      public void unsubscribe(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> subscriber)
      Detach a subscriber (client went away). The run does not care.
      Parameters:
      subscriber - previously passed to subscribe(StreamObserver)
    • cancel

      public boolean cancel()
      Request cancellation: interrupts the run thread. The orchestration maps the interrupt to RunInterrupted → FAILED summary → ninja cleanup, so cancel is clean by construction.
      Returns:
      true if a live thread was interrupted
    • awaitTerminal

      public boolean awaitTerminal(Duration wait) throws InterruptedException
      Block until the run reaches a terminal state.
      Parameters:
      wait - how long to wait
      Returns:
      true if terminal, false on timeout
      Throws:
      InterruptedException - if interrupted while waiting
    • isTerminal

      public boolean isTerminal()
      Whether the run has finished (successfully or not).
      Returns:
      true once terminal
    • runId

      public String runId()
      Registry id for this run.
      Returns:
      the run id
    • info

      public RunRegistry.RunInfo info()
      Summary snapshot of this run.
      Returns:
      the info row