Class PortUtils.ConnectionCheckSSH
java.lang.Object
com.nirima.jenkins.plugins.docker.utils.PortUtils.ConnectionCheckSSH
- Enclosing class:
- PortUtils
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public static class PortUtils.ConnectionCheckSSH
extends Object
-
Method Summary
Modifier and TypeMethodDescriptionboolean
execute()
Tests the SSH connection.withSSHTimeout
(int time, TimeUnit units)
-
Method Details
-
withSSHTimeout
-
execute
Tests the SSH connection. If the parentPortUtils.ConnectionCheck.withRetries(int)
was set to more than zero then more than one attempt will be made, waiting (for the period specified by the parentPortUtils.ConnectionCheck.withEveryRetryWaitFor(int, TimeUnit)
) between attempts. Note that, prior to testing that the port accepts SSH connection, it will first be tested to verify that it is open to TCP connections usingPortUtils.ConnectionCheck.execute()
, and this will also be subjected to retries, so that the total retry time for a port that is initially unavailable and then slow to accept SSH connections can be up to double what might be expected.- Returns:
- true if the connection succeeded, false if it failed despite any retries.
- Throws:
InterruptedException
- if interrupted while waiting between retries. Connects to sshd on host:port. Retries while attempts reached with delay First with tcp port wait, then with ssh connection waitIllegalStateException
- if the TCP port is not reachable despite retries.InterruptedException
- if interrupted while waiting between retries.
-