Class PortUtils.ConnectionCheck
java.lang.Object
com.nirima.jenkins.plugins.docker.utils.PortUtils.ConnectionCheck
- Enclosing class:
- PortUtils
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public static class PortUtils.ConnectionCheck
extends Object
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
-
Method Summary
Modifier and TypeMethodDescriptionboolean
execute()
Tests the connection.boolean
useSSH()
withEveryRetryWaitFor
(int time, TimeUnit units) Sets the delay between tries.withRetries
(int numberOfRetries) Sets the number of retries, such thatexecute()
will try once more than this.
-
Field Details
-
DEFAULT_RETRIES
protected static final int DEFAULT_RETRIES- See Also:
-
DEFAULT_RETRY_DELAY_SECONDS
protected static final int DEFAULT_RETRY_DELAY_SECONDS- See Also:
-
-
Method Details
-
withRetries
Sets the number of retries, such thatexecute()
will try once more than this. If this is not set then a default of 10 will be used.- Parameters:
numberOfRetries
- Number of retries. Negative values will be treated as zero.- Returns:
- this
-
withEveryRetryWaitFor
Sets the delay between tries. If this is not set then a default of 2 seconds will be used.- Parameters:
time
- The lengthy of time.units
- The units of that length.- Returns:
- this
-
useSSH
-
executeOnce
public boolean executeOnce()- Returns:
- true if socket opened successfully, false otherwise
-
execute
Tests the connection. IfwithRetries(int)
was set to more than zero then more than one attempt will be made, waiting (for the period specified bywithEveryRetryWaitFor(int, TimeUnit)
) between attempts.- Returns:
- true if the connection succeeded, false if it failed despite any retries.
- Throws:
InterruptedException
- if interrupted while waiting between retries.
-