Salut,
I've added a new Handler for managing local and remote connection close.
The new ConnectionCloseHandler[1] can be configured on any class that
extends our BaseSelectionKeyHandler (like DefaultSelectionKeyHandler):
SelectionKeyHandler skh = new DefaultSelectionKeyHandler();
shk.setConnectionCloseHandler(new ConnectionCloseHandler() {
public void locallyClosed(SelectionKey key) {
logger.info(key + " is being locally cancelled");
}
public void remotlyClosed(SelectionKey key) {
logger.fine(key + " is being remotly cancelled (connection
closed)");
}
});
controller.setSelectionKeyHandler(skh);
Those two methods gets invoked when any of the following condition happens:
1. Any IOException occurs on I/O operations (read/write)
2. When the read() or write() operation return -1
Please try it :-)
A+
-- Jeanfrancois
[1]
https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/util/ConnectionCloseHandler.html