@groovy.transform.CompileStatic final class RunPort extends java.lang.Object
The port a run is going to be reached on, checked before the run is started.
Whether the application has started is answered in part by connecting to its port, and a connection cannot tell one application from another. So anything already listening on the port -- a second build on the same CI agent, a developer's own server, a run left behind by a build that was cancelled -- answers on the application's behalf: the wait ends immediately, and what is then trained or traced is a recording of somebody else's application. It is reported as a success, because from the task's point of view nothing went wrong.
Binding the port first turns that into a failure that names the port, before anything is run. It is not proof against a race -- something can take the port between the check and the run -- but the case worth catching is a port that is already busy, which this catches every time.
| Type Params | Return Type | Name and description |
|---|---|---|
|
static void |
refuseWhereTaken(int port, java.lang.String what, java.lang.String setting)Refuses where something is already listening on the port. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Refuses where something is already listening on the port.
port - the port the run will be reached onwhat - what is being attempted, to open the message withsetting - the build setting that names the port, so the message says what to change