現在、ch.ethz.ssh2.Connection を使用して Java のサーバーに接続しています。1 つのサーバーでハングすることがあります (おそらく 10 ~ 15 秒程度)。このハングタイムの原因とそれを回避する方法を知りたいと思っていました。
接続例
conn = new ch.ethz.ssh2.Connection(serverName);
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(user, pass);
logger.info("Connecting to " + server);
if (isAuthenticated == false) {
logger.info(server + " Please check credentials");
}
sess = conn.openSession();
// I am connecting to over 200 servers and closing them. What would be the best practice to loop thru all these servers in the minimal time.
//some servers quickly connects, while some takes some time.
why does this happen?