Class PortUtils.ConnectionCheckSSH
- java.lang.Object
-
- com.nirima.jenkins.plugins.docker.utils.PortUtils.ConnectionCheckSSH
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
execute()
Tests the SSH connection.PortUtils.ConnectionCheckSSH
withSSHTimeout(int time, TimeUnit units)
-
-
-
Method Detail
-
withSSHTimeout
public PortUtils.ConnectionCheckSSH withSSHTimeout(int time, TimeUnit units)
-
execute
public boolean execute() throws InterruptedException
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.
-
-