# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/oleksiys/Projects/glassfish/3.1.1/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: MonitorableSelectionKeyHandler.java --- MonitorableSelectionKeyHandler.java Base (BASE) +++ MonitorableSelectionKeyHandler.java Locally Modified (Based On LOCAL) @@ -42,6 +42,7 @@ import com.sun.grizzly.http.SelectorThread; import com.sun.grizzly.http.SelectorThreadKeyHandler; +import com.sun.grizzly.util.ConnectionCloseHandler; import com.sun.grizzly.util.Copyable; import java.nio.channels.SelectionKey; @@ -65,6 +66,7 @@ super(selectorThread); this.grizzlyMonitoring = grizzlyMonitoring; this.monitoringId = monitoringId; + setConnectionCloseHandler(new CloseHandler()); } @Override @@ -76,12 +78,21 @@ copyHandler.monitoringId = monitoringId; } + private final class CloseHandler implements ConnectionCloseHandler { + @Override - public void cancel(SelectionKey key) { - grizzlyMonitoring.getConnectionQueueProbeProvider().connectionClosedEvent( - monitoringId, key.channel().hashCode()); + public void locallyClosed(final SelectionKey key) { + notifyClosed(key); + } - super.cancel(key); + @Override + public void remotlyClosed(final SelectionKey key) { + notifyClosed(key); } + private void notifyClosed(final SelectionKey key) { + grizzlyMonitoring.getConnectionQueueProbeProvider().connectionClosedEvent( + monitoringId, key.channel().hashCode()); } + } +}