Class JenkinsLaunchThrottle

java.lang.Object
org.jenkinsci.gradle.plugins.jpi2.JenkinsLaunchThrottle
All Implemented Interfaces:
org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>

public abstract class JenkinsLaunchThrottle extends Object implements org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
A shared Gradle build service used purely as a concurrency gate for launching Jenkins.

Each TestServerTask spawns a nested Gradle build that boots a full Jenkins JVM, so every testServer / testHplRun task is two heavyweight JVMs. When many such tasks run at once — a monorepo can have dozens, one per plugin module — the machine saturates and Jenkins fails to finish booting within the startup timeout, then gets terminated (exit code 143).

Registering this service with a bounded maxParallelUsages and having every launch task declare usesService(...) caps the number of concurrent Jenkins launches without throttling the rest of the build (compilation, unit tests, etc. keep full --max-workers parallelism). This replaces the blunt --max-workers=N workaround.

The service holds no state; it exists only so Gradle can enforce the parallelism limit.

  • Field Details

    • MAX_PARALLEL_LAUNCHES_PROPERTY

      public static final String MAX_PARALLEL_LAUNCHES_PROPERTY
      System property that sets the concurrent-launch cap. Accepts an absolute integer (e.g. 3), or a processor-relative value C (all available processors) or C/D (processors divided by D). The processor-relative form lets a single setting scale across machines, so a user does not have to re-tune an absolute number per machine.
      See Also:
  • Constructor Details

    • JenkinsLaunchThrottle

      public JenkinsLaunchThrottle()