Add more _selector.close()

Also add more log.
This commit is contained in:
Sheng Yang 2011-06-22 13:44:25 -07:00
parent b8e15a833b
commit 345d747913
3 changed files with 7 additions and 4 deletions

View File

@ -401,6 +401,7 @@ public class Agent implements HandlerFactory, IAgentControl {
_connection.start();
_shell.getBackoffAlgorithm().waitBeforeRetry();
} while (!_connection.isStartup());
s_logger.info("Connected to the server");
}
public void processStartupAnswer(Answer answer, Response response, Link link) {

View File

@ -78,6 +78,7 @@ public class NioClient extends NioConnection {
Link.doHandshake(sch, sslEngine, true);
s_logger.info("SSL: Handshake done");
} catch (Exception e) {
_selector.close();
throw new IOException("SSL: Fail to init SSL! " + e);
}

View File

@ -82,9 +82,7 @@ public abstract class NioConnection implements Runnable {
try {
_thread.wait();
} catch (InterruptedException e) {
if (s_logger.isTraceEnabled()) {
s_logger.info("Interrupted start thread ", e);
}
s_logger.warn("Interrupted start thread ", e);
}
}
}
@ -116,6 +114,9 @@ public abstract class NioConnection implements Runnable {
} catch (IOException e) {
s_logger.error("Unable to initialize the threads.", e);
return;
} catch (Exception e) {
s_logger.error("Unable to initialize the threads due to unknown exception.", e);
return;
}
_isStartup = true;
_thread.notifyAll();
@ -432,7 +433,7 @@ public abstract class NioConnection implements Runnable {
/* Release the resource used by the instance */
public void cleanUp() throws IOException {
if (_selector != null && _selector.isOpen()) {
if (_selector != null) {
_selector.close();
}
}