Class ChecksPublishingQueue

java.lang.Object
io.jenkins.plugins.checks.status.ChecksPublishingQueue

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class ChecksPublishingQueue extends Object
Publishes the checks of a pipeline run off the thread that requested them.

A pipeline requests its checks from listeners that run on the build's CPS VM thread: progress updates from a GraphListener, and the completed check from RunListener.onCompleted(R, hudson.model.TaskListener), which WorkflowRun fires on that thread too. Publishing makes blocking calls to the SCM API, so doing it on that thread stops the pipeline until every call returns. This class moves the work to a small background pool instead.

Each run has at most one progress update waiting and one being published. A new progress update replaces the waiting one, and its output is computed when it is published, so it always shows the latest state.

Completed checks have their own pool, so they never wait behind the progress updates of other runs. Completing a run discards its waiting progress update, and the completed check is published after the one being published, if any, so a progress update can never overwrite the completed check. Nothing waits on the calling thread.

  • Method Details