This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch 2.0.X in repository https://gitbox.apache.org/repos/asf/mina.git
commit d269dfef42795b9f071d2a7acaf582e81034bfd8 Author: emmanuel lecharny <[email protected]> AuthorDate: Sat May 30 08:56:29 2026 +0200 Added a while.. true loop aound the ExpiredSessionThread loop so that the check is done more than once --- .../filter/firewall/ConnectionThrottleFilter.java | 52 +++++++++++----------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/mina-core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java b/mina-core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java index a3c3b6fbd..59d447bca 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java @@ -64,33 +64,35 @@ public class ConnectionThrottleFilter extends IoFilterAdapter { private class ExpiredSessionThread extends Thread { public void run() { - try { - // Wait for the delay to be expired - Thread.sleep(allowedInterval); - } catch (InterruptedException e) { - // We have been interrupted, get out of the loop. - return; - } - - // now, remove all the sessions that have been created - // before the delay - long currentTime = System.currentTimeMillis(); - - lock.lock(); - - try { - Iterator<String> sessions = clients.keySet().iterator(); - - while (sessions.hasNext()) { - String session = sessions.next(); - long creationTime = clients.get(session); - - if (creationTime + allowedInterval < currentTime) { - clients.remove(session); + while(true) { + try { + // Wait for the delay to be expired + Thread.sleep(allowedInterval); + } catch (InterruptedException e) { + // We have been interrupted, get out of the loop. + return; + } + + // now, remove all the sessions that have been created + // before the delay + long currentTime = System.currentTimeMillis(); + + lock.lock(); + + try { + Iterator<String> sessions = clients.keySet().iterator(); + + while (sessions.hasNext()) { + String session = sessions.next(); + long creationTime = clients.get(session); + + if (creationTime + allowedInterval < currentTime) { + clients.remove(session); + } } + } finally { + lock.unlock(); } - } finally { - lock.unlock(); } } }
