From 4074eeb329056ad1367971f1f735097b275cacc9 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 10 Mar 2014 15:24:48 +0100 Subject: [PATCH 1/2] use Iterator#remove() whe processing readyKeySet to avoid removing not processed keys Signed-off-by: Tigran Mkrtchyan --- .../src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java b/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java index 1f63365..84a058c 100644 --- a/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java +++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java @@ -317,7 +317,6 @@ public final class SelectorRunner implements Runnable { } if (!iterateKeys()) return false; - readyKeySet.clear(); } } @@ -337,7 +336,6 @@ public final class SelectorRunner implements Runnable { if (lastSelectedKeysCount != 0) { iterator = readyKeySet.iterator(); if (!iterateKeys()) return false; - readyKeySet.clear(); } readyKeySet = null; @@ -371,6 +369,7 @@ public final class SelectorRunner implements Runnable { while (it.hasNext()) { try { key = it.next(); + it.remove(); keyReadyOps = key.readyOps(); if (!iterateKeyEvents()) { return false; -- 1.8.5.3