mirror of https://github.com/apache/jclouds.git
more retryable sshj exceptions
This commit is contained in:
parent
52d978a602
commit
4dae25ce2c
|
@ -31,6 +31,7 @@ import static org.jclouds.crypto.SshKeys.sha1PrivateKey;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
@ -118,7 +119,8 @@ public class SshjSshClient implements SshClient {
|
||||||
@Named("jclouds.ssh.retry-predicate")
|
@Named("jclouds.ssh.retry-predicate")
|
||||||
// NOTE cannot retry io exceptions, as SSHException is a part of the chain
|
// NOTE cannot retry io exceptions, as SSHException is a part of the chain
|
||||||
private Predicate<Throwable> retryPredicate = or(instanceOf(ConnectionException.class),
|
private Predicate<Throwable> retryPredicate = or(instanceOf(ConnectionException.class),
|
||||||
instanceOf(ConnectException.class), instanceOf(TransportException.class));
|
instanceOf(ConnectException.class), instanceOf(SocketTimeoutException.class),
|
||||||
|
instanceOf(TransportException.class));
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Named("jclouds.ssh")
|
@Named("jclouds.ssh")
|
||||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.inject.name.Names.bindProperties;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import net.schmizz.sshj.common.SSHException;
|
import net.schmizz.sshj.common.SSHException;
|
||||||
|
@ -86,6 +87,7 @@ public class SshjSshClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExceptionClassesRetry() {
|
public void testExceptionClassesRetry() {
|
||||||
|
assert ssh.shouldRetry(new SocketTimeoutException("connect timed out"));
|
||||||
assert ssh.shouldRetry(new TransportException("socket closed"));
|
assert ssh.shouldRetry(new TransportException("socket closed"));
|
||||||
assert ssh.shouldRetry(new ConnectionException("problem"));
|
assert ssh.shouldRetry(new ConnectionException("problem"));
|
||||||
assert ssh.shouldRetry(new ConnectException("Connection refused"));
|
assert ssh.shouldRetry(new ConnectException("Connection refused"));
|
||||||
|
|
Loading…
Reference in New Issue