From ff1bfa599fd317d2e3f389564acd4a0ec6630b36 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Thu, 19 May 2016 11:48:24 +0200 Subject: [PATCH] Issue #354 (Spin loop in case of exception thrown during accept()). Improved the solution by sleeping only if we are still accepting. This avoids the sleep when the connector is stopping, speeding up tests. --- .../jetty/server/AbstractConnector.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index b8d2978d604..7df8b88f24e 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -536,22 +536,22 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co LOG.warn(current); else LOG.debug(current); + try + { + // Arbitrary sleep to avoid spin looping. + // Subclasses may decide for a different + // sleep policy or closing the connector. + Thread.sleep(1000); + return true; + } + catch (Throwable x) + { + return false; + } } else { LOG.ignore(current); - } - - try - { - // Arbitrary sleep to avoid spin looping. - // Subclasses may decide for a different - // sleep policy or closing the connector. - Thread.sleep(1000); - return true; - } - catch (Throwable x) - { return false; } }