Skip to content

Commit 1535afe

Browse files
SudhansuRohit Yadav
authored andcommitted
CLOUDSTACK-9843 : Performance improvement of deployVirtualMachine, createFirewallRule, createPortForwardingRule
removed 1 sec sleep in SSHHelper. (cherry picked from commit 28bb8ba) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent af6c28b commit 1535afe

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

utils/src/main/java/com/cloud/utils/ssh/SshHelper.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ public class SshHelper {
3939
private static final int DEFAULT_CONNECT_TIMEOUT = 180000;
4040
private static final int DEFAULT_KEX_TIMEOUT = 60000;
4141

42-
/**
43-
* Waiting time to check if the SSH session was successfully opened. This value (of 1000
44-
* milliseconds) represents one (1) second.
45-
*/
46-
private static final long WAITING_OPEN_SSH_SESSION = 1000;
47-
4842
private static final Logger s_logger = Logger.getLogger(SshHelper.class);
4943

5044
public static Pair<Boolean, String> sshExecute(String host, int port, String user, File pemKeyFile, String password, String command) throws Exception {
@@ -236,14 +230,9 @@ public static Pair<Boolean, String> sshExecute(String host, int port, String use
236230
}
237231
}
238232

239-
/**
240-
* It gets a {@link Session} from the given {@link Connection}; then, it waits
241-
* {@value #WAITING_OPEN_SSH_SESSION} milliseconds before returning the session, given a time to
242-
* ensure that the connection is open before proceeding the execution.
243-
*/
233+
244234
protected static Session openConnectionSession(Connection conn) throws IOException, InterruptedException {
245235
Session sess = conn.openSession();
246-
Thread.sleep(WAITING_OPEN_SSH_SESSION);
247236
return sess;
248237
}
249238

utils/src/test/java/com/cloud/utils/ssh/SshHelperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,6 @@ public void openConnectionSessionTest() throws IOException, InterruptedException
146146
Mockito.verify(conn).openSession();
147147

148148
PowerMockito.verifyStatic();
149-
Thread.sleep(Mockito.anyLong());
149+
150150
}
151151
}

0 commit comments

Comments
 (0)