diff --git a/jetty-server/src/main/config/etc/jetty.xml b/jetty-server/src/main/config/etc/jetty.xml index d056f22c927..7c69d14bfc2 100644 --- a/jetty-server/src/main/config/etc/jetty.xml +++ b/jetty-server/src/main/config/etc/jetty.xml @@ -62,7 +62,7 @@ - + diff --git a/jetty-server/src/main/config/modules/server.mod b/jetty-server/src/main/config/modules/server.mod index ed7d608d01f..de983ae0fef 100644 --- a/jetty-server/src/main/config/modules/server.mod +++ b/jetty-server/src/main/config/modules/server.mod @@ -59,9 +59,6 @@ etc/jetty.xml ## Maximum number of error dispatches to prevent looping # jetty.httpConfig.maxErrorDispatches=10 -## Maximum time to block in total for a blocking IO operation (default -1 is to use idleTimeout on progress) -# jetty.httpConfig.blockingTimeout=-1 - ## Cookie compliance mode of: RFC2965, RFC6265 # jetty.httpConfig.cookieCompliance=RFC6265 diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java index 59e6f23aff9..12dc410a9e7 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java @@ -31,6 +31,8 @@ import org.eclipse.jetty.util.TreeTrie; import org.eclipse.jetty.util.Trie; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * HTTP Configuration. @@ -46,6 +48,8 @@ import org.eclipse.jetty.util.annotation.ManagedObject; @ManagedObject("HTTP Configuration") public class HttpConfiguration { + private static final Logger LOG = Log.getLogger(HttpConfiguration.class); + public static final String SERVER_VERSION = "Jetty(" + Jetty.VERSION + ")"; private final List _customizers=new CopyOnWriteArrayList<>(); private final Trie _formEncodedMethods = new TreeTrie<>(); @@ -239,8 +243,10 @@ public class HttpConfiguration * * @return -1, for no blocking timeout (default), 0 for a blocking timeout equal to the * idle timeout; >0 for a timeout in ms applied to the total blocking operation. + * @deprecated Replaced by {@link #getMinResponseDataRate()} and {@link #getMinRequestDataRate()} */ - @ManagedAttribute("Total timeout in ms for blocking I/O operations.") + @ManagedAttribute("Total timeout in ms for blocking I/O operations. DEPRECATED!") + @Deprecated public long getBlockingTimeout() { return _blockingTimeout; @@ -254,9 +260,13 @@ public class HttpConfiguration * * @param blockingTimeout -1, for no blocking timeout (default), 0 for a blocking timeout equal to the * idle timeout; >0 for a timeout in ms applied to the total blocking operation. + * @deprecated Replaced by {@link #setMinResponseDataRate(long) and {@link #setMinRequestDataRate(long)} */ + @Deprecated public void setBlockingTimeout(long blockingTimeout) { + if (blockingTimeout>0) + LOG.warn("HttpConfiguration.setBlockingTimeout is deprecated!"); _blockingTimeout = blockingTimeout; } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java index bdaabc174ca..4abdc02bece 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java @@ -60,6 +60,7 @@ public class SharedBlockingCallback private final Condition _complete = _lock.newCondition(); private Blocker _blocker = new Blocker(); + @Deprecated protected long getIdleTimeout() { return -1; @@ -135,7 +136,11 @@ public class SharedBlockingCallback _complete.signalAll(); } else - throw new IllegalStateException(_state); + { + LOG.warn("Succeeded after {}",_state.toString()); + if (LOG.isDebugEnabled()) + LOG.debug(_state); + } } finally { @@ -167,8 +172,12 @@ public class SharedBlockingCallback } else { - cause.printStackTrace(System.err); - throw new IllegalStateException(_state); + LOG.warn("Failed {} in {}",cause.toString(),_state.toString()); + if (LOG.isDebugEnabled()) + { + LOG.debug(cause); + LOG.debug(_state); + } } } finally @@ -227,6 +236,7 @@ public class SharedBlockingCallback } catch (final InterruptedException e) { + _state = e; throw new InterruptedIOException(); } finally @@ -253,9 +263,9 @@ public class SharedBlockingCallback { try { - // If the blocker timed itself out, remember the state - if (_state instanceof BlockerTimeoutException) - // and create a new Blocker + // If we have a failure + if (_state!=null && _state!=SUCCEEDED) + // create a new Blocker _blocker=new Blocker(); else // else reuse Blocker diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/SharedBlockingCallbackTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/SharedBlockingCallbackTest.java index 524ddd08277..73c614a022a 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/SharedBlockingCallbackTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/SharedBlockingCallbackTest.java @@ -220,6 +220,7 @@ public class SharedBlockingCallbackTest @Test public void testBlockerTimeout() throws Exception { + SharedBlockingCallback.LOG.info("Succeeded after ... warning is expected..."); Blocker b0=null; try { @@ -243,16 +244,7 @@ public class SharedBlockingCallbackTest try (Blocker blocker=sbcb.acquire()) { assertThat(blocker,not(equalTo(b0))); - try - { - b0.succeeded(); - fail(); - } - catch(Exception e) - { - assertThat(e,instanceOf(IllegalStateException.class)); - assertThat(e.getCause(),instanceOf(TimeoutException.class)); - } + b0.succeeded(); blocker.succeeded(); } }