diff options
author | Shireesh Anjal <shireesh@gluster.com> | 2011-08-22 12:40:50 +0530 |
---|---|---|
committer | Shireesh Anjal <shireesh@gluster.com> | 2011-08-22 12:40:50 +0530 |
commit | bab630dedb8bb01fca3c1cb4c6c65ee85f4fbc3e (patch) | |
tree | 3913959dec3c545b10851141efe8de10f5ea9ea6 /src/com.gluster.storage.management.gateway | |
parent | 9702f8f6466aa5de4a1511903c9ac18f1c8ad0cb (diff) |
Modified method executeCommand to throw ConnectionException if the cached SSH connection is no more valid.
Diffstat (limited to 'src/com.gluster.storage.management.gateway')
-rw-r--r-- | src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java index d00049de..ed45305d 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java @@ -295,7 +295,12 @@ public class SshUtil { // remove the connection from cache and close it sshConnCache.remove(sshConnection); sshConnection.close(); - throw new GlusterRuntimeException(errMsg, e); + if(e instanceof IllegalStateException) { + // The connection is no more valid. Create and throw a connection exception. + throw new ConnectionException("Couldn't open SSH session on [" + sshConnection.getHostname() + "]!", e); + } else { + throw new GlusterRuntimeException(errMsg, e); + } } finally { if(session != null) { session.close(); |