Class PortAllocationService
java.lang.Object
org.jenkinsci.gradle.plugins.jpi2.PortAllocationService
- All Implemented Interfaces:
org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
public abstract class PortAllocationService
extends Object
implements org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
A Shared Gradle build service that provides port allocation functionality.
This service finds and reserves free ports for use during the build process.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintFinds and reserves a free port for use during the build.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.services.BuildService
getParameters
-
Constructor Details
-
PortAllocationService
public PortAllocationService()
-
-
Method Details
-
findAndReserveFreePort
public int findAndReserveFreePort()Finds and reserves a free port for use during the build.- Returns:
- a free port number
- Throws:
IllegalStateException- if no free port can be found after retrying
-