From cd5c73366e5ba7f6d94d7fd6816d8166a1a7dfd0 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 29 Aug 2011 10:45:32 +1000 Subject: [PATCH 01/16] added pause to make sure modified time on file changes --- .../test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java index 5d7ae1b935b..ba5c2de8de7 100644 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java +++ b/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java @@ -82,6 +82,8 @@ public class PolicyMonitorTest File permFile =new File(MavenTestingUtils.getTargetDir(), "test-classes/monitor-test-2/global-all-permission.policy"); + // Wait so that time is definitely different + Thread.sleep(10); permFile.setLastModified(System.currentTimeMillis()); monitor.waitForScan(); From 2a5a3a4d0104dbf3c011e5d4b36f0d5dcfb651ef Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 29 Aug 2011 12:26:48 +1000 Subject: [PATCH 02/16] free generator buffers --- .../eclipse/jetty/http/AbstractGenerator.java | 18 +++++++++++++++++- .../java/org/eclipse/jetty/http/Generator.java | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java index 97c81ab90df..50f58ae63f1 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java @@ -114,7 +114,7 @@ public abstract class AbstractGenerator implements Generator _contentLength = HttpTokens.UNKNOWN_CONTENT; _date = null; - // always return the buffer + // always return the body buffer if (_buffer!=null) _buffers.returnBuffer(_buffer); _buffer=null; @@ -132,6 +132,22 @@ public abstract class AbstractGenerator implements Generator _method=null; } + /* ------------------------------------------------------------------------------- */ + public void returnBuffers() + { + if (_buffer!=null && _buffer.length()==0) + { + _buffers.returnBuffer(_buffer); + _buffer=null; + } + + if (_header!=null && _header.length()==0) + { + _buffers.returnBuffer(_header); + _header=null; + } + } + /* ------------------------------------------------------------------------------- */ public void resetBuffer() { diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java index 5a9e97f31fa..725afa83417 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java @@ -73,6 +73,8 @@ public interface Generator void reset(boolean returnBuffers); void resetBuffer(); + + void returnBuffers(); void sendError(int code, String reason, String content, boolean close) throws IOException; From 39d0d4fee9591d0d6344c1057c885cfc48ad60e0 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 29 Aug 2011 12:27:53 +1000 Subject: [PATCH 03/16] 353073 deprecated non factory method for websocket clients --- .../jetty/server/AsyncHttpConnection.java | 2 ++ .../jetty/server/handler/ContextHandler.java | 1 + .../jetty/websocket/WebSocketClient.java | 15 +++++++-- .../websocket/WebSocketClientFactory.java | 33 +++++++++++++++++-- .../websocket/WebSocketConnectionD12.java | 5 ++- .../jetty/websocket/WebSocketParserD12.java | 4 +-- .../websocket/WebSocketMessageD12Test.java | 8 ++--- .../websocket/WebSocketParserD12Test.java | 2 +- 8 files changed, 56 insertions(+), 14 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 75342a63640..70175378cdf 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -119,6 +119,8 @@ public class AsyncHttpConnection extends HttpConnection // Are we write blocked if (_generator.isCommitted() && !_generator.isComplete()) ((AsyncEndPoint)_endp).scheduleWrite(); + else + _generator.returnBuffers(); } return connection; } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 42feb615a0c..0996c3e5f35 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -676,6 +676,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. // Context listeners if (_contextListeners != null) { + new Throwable().printStackTrace(); ServletContextEvent event = new ServletContextEvent(_scontext); for (int i = LazyList.size(_contextListeners); i-- > 0;) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java index 61e5869f0be..91f04f839b2 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java @@ -67,7 +67,9 @@ public class WebSocketClient /* ------------------------------------------------------------ */ /** Create a WebSocket Client with private factory. - *

Creates a WebSocketClient from a private WebSocketClientFactory. This can be wasteful of resources if many clients are created. + *

Creates a WebSocketClient from a private WebSocketClientFactory. + * This can be wasteful of resources if many clients are created. + * @deprecated Use {@link WebSocketClientFactory} */ public WebSocketClient() throws Exception { @@ -85,7 +87,16 @@ public class WebSocketClient _factory=factory; _maskGen=_factory.getMaskGen(); } - + + /* ------------------------------------------------------------ */ + /** + * @return The factory this client was created with. + */ + public WebSocketClientFactory getFactory() + { + return _factory; + } + /* ------------------------------------------------------------ */ /** Get the maxIdleTime for connections opened by this client. * @return The maxIdleTime in ms, or -1 if the default from {@link #getSelectorManager()} is used. diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 310fa065ca0..040c1be99ab 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -52,8 +52,9 @@ public class WebSocketClientFactory extends AggregateLifeCycle private final ThreadPool _threadPool; private final WebSocketClientSelector _selector; - private final WebSocketBuffers _buffers; - private final MaskGen _maskGen; + + private MaskGen _maskGen; + private WebSocketBuffers _buffers; /* ------------------------------------------------------------ */ /** Create a WebSocket Client with default configuration. @@ -111,6 +112,28 @@ public class WebSocketClientFactory extends AggregateLifeCycle return _maskGen; } + /* ------------------------------------------------------------ */ + public void setMaskGen(MaskGen maskGen) + { + if (isRunning()) + throw new IllegalStateException(getState()); + _maskGen=maskGen; + } + + /* ------------------------------------------------------------ */ + public void setBufferSize(int bufferSize) + { + if (isRunning()) + throw new IllegalStateException(getState()); + _buffers=new WebSocketBuffers(bufferSize); + } + + /* ------------------------------------------------------------ */ + public int getBufferSize() + { + return _buffers.getBufferSize(); + } + /* ------------------------------------------------------------ */ public WebSocketClient newWebSocketClient() { @@ -147,6 +170,12 @@ public class WebSocketClientFactory extends AggregateLifeCycle } } + /* ------------------------------------------------------------ */ + @Override + protected void doStop() throws Exception + { + super.doStop(); + } /* ------------------------------------------------------------ */ /** WebSocket Client Selector Manager diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java index f283b887a8b..8ae6afae084 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java @@ -58,7 +58,6 @@ public class WebSocketConnectionD12 extends AbstractConnection implements WebSoc final static int CLOSE_SHUTDOWN=1001; final static int CLOSE_PROTOCOL=1002; final static int CLOSE_BADDATA=1003; - final static int CLOSE_LARGE=1004; final static int CLOSE_NOCODE=1005; final static int CLOSE_NOCLOSE=1006; final static int CLOSE_NOTUTF8=1007; @@ -772,7 +771,7 @@ public class WebSocketConnectionD12 extends AbstractConnection implements WebSoc int max = _connection.getMaxBinaryMessageSize(); if (max>0 && (bufferLen+length)>max) { - _connection.close(WebSocketConnectionD12.CLOSE_LARGE,"Message size > "+_connection.getMaxBinaryMessageSize()); + _connection.close(WebSocketConnectionD12.CLOSE_BADDATA,"Message size > "+_connection.getMaxBinaryMessageSize()); _opcode=-1; if (_aggregate!=null) _aggregate.clear(); @@ -783,7 +782,7 @@ public class WebSocketConnectionD12 extends AbstractConnection implements WebSoc private void textMessageTooLarge() { - _connection.close(WebSocketConnectionD12.CLOSE_LARGE,"Text message size > "+_connection.getMaxTextMessageSize()+" chars"); + _connection.close(WebSocketConnectionD12.CLOSE_BADDATA,"Text message size > "+_connection.getMaxTextMessageSize()+" chars"); _opcode=-1; _utf8.reset(); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD12.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD12.java index 0ec8a47d389..1ab7f982de8 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD12.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD12.java @@ -249,7 +249,7 @@ public class WebSocketParserD12 implements WebSocketParser if (_length>_buffer.capacity() && !_fakeFragments) { events++; - _handler.close(WebSocketConnectionD12.CLOSE_LARGE,"frame size "+_length+">"+_buffer.capacity()); + _handler.close(WebSocketConnectionD12.CLOSE_BADDATA,"frame size "+_length+">"+_buffer.capacity()); _skip=true; } @@ -268,7 +268,7 @@ public class WebSocketParserD12 implements WebSocketParser if (_length>=_buffer.capacity()) { events++; - _handler.close(WebSocketConnectionD12.CLOSE_LARGE,"frame size "+_length+">"+_buffer.capacity()); + _handler.close(WebSocketConnectionD12.CLOSE_BADDATA,"frame size "+_length+">"+_buffer.capacity()); _skip=true; } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD12Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD12Test.java index 4b0414fc97b..a40fa0df7f1 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD12Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD12Test.java @@ -492,7 +492,7 @@ public class WebSocketMessageD12Test assertEquals(0x80|WebSocketConnectionD12.OP_CLOSE,input.read()); assertEquals(30,input.read()); int code=(0xff&input.read())*0x100+(0xff&input.read()); - assertEquals(1004,code); + assertEquals(WebSocketConnectionD12.CLOSE_BADDATA,code); lookFor("Text message size > 15 chars",input); } @@ -543,7 +543,7 @@ public class WebSocketMessageD12Test assertEquals(0x80|WebSocketConnectionD12.OP_CLOSE,input.read()); assertEquals(30,input.read()); int code=(0xff&input.read())*0x100+(0xff&input.read()); - assertEquals(1004,code); + assertEquals(WebSocketConnectionD12.CLOSE_BADDATA,code); lookFor("Text message size > 15 chars",input); } @@ -657,7 +657,7 @@ public class WebSocketMessageD12Test assertEquals(0x80|WebSocketConnectionD12.OP_CLOSE,input.read()); assertEquals(19,input.read()); int code=(0xff&input.read())*0x100+(0xff&input.read()); - assertEquals(1004,code); + assertEquals(WebSocketConnectionD12.CLOSE_BADDATA,code); lookFor("Message size > 15",input); } @@ -706,7 +706,7 @@ public class WebSocketMessageD12Test assertEquals(0x80|WebSocketConnectionD12.OP_CLOSE,input.read()); assertEquals(19,input.read()); int code=(0xff&input.read())*0x100+(0xff&input.read()); - assertEquals(1004,code); + assertEquals(WebSocketConnectionD12.CLOSE_BADDATA,code); lookFor("Message size > 15",input); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD12Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD12Test.java index fe621e3e6e7..bc58fac7a92 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD12Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD12Test.java @@ -269,7 +269,7 @@ public class WebSocketParserD12Test assertTrue(progress>0); - assertEquals(WebSocketConnectionD12.CLOSE_LARGE,_handler._code); + assertEquals(WebSocketConnectionD12.CLOSE_BADDATA,_handler._code); for (int i=0;i<2048;i++) _in.put((byte)'a'); progress =_parser.parseNext(); From 904a0026e189d1a8daba4b86c020d0a7b5f70b0d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 29 Aug 2011 14:38:38 +1000 Subject: [PATCH 04/16] 353192 Better warning for classes of wrong type --- .../main/java/org/eclipse/jetty/xml/XmlConfiguration.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index f70138b8192..c14e8046964 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -310,7 +310,10 @@ public class XmlConfiguration // Check the class of the object Class oClass = (Class)nodeClass(_config); if (oClass != null && !oClass.isInstance(obj)) - throw new IllegalArgumentException("Object is not of type " + oClass); + { + String loaders = (oClass.getClassLoader()==obj.getClass().getClassLoader())?"":"Object Class and type Class are from different loaders."; + throw new IllegalArgumentException("Object of class '"+obj.getClass().getCanonicalName()+"' is not of type '" + oClass.getCanonicalName()+"'. "+loaders); + } configure(obj,_config,0); return obj; } From 1ba88a6a4b6db75cc05c8233d3a499943e685c57 Mon Sep 17 00:00:00 2001 From: Michael Gorovoy Date: Mon, 29 Aug 2011 14:13:53 -0400 Subject: [PATCH 05/16] 352188 TestClient correctly processes --host option in jetty-websocket --- VERSION.txt | 1 + .../src/main/java/org/eclipse/jetty/websocket/TestClient.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 5a588980a83..41290de7a2b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,5 @@ jetty-7.5.0-SNAPSHOT + + 352188 TestClient correctly processes --host option in jetty-websocket + 353623 Added new methods to HttpExchange + 353624 HttpURI accepts java.net.URI object in constructor + 354080 ServletContextHandler allows to replace any subordinate handler when restarted diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java index cb7278cd089..d218cfec274 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java @@ -197,7 +197,7 @@ public class TestClient implements WebSocket.OnFrame if ("-p".equals(a)||"--port".equals(a)) port=Integer.parseInt(args[++i]); else if ("-h".equals(a)||"--host".equals(a)) - port=Integer.parseInt(args[++i]); + host=args[++i]; else if ("-c".equals(a)||"--count".equals(a)) count=Integer.parseInt(args[++i]); else if ("-s".equals(a)||"--size".equals(a)) From 0763e040e56d62cbde1e75277b909a6dbda9fb07 Mon Sep 17 00:00:00 2001 From: Michael Gorovoy Date: Mon, 29 Aug 2011 16:18:45 -0400 Subject: [PATCH 06/16] 353014 TimeoutExchangeTest run time reduced Patch provided by Thomas Becker --- VERSION.txt | 1 + .../jetty/client/TimeoutExchangeTest.java | 80 +++++++++---------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 41290de7a2b..04e152464b5 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,5 +1,6 @@ jetty-7.5.0-SNAPSHOT + 352188 TestClient correctly processes --host option in jetty-websocket + + 353014 TimeoutExchangeTest run time reduced + 353623 Added new methods to HttpExchange + 353624 HttpURI accepts java.net.URI object in constructor + 354080 ServletContextHandler allows to replace any subordinate handler when restarted diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java index 50ea494b772..2ace35c7a17 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java @@ -16,11 +16,13 @@ package org.eclipse.jetty.client; import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import junit.framework.Assert; + import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ByteArrayBuffer; @@ -31,29 +33,18 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; public class TimeoutExchangeTest { - private HttpClient _httpClient; - private Server _server; - private int _port; + private static HttpClient _httpClient; + private static Server _server; + private static int _port; - @Before - public void setUp() throws Exception - { - startServer(); - } - - @After - public void tearDown() throws Exception - { - stopClient(); - stopServer(); - } - - private void startServer() throws Exception + @BeforeClass + public static void startServer() throws Exception { _server = new Server(); _server.setGracefulShutdown(500); @@ -61,7 +52,8 @@ public class TimeoutExchangeTest _server.addConnector(_connector); Handler handler = new AbstractHandler() { - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, + ServletException { try { @@ -84,13 +76,24 @@ public class TimeoutExchangeTest _port = _connector.getLocalPort(); } - private void stopServer() throws Exception + @AfterClass + public static void stopServer() throws Exception { _server.stop(); _server.join(); _server = null; } + @After + public void stopClient() throws Exception + { + if (_httpClient != null) + { + _httpClient.stop(); + _httpClient = null; + } + } + private void startClient(long clientTimeout) throws Exception { startClient(clientTimeout, 20000); @@ -106,17 +109,11 @@ public class TimeoutExchangeTest _httpClient.start(); } - private void stopClient() throws Exception - { - _httpClient.stop(); -// Thread.sleep(500); - } - @Test public void testDefaultTimeoutNotExpiring() throws Exception { - startClient(1000); - long serverSleep = 500; + startClient(300); + long serverSleep = 100; CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); @@ -133,8 +130,8 @@ public class TimeoutExchangeTest @Test public void testDefaultTimeoutExpiring() throws Exception { - startClient(500); - long serverSleep = 1000; + startClient(100); + long serverSleep = 200; CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); @@ -151,9 +148,9 @@ public class TimeoutExchangeTest @Test public void testExchangeTimeoutNotExpiring() throws Exception { - startClient(500); - long serverSleep = 1000; - long exchangeTimeout = 1500; + startClient(100); + long serverSleep = 200; + long exchangeTimeout = 300; CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); @@ -171,9 +168,10 @@ public class TimeoutExchangeTest @Test public void testExchangeTimeoutExpiring() throws Exception { - startClient(5000); - long serverSleep = 1000; - long exchangeTimeout = 500; + startClient(1000); + + long serverSleep = 200; + long exchangeTimeout = 100; CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); @@ -191,8 +189,8 @@ public class TimeoutExchangeTest @Test public void testDefaultTimeoutWithSmallerIdleTimeoutNotExpiring() throws Exception { - startClient(3000, 1000); - long serverSleep = 2000; + startClient(500,150); + long serverSleep = 300; // The idle timeout is shorter than the default timeout, but will be // temporarily increased on the endpoint in order for the exchange to complete. @@ -212,9 +210,9 @@ public class TimeoutExchangeTest @Test public void testExchangeTimeoutWithSmallerIdleTimeoutNotExpiring() throws Exception { - startClient(4000, 3000); - long serverSleep = 1000; - long exchangeTimeout = 2000; + startClient(500,150); + long serverSleep = 150; + long exchangeTimeout = 300; // The idle timeout is shorter than the default timeout, but will be // temporarily increased on the endpoint in order for the exchange to complete. From 2f76dd13a4745db4bd5120662e43510ec7904483 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 30 Aug 2011 00:21:14 +0200 Subject: [PATCH 07/16] Added getter and setter to configure the bind address. Removed uneffective setSoTimeout() call, it is not used for non-blocking sockets. Reworked javadocs. --- .../jetty/websocket/WebSocketClient.java | 153 ++++++++++++------ 1 file changed, 102 insertions(+), 51 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java index 91f04f839b2..0f9b61cfdb4 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java @@ -3,12 +3,12 @@ package org.eclipse.jetty.websocket; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ProtocolException; +import java.net.SocketAddress; import java.net.URI; import java.nio.channels.ByteChannel; import java.nio.channels.SocketChannel; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; @@ -17,21 +17,25 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ -/** WebSocket Client - *

This WebSocket Client class can create multiple websocket connections to multiple destinations. - * It uses the same {@link WebSocket} endpoint API as the server. - * Simple usage is as follows:

+/**
+ * 

{@link WebSocketClient} allows to create multiple connections to multiple destinations + * that can speak the websocket protocol.

+ *

When creating websocket connections, {@link WebSocketClient} accepts a {@link WebSocket} + * object (to receive events from the server), and returns a {@link WebSocket.Connection} to + * send data to the server.

+ *

Example usage is as follows:

+ *
  *   WebSocketClientFactory factory = new WebSocketClientFactory();
  *   factory.start();
- *   WebSocketClient client = factory.newClient();
- *   client.start();
  *
- *   WebSocket.Connection connection =  client.open(new URI("ws://127.0.0.1:8080/"),new WebSocket.OnTextMessage()
+ *   WebSocketClient client = factory.newWebSocketClient();
+ *   // Configure the client
+ *
+ *   WebSocket.Connection connection = client.open(new URI("ws://127.0.0.1:8080/"), new WebSocket.OnTextMessage()
  *   {
  *     public void onOpen(Connection connection)
  *     {
@@ -47,7 +51,7 @@ import org.eclipse.jetty.util.log.Logger;
  *     {
  *       // handle incoming message
  *     }
- *   }).get(5,TimeUnit.SECONDS);
+ *   }).get(5, TimeUnit.SECONDS);
  *
  *   connection.sendMessage("Hello World");
  * 
@@ -63,14 +67,17 @@ public class WebSocketClient private String _protocol; private int _maxIdleTime=-1; private MaskGen _maskGen; - + private SocketAddress _bindAddress; /* ------------------------------------------------------------ */ - /** Create a WebSocket Client with private factory. - *

Creates a WebSocketClient from a private WebSocketClientFactory. - * This can be wasteful of resources if many clients are created. - * @deprecated Use {@link WebSocketClientFactory} + /** + *

Creates a WebSocketClient from a private WebSocketClientFactory.

+ *

This can be wasteful of resources if many clients are created.

+ * + * @deprecated Use {@link WebSocketClientFactory#newWebSocketClient()} + * @throws Exception if the private WebSocketClientFactory fails to start */ + @Deprecated public WebSocketClient() throws Exception { _factory=new WebSocketClientFactory(); @@ -79,27 +86,51 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Create a WebSocket Client with shared factory. - * @param threadpool + /** + *

Creates a WebSocketClient with shared WebSocketClientFactory.

+ * + * @param factory the shared {@link WebSocketClientFactory} */ public WebSocketClient(WebSocketClientFactory factory) { _factory=factory; _maskGen=_factory.getMaskGen(); } - + /* ------------------------------------------------------------ */ /** - * @return The factory this client was created with. + * @return The WebSocketClientFactory this client was created with. */ public WebSocketClientFactory getFactory() { return _factory; } - + /* ------------------------------------------------------------ */ - /** Get the maxIdleTime for connections opened by this client. - * @return The maxIdleTime in ms, or -1 if the default from {@link #getSelectorManager()} is used. + /** + * @return the address to bind the socket channel to + * @see #setBindAddress(SocketAddress) + */ + public SocketAddress getBindAddress() + { + return _bindAddress; + } + + /* ------------------------------------------------------------ */ + /** + * @param bindAddress the address to bind the socket channel to + * @see #getBindAddress() + */ + public void setBindAddress(SocketAddress bindAddress) + { + this._bindAddress = bindAddress; + } + + /* ------------------------------------------------------------ */ + /** + * @return The maxIdleTime in ms for connections opened by this client, + * or -1 if the default from {@link WebSocketClientFactory#getSelectorManager()} is used. + * @see #setMaxIdleTime(int) */ public int getMaxIdleTime() { @@ -107,8 +138,9 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Set the maxIdleTime for connections opened by this client. - * @param maxIdleTime max idle time in ms + /** + * @param maxIdleTime The max idle time in ms for connections opened by this client + * @see #getMaxIdleTime() */ public void setMaxIdleTime(int maxIdleTime) { @@ -116,8 +148,9 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Get the subprotocol string for connections opened by this client. - * @return The subprotocol + /** + * @return The subprotocol string for connections opened by this client. + * @see #setProtocol(String) */ public String getProtocol() { @@ -125,8 +158,9 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Set the subprotocol string for connections opened by this client. - * @param protocol The subprotocol + /** + * @param protocol The subprotocol string for connections opened by this client. + * @see #getProtocol() */ public void setProtocol(String protocol) { @@ -134,8 +168,9 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Get the origin of the client - * @return The clients Origin + /** + * @return The origin URI of the client + * @see #setOrigin(String) */ public String getOrigin() { @@ -143,8 +178,9 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Set the origin of the client - * @param origin the origin of the client (eg "http://example.com") + /** + * @param origin The origin URI of the client (eg "http://example.com") + * @see #getOrigin() */ public void setOrigin(String origin) { @@ -152,40 +188,58 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ + /** + *

Returns the map of the cookies that are sent during the initial HTTP handshake + * that upgrades to the websocket protocol.

+ * @return The read-write cookie map + */ public Map getCookies() { return _cookies; } /* ------------------------------------------------------------ */ + /** + * @return The list of websocket protocol extensions + */ public List getExtensions() { return _extensions; } /* ------------------------------------------------------------ */ + /** + * @return the mask generator to use, or null if not mask generator should be used + * @see #setMaskGen(MaskGen) + */ public MaskGen getMaskGen() { return _maskGen; } /* ------------------------------------------------------------ */ + /** + * @param maskGen the mask generator to use, or null if not mask generator should be used + * @see #getMaskGen() + */ public void setMaskGen(MaskGen maskGen) { _maskGen = maskGen; } /* ------------------------------------------------------------ */ - /** Open a WebSocket connection. - * Open a websocket connection to the URI and block until the connection is accepted or there is an error. + /** + *

Opens a websocket connection to the URI and blocks until the connection is accepted or there is an error.

+ * * @param uri The URI to connect to. * @param websocket The {@link WebSocket} instance to handle incoming events. * @param maxConnectTime The interval to wait for a successful connection * @param units the units of the maxConnectTime * @return A {@link WebSocket.Connection} - * @throws IOException - * @throws InterruptedException - * @throws TimeoutException + * @throws IOException if the connection fails + * @throws InterruptedException if the thread is interrupted + * @throws TimeoutException if the timeout elapses before the connection is completed + * @see #open(URI, WebSocket) */ public WebSocket.Connection open(URI uri, WebSocket websocket,long maxConnectTime,TimeUnit units) throws IOException, InterruptedException, TimeoutException { @@ -207,14 +261,15 @@ public class WebSocketClient } /* ------------------------------------------------------------ */ - /** Asynchronously open a websocket connection. - * Open a websocket connection and return a {@link Future} to obtain the connection. - * The caller must call {@link Future#get(long, TimeUnit)} if they wish to impose a connect timeout on the open. + /** + *

Asynchronously opens a websocket connection and returns a {@link Future} to obtain the connection.

+ *

The caller must call {@link Future#get(long, TimeUnit)} if they wish to impose a connect timeout on the open.

* * @param uri The URI to connect to. * @param websocket The {@link WebSocket} instance to handle incoming events. * @return A {@link Future} to the {@link WebSocket.Connection} - * @throws IOException + * @throws IOException if the connection fails + * @see #open(URI, WebSocket, long, TimeUnit) */ public Future open(URI uri, WebSocket websocket) throws IOException { @@ -227,12 +282,10 @@ public class WebSocketClient throw new IOException("wss not supported"); SocketChannel channel = SocketChannel.open(); + if (_bindAddress != null) + channel.socket().bind(_bindAddress); channel.socket().setTcpNoDelay(true); int maxIdleTime = getMaxIdleTime(); - if (maxIdleTime<0) - maxIdleTime=(int)_factory.getSelectorManager().getMaxIdleTime(); - if (maxIdleTime>0) - channel.socket().setSoTimeout(maxIdleTime); InetSocketAddress address=new InetSocketAddress(uri.getHost(),uri.getPort()); @@ -245,13 +298,12 @@ public class WebSocketClient return holder; } - /* ------------------------------------------------------------ */ /** The Future Websocket Connection. */ - static class WebSocketFuture implements Future + private static class WebSocketFuture implements Future { - final WebSocket _websocket;; + final WebSocket _websocket; final URI _uri; final String _protocol; final String _origin; @@ -366,7 +418,7 @@ public class WebSocketClient { return _maskGen; } - + public String toString() { return "[" + _uri + ","+_websocket+"]@"+hashCode(); @@ -433,7 +485,7 @@ public class WebSocketClient _done.await(timeout,unit); ByteChannel channel=null; org.eclipse.jetty.websocket.WebSocket.Connection connection=null; - Throwable exception=null; + Throwable exception; synchronized (this) { exception=_exception; @@ -476,6 +528,5 @@ public class WebSocketClient __log.debug(e); } } - } } From 3cbe6f7ca05320e19271e1176aca740cd6fca02d Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 30 Aug 2011 00:36:52 +0200 Subject: [PATCH 08/16] Javadocs. --- .../jetty/websocket/WebSocketClient.java | 2 +- .../websocket/WebSocketClientFactory.java | 82 +++++++++++-------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java index 0f9b61cfdb4..e3fb77a4b60 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java @@ -301,7 +301,7 @@ public class WebSocketClient /* ------------------------------------------------------------ */ /** The Future Websocket Connection. */ - private static class WebSocketFuture implements Future + static class WebSocketFuture implements Future { final WebSocket _websocket; final URI _uri; diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 040c1be99ab..45d6d1d0ffd 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -2,22 +2,10 @@ package org.eclipse.jetty.websocket; import java.io.EOFException; import java.io.IOException; -import java.net.InetSocketAddress; import java.net.ProtocolException; -import java.net.URI; -import java.nio.channels.ByteChannel; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; -import java.util.List; -import java.util.Map; import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpParser; @@ -39,9 +27,11 @@ import org.eclipse.jetty.util.thread.ThreadPool; /* ------------------------------------------------------------ */ -/** WebSocket Client Factory. - * The WebSocketClientFactory contains the common mechanisms for multiple WebSocketClient instances (eg threadpool, NIO selector). - * WebSocketClients with different configurations should share the same factory to avoid wasted resources. +/** + *

WebSocketClientFactory contains the common components needed by multiple {@link WebSocketClient} instances + * (for example, a {@link ThreadPool}, a {@link SelectorManager NIO selector}, etc).

+ *

WebSocketClients with different configurations should share the same factory to avoid to waste resources.

+ * * @see WebSocketClient */ public class WebSocketClientFactory extends AggregateLifeCycle @@ -52,20 +42,22 @@ public class WebSocketClientFactory extends AggregateLifeCycle private final ThreadPool _threadPool; private final WebSocketClientSelector _selector; - private MaskGen _maskGen; private WebSocketBuffers _buffers; /* ------------------------------------------------------------ */ - /** Create a WebSocket Client with default configuration. + /** + *

Creates a WebSocketClientFactory with the default configuration.

*/ public WebSocketClientFactory() { - this(new QueuedThreadPool(),new RandomMaskGen(),16*1024); + this(new QueuedThreadPool()); } - + /* ------------------------------------------------------------ */ - /** Create a WebSocket Client with ThreadPool . + /** + *

Creates a WebSocketClientFactory with the given ThreadPool and the default configuration.

+ * @param threadPool the ThreadPool instance to use */ public WebSocketClientFactory(ThreadPool threadPool) { @@ -73,12 +65,15 @@ public class WebSocketClientFactory extends AggregateLifeCycle } /* ------------------------------------------------------------ */ - /** Create a WebSocket Client with shared threadpool. - * @param threadpool + /** + *

Creates a WebSocketClientFactory with the specified configuration.

+ * @param threadPool the ThreadPool instance to use + * @param maskGen the mask generator to use + * @param bufferSize the read buffer size */ - public WebSocketClientFactory(ThreadPool threadpool,MaskGen maskGen,int bufferSize) + public WebSocketClientFactory(ThreadPool threadPool,MaskGen maskGen,int bufferSize) { - _threadPool=threadpool; + _threadPool=threadPool; _selector=new WebSocketClientSelector(); _buffers=new WebSocketBuffers(bufferSize); _maskGen=maskGen; @@ -98,7 +93,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle /* ------------------------------------------------------------ */ /** Get the ThreadPool. - *

Used to set/query the thread pool configuration. + * Used to set/query the thread pool configuration. * @return The {@link ThreadPool} */ public ThreadPool getThreadPool() @@ -107,39 +102,60 @@ public class WebSocketClientFactory extends AggregateLifeCycle } /* ------------------------------------------------------------ */ + /** + * @return the shared mask generator, or null if no shared mask generator is used + * @see {@link WebSocketClient#getMaskGen()} + */ public MaskGen getMaskGen() { return _maskGen; } - + /* ------------------------------------------------------------ */ + /** + * @param maskGen the shared mask generator, or null if no shared mask generator is used + * @see {@link WebSocketClient#setMaskGen(MaskGen)} + */ public void setMaskGen(MaskGen maskGen) { if (isRunning()) throw new IllegalStateException(getState()); _maskGen=maskGen; } - + /* ------------------------------------------------------------ */ + /** + * @param bufferSize the read buffer size + * @see #getBufferSize() + */ public void setBufferSize(int bufferSize) { if (isRunning()) throw new IllegalStateException(getState()); _buffers=new WebSocketBuffers(bufferSize); } - + /* ------------------------------------------------------------ */ + /** + * @return the read buffer size + */ public int getBufferSize() { return _buffers.getBufferSize(); } - + /* ------------------------------------------------------------ */ + /** + *

Creates and returns a new instance of a {@link WebSocketClient}, configured with this + * WebSocketClientFactory instance.

+ * + * @return a new {@link WebSocketClient} instance + */ public WebSocketClient newWebSocketClient() { return new WebSocketClient(this); } - + /* ------------------------------------------------------------ */ @Override protected void doStart() throws Exception @@ -303,7 +319,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle path="/"; String origin = future.getOrigin(); - + String request= "GET "+path+" HTTP/1.1\r\n"+ "Host: "+future.getURI().getHost()+":"+_holder.getURI().getPort()+"\r\n"+ @@ -402,8 +418,4 @@ public class WebSocketClientFactory extends AggregateLifeCycle _holder.handshakeFailed(new EOFException()); } } - - - - } From 4bab65040dec97360ed68e004f2bd3b95a47fab2 Mon Sep 17 00:00:00 2001 From: Michael Gorovoy Date: Mon, 29 Aug 2011 18:42:17 -0400 Subject: [PATCH 09/16] 356128 Removed integration tests from jetty-monitor module --- VERSION.txt | 1 + jetty-monitor/pom.xml | 3 -- .../jmx/JavaMonitorTools-mbean.properties | 0 tests/test-integration/pom.xml | 38 +++++++++++++++++++ .../monitor/JavaMonitorIntegrationTest.java | 2 +- .../jetty/test}/monitor/JmxServiceTest.java | 2 +- .../test}/monitor/ProgramConfigTest.java | 2 +- .../jetty/test}/monitor/XmlConfigTest.java | 2 +- .../test/resources/monitor/etc/jetty-jmx.xml | 0 .../src/test/resources/monitor/start.ini | 0 .../monitor/java-monitor-integration.xml | 0 .../jetty/monitor/jetty-monitor-service.xml | 0 .../jetty/monitor/jetty-monitor-test.xml | 0 13 files changed, 43 insertions(+), 7 deletions(-) rename jetty-monitor/src/main/resources/org/{mortbay => eclipse}/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties (100%) rename {jetty-monitor/src/test/java/org/eclipse/jetty => tests/test-integration/src/test/java/org/eclipse/jetty/test}/monitor/JavaMonitorIntegrationTest.java (99%) rename {jetty-monitor/src/test/java/org/eclipse/jetty => tests/test-integration/src/test/java/org/eclipse/jetty/test}/monitor/JmxServiceTest.java (99%) rename {jetty-monitor/src/test/java/org/eclipse/jetty => tests/test-integration/src/test/java/org/eclipse/jetty/test}/monitor/ProgramConfigTest.java (99%) rename {jetty-monitor/src/test/java/org/eclipse/jetty => tests/test-integration/src/test/java/org/eclipse/jetty/test}/monitor/XmlConfigTest.java (99%) rename {jetty-monitor => tests/test-integration}/src/test/resources/monitor/etc/jetty-jmx.xml (100%) rename {jetty-monitor => tests/test-integration}/src/test/resources/monitor/start.ini (100%) rename {jetty-monitor => tests/test-integration}/src/test/resources/org/eclipse/jetty/monitor/java-monitor-integration.xml (100%) rename {jetty-monitor => tests/test-integration}/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-service.xml (100%) rename {jetty-monitor => tests/test-integration}/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-test.xml (100%) diff --git a/VERSION.txt b/VERSION.txt index 04e152464b5..b00756bfbc4 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -4,6 +4,7 @@ jetty-7.5.0-SNAPSHOT + 353623 Added new methods to HttpExchange + 353624 HttpURI accepts java.net.URI object in constructor + 354080 ServletContextHandler allows to replace any subordinate handler when restarted + + 356128 Moved integration tests from jetty-monitor to test-integration module jetty-7.5.0.RC1 - 19 August 2011 + 276670 SLF4J loggers show correct location information diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index 17cc6993e2d..2ba72fbfced 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -27,9 +27,6 @@ Performance monitoring artifact for jetty. ${project.groupId}.jmx - ${project.build.directory}/test-wars - ${project.build.directory}/test-libs - ${project.build.directory}/test-dist diff --git a/jetty-monitor/src/main/resources/org/mortbay/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties b/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties similarity index 100% rename from jetty-monitor/src/main/resources/org/mortbay/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties rename to jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index f3d17b9e5e7..547acddf835 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -26,6 +26,11 @@ test-integration jar Jetty Tests :: Integrations + + ${project.build.directory}/test-wars + ${project.build.directory}/test-libs + ${project.build.directory}/test-dist + @@ -50,6 +55,34 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-jetty-distro + process-test-resources + + unpack + + + + + org.eclipse.jetty + jetty-distribution + ${project.version} + zip + true + + + true + ${test-dist-dir} + true + true + + + + @@ -73,6 +106,11 @@ jetty-client ${project.version} + + org.eclipse.jetty + jetty-monitor + ${project.version} + org.eclipse.jetty.toolchain jetty-test-helper diff --git a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JavaMonitorIntegrationTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JavaMonitorIntegrationTest.java similarity index 99% rename from jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JavaMonitorIntegrationTest.java rename to tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JavaMonitorIntegrationTest.java index 6213ce7aa27..9373224868c 100644 --- a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JavaMonitorIntegrationTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JavaMonitorIntegrationTest.java @@ -11,7 +11,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== -package org.eclipse.jetty.monitor; +package org.eclipse.jetty.test.monitor; import static org.junit.Assert.assertTrue; diff --git a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JmxServiceTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JmxServiceTest.java similarity index 99% rename from jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JmxServiceTest.java rename to tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JmxServiceTest.java index 994a24d715a..6525df6bae4 100644 --- a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/JmxServiceTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/JmxServiceTest.java @@ -11,7 +11,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== -package org.eclipse.jetty.monitor; +package org.eclipse.jetty.test.monitor; import static org.junit.Assert.assertTrue; diff --git a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/ProgramConfigTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/ProgramConfigTest.java similarity index 99% rename from jetty-monitor/src/test/java/org/eclipse/jetty/monitor/ProgramConfigTest.java rename to tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/ProgramConfigTest.java index b111a952a1c..20c170f0cef 100644 --- a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/ProgramConfigTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/ProgramConfigTest.java @@ -11,7 +11,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== -package org.eclipse.jetty.monitor; +package org.eclipse.jetty.test.monitor; import static org.junit.Assert.assertTrue; diff --git a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/XmlConfigTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/XmlConfigTest.java similarity index 99% rename from jetty-monitor/src/test/java/org/eclipse/jetty/monitor/XmlConfigTest.java rename to tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/XmlConfigTest.java index 612be3c135e..bff211f1dea 100644 --- a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/XmlConfigTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/monitor/XmlConfigTest.java @@ -11,7 +11,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== -package org.eclipse.jetty.monitor; +package org.eclipse.jetty.test.monitor; import static org.junit.Assert.assertTrue; diff --git a/jetty-monitor/src/test/resources/monitor/etc/jetty-jmx.xml b/tests/test-integration/src/test/resources/monitor/etc/jetty-jmx.xml similarity index 100% rename from jetty-monitor/src/test/resources/monitor/etc/jetty-jmx.xml rename to tests/test-integration/src/test/resources/monitor/etc/jetty-jmx.xml diff --git a/jetty-monitor/src/test/resources/monitor/start.ini b/tests/test-integration/src/test/resources/monitor/start.ini similarity index 100% rename from jetty-monitor/src/test/resources/monitor/start.ini rename to tests/test-integration/src/test/resources/monitor/start.ini diff --git a/jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/java-monitor-integration.xml b/tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/java-monitor-integration.xml similarity index 100% rename from jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/java-monitor-integration.xml rename to tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/java-monitor-integration.xml diff --git a/jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-service.xml b/tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-service.xml similarity index 100% rename from jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-service.xml rename to tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-service.xml diff --git a/jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-test.xml b/tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-test.xml similarity index 100% rename from jetty-monitor/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-test.xml rename to tests/test-integration/src/test/resources/org/eclipse/jetty/monitor/jetty-monitor-test.xml From 97ad4afb199eae8309b220c44a1b19bf9fb0724a Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 30 Aug 2011 10:47:16 +1000 Subject: [PATCH 10/16] Someone left a new Throwable().printStackTrace() in ContextHandler. Deleted it. --- .../java/org/eclipse/jetty/server/handler/ContextHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 0996c3e5f35..42feb615a0c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -676,7 +676,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. // Context listeners if (_contextListeners != null) { - new Throwable().printStackTrace(); ServletContextEvent event = new ServletContextEvent(_scontext); for (int i = LazyList.size(_contextListeners); i-- > 0;) { From 5a23e085edbd5fed5c6bb278fa9fd547001d5ff9 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 30 Aug 2011 11:25:50 +1000 Subject: [PATCH 11/16] 356137 - Upgrade to jsp implementation version 2.1.3-b10 --- jetty-distribution/pom.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 64d76518bd0..c4aacee9169 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -20,7 +20,8 @@ 2.1.0.v201004190952 1.2.0.v201004190952 1.0.0.v201004190952 - 2.1.0.v201007080150 + + 2.1.3-b10 1.2.0.v201004190952 3.1.0.v200803061910 1.1.1.v201004190952 @@ -76,7 +77,7 @@ - + @@ -544,6 +545,15 @@ ** ${assembly-directory}/lib/jsp + + org.glassfish.web + jsp-impl + ${central-jsp-version} + jar + true + ** + ${assembly-directory}/lib/jsp + @@ -663,5 +673,10 @@ jetty-jsp-2.1 ${project.version} + + org.glassfish.web + jsp-impl + ${central-jsp-version} + From 1ff02e56e2f8226b6c3af682718842e69ee4b4cf Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 30 Aug 2011 11:26:21 +1000 Subject: [PATCH 12/16] 356137 - Upgrade to jsp implementation version 2.1.3-b10 --- VERSION.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/VERSION.txt b/VERSION.txt index b00756bfbc4..9f1937baa10 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -5,6 +5,7 @@ jetty-7.5.0-SNAPSHOT + 353624 HttpURI accepts java.net.URI object in constructor + 354080 ServletContextHandler allows to replace any subordinate handler when restarted + 356128 Moved integration tests from jetty-monitor to test-integration module + + 356137 Upgrade to jsp implementation version 2.1.3-b10 jetty-7.5.0.RC1 - 19 August 2011 + 276670 SLF4J loggers show correct location information From 33fa7afb4715867b12fdf699becc68b319ad3830 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 Aug 2011 14:24:28 +1000 Subject: [PATCH 13/16] 356144 added SelectorManager.setSelectorPriorityDelta(int) --- .../eclipse/jetty/client/SelectConnector.java | 24 +--- .../eclipse/jetty/io/nio/SelectorManager.java | 132 +++++++++++++----- .../jetty/server/handler/ConnectHandler.java | 17 --- .../server/nio/SelectChannelConnector.java | 46 +----- .../util/component/AbstractLifeCycle.java | 5 + .../util/component/AggregateLifeCycle.java | 8 +- .../jetty/util/thread/QueuedThreadPool.java | 11 +- .../websocket/WebSocketClientFactory.java | 53 ++++--- 8 files changed, 143 insertions(+), 153 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index 89a3884ac37..333c4166ba4 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -41,7 +41,7 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.Timeout; -class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, Runnable +class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector { private static final Logger LOG = Log.getLogger(SelectConnector.class); @@ -65,7 +65,6 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, { super.doStart(); - _selectorManager.start(); final boolean direct=_httpClient.getUseDirectBuffers(); @@ -76,7 +75,7 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, direct?Type.DIRECT:Type.INDIRECT,ssl_session.getApplicationBufferSize(), direct?Type.DIRECT:Type.INDIRECT,1024); - _httpClient._threadPool.dispatch(this); + _selectorManager.start(); } /* ------------------------------------------------------------ */ @@ -117,25 +116,6 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, { destination.onConnectionFailed(ex); } - - } - - /* ------------------------------------------------------------ */ - public void run() - { - while (_httpClient.isRunning()) - { - try - { - _selectorManager.doSelect(0); - } - catch (Exception e) - { - LOG.warn(e.toString()); - LOG.debug(e); - Thread.yield(); - } - } } /* ------------------------------------------------------------ */ diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java index 91656afbb06..268e7b422eb 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java @@ -54,7 +54,7 @@ import org.eclipse.jetty.util.thread.Timeout.Task; */ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpable { - public static final Logger __log=Log.getLogger("org.eclipse.jetty.io.nio"); + public static final Logger LOG=Log.getLogger("org.eclipse.jetty.io.nio"); // TODO Tune these by approx system speed. private static final int __JVMBUG_THRESHHOLD=Integer.getInteger("org.eclipse.jetty.io.nio.JVMBUG_THRESHHOLD",0).intValue(); @@ -71,6 +71,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa private int _selectSets=1; private volatile int _set; private boolean _deferringInterestedOps0=true; + private int _selectorPriorityDelta=0; /* ------------------------------------------------------------ */ /** @@ -178,6 +179,25 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa set.wakeup(); } + /* ------------------------------------------------------------ */ + /** + * @return delta The value to add to the selector thread priority. + */ + public int getSelectorPriorityDelta() + { + return _selectorPriorityDelta; + } + + /* ------------------------------------------------------------ */ + /** Set the selector thread priorty delta. + * @param delta The value to add to the selector thread priority. + */ + public void setSelectorPriorityDelta(int delta) + { + _selectorPriorityDelta=delta; + } + + /* ------------------------------------------------------------ */ /** * @return the lowResourcesConnections @@ -218,17 +238,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa _lowResourcesMaxIdleTime=(int)lowResourcesMaxIdleTime; } - /* ------------------------------------------------------------ */ - /** - * @param acceptorID - * @throws IOException - */ - public void doSelect(int acceptorID) throws IOException - { - SelectSet[] sets= _selectSet; - if (sets!=null && sets.length>acceptorID && sets[acceptorID]!=null) - sets[acceptorID].doSelect(); - } /* ------------------------------------------------------------------------------- */ public abstract boolean dispatch(Runnable task); @@ -245,6 +254,53 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa _selectSet[i]= new SelectSet(i); super.doStart(); + + // start a thread to Select + for (int i=0;i_log) { if (_paused>0) - __log.debug(this+" Busy selector - injecting delay "+_paused+" times"); + LOG.debug(this+" Busy selector - injecting delay "+_paused+" times"); if (_jvmFix2>0) - __log.debug(this+" JVM BUG(s) - injecting delay"+_jvmFix2+" times"); + LOG.debug(this+" JVM BUG(s) - injecting delay"+_jvmFix2+" times"); if (_jvmFix1>0) - __log.debug(this+" JVM BUG(s) - recreating selector "+_jvmFix1+" times, cancelled keys "+_jvmFix0+" times"); + LOG.debug(this+" JVM BUG(s) - recreating selector "+_jvmFix1+" times, cancelled keys "+_jvmFix0+" times"); - else if(__log.isDebugEnabled() && _jvmFix0>0) - __log.debug(this+" JVM BUG(s) - cancelled keys "+_jvmFix0+" times"); + else if(LOG.isDebugEnabled() && _jvmFix0>0) + LOG.debug(this+" JVM BUG(s) - cancelled keys "+_jvmFix0+" times"); _paused=0; _jvmFix2=0; _jvmFix1=0; @@ -720,7 +776,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch(InterruptedException e) { - __log.ignore(e); + LOG.ignore(e); } } else if (_jvmBug==__JVMBUG_THRESHHOLD) @@ -754,7 +810,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa if (++_busyKeyCount>__BUSY_KEY && !(busy.channel() instanceof ServerSocketChannel)) { final SelectChannelEndPoint endpoint = (SelectChannelEndPoint)busy.attachment(); - __log.warn("Busy Key "+busy.channel()+" "+endpoint); + LOG.warn("Busy Key "+busy.channel()+" "+endpoint); busy.cancel(); if (endpoint!=null) { @@ -768,7 +824,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch (IOException e) { - __log.ignore(e); + LOG.ignore(e); } } }); @@ -907,7 +963,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch(Exception e) { - __log.ignore(e); + LOG.ignore(e); } // close endpoints and selector @@ -927,7 +983,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch(IOException e) { - __log.ignore(e); + LOG.ignore(e); } } } @@ -941,7 +997,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch (IOException e) { - __log.ignore(e); + LOG.ignore(e); } _selector=null; } @@ -992,7 +1048,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } catch(InterruptedException e) { - __log.ignore(e); + LOG.ignore(e); } AggregateLifeCycle.dump(out,indent,dump); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java index 6f71abb9af8..47c086b0170 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java @@ -153,23 +153,6 @@ public class ConnectHandler extends HandlerWrapper ((LifeCycle)_threadPool).start(); _selectorManager.start(); - _threadPool.dispatch(new Runnable() - { - public void run() - { - while (isRunning()) - { - try - { - _selectorManager.doSelect(0); - } - catch (IOException x) - { - _logger.warn("Unexpected exception", x); - } - } - } - }); } @Override diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java index 70fb8d06ad0..c8cff99341c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java @@ -36,6 +36,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.thread.ThreadPool; import org.eclipse.jetty.util.thread.Timeout.Task; /* ------------------------------------------------------------------------------- */ @@ -241,46 +242,6 @@ public class SelectChannelConnector extends AbstractNIOConnector _manager.start(); super.doStart(); - - // start a thread to Select - for (int i=0;i _dependentBeans=new ConcurrentLinkedQueue(); + private final List _dependentBeans=new CopyOnWriteArrayList(); public void destroy() { @@ -49,7 +51,9 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable protected void doStop() throws Exception { super.doStop(); - for (Object o:_dependentBeans) + List reverse = new ArrayList(_dependentBeans); + Collections.reverse(reverse); + for (Object o:reverse) { if (o instanceof LifeCycle) ((LifeCycle)o).stop(); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java index 466082df6de..5c54999a032 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java @@ -139,14 +139,14 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo { LOG.warn(size+" threads could not be stopped"); - if (LOG.isDebugEnabled()) + if (size==1 || LOG.isDebugEnabled()) { for (Thread unstopped : _threads) { - LOG.debug("Couldn't stop "+unstopped); + LOG.info("Couldn't stop "+unstopped); for (StackTraceElement element : unstopped.getStackTrace()) { - LOG.debug(" at "+element); + LOG.info(" at "+element); } } } @@ -507,9 +507,10 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo @Override public String toString() { - return _name+"{"+getMinThreads()+"<="+getIdleThreads()+"<="+getThreads()+"/"+getMaxThreads()+","+(_jobs==null?-1:_jobs.size())+"}"; + return _name+"{"+getMinThreads()+"<="+getIdleThreads()+"<="+getThreads()+"/"+getMaxThreads()+","+(_jobs==null?-1:_jobs.size())+"}#"+getState(); } - + + /* ------------------------------------------------------------ */ private Runnable idleJobPoll() throws InterruptedException { return _jobs.poll(_maxIdleTimeMs,TimeUnit.MILLISECONDS); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 45d6d1d0ffd..fbd8117ba85 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -31,7 +31,8 @@ import org.eclipse.jetty.util.thread.ThreadPool; *

WebSocketClientFactory contains the common components needed by multiple {@link WebSocketClient} instances * (for example, a {@link ThreadPool}, a {@link SelectorManager NIO selector}, etc).

*

WebSocketClients with different configurations should share the same factory to avoid to waste resources.

- * + *

If a ThreadPool or MaskGen is passed in the constructor, then it is not added with {@link AggregateLifeCycle#addBean(Object)}, + * so it's lifecycle must be controlled externally. * @see WebSocketClient */ public class WebSocketClientFactory extends AggregateLifeCycle @@ -51,7 +52,14 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory() { - this(new QueuedThreadPool()); + _threadPool=new QueuedThreadPool(); + addBean(_threadPool); + _buffers=new WebSocketBuffers(8*1024); + addBean(_buffers); + _maskGen=new RandomMaskGen(); + addBean(_maskGen); + _selector=new WebSocketClientSelector(); + addBean(_selector); } /* ------------------------------------------------------------ */ @@ -61,7 +69,14 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory(ThreadPool threadPool) { - this(threadPool,new RandomMaskGen(),16*1024); + _threadPool=threadPool; + addBean(threadPool); + _buffers=new WebSocketBuffers(8*1024); + addBean(_buffers); + _maskGen=new RandomMaskGen(); + addBean(_maskGen); + _selector=new WebSocketClientSelector(); + addBean(_selector); } /* ------------------------------------------------------------ */ @@ -74,11 +89,12 @@ public class WebSocketClientFactory extends AggregateLifeCycle public WebSocketClientFactory(ThreadPool threadPool,MaskGen maskGen,int bufferSize) { _threadPool=threadPool; - _selector=new WebSocketClientSelector(); + addBean(threadPool); _buffers=new WebSocketBuffers(bufferSize); + addBean(_buffers); _maskGen=maskGen; + _selector=new WebSocketClientSelector(); addBean(_selector); - addBean(_threadPool); } /* ------------------------------------------------------------ */ @@ -120,6 +136,8 @@ public class WebSocketClientFactory extends AggregateLifeCycle { if (isRunning()) throw new IllegalStateException(getState()); + if (removeBean(_maskGen)) + addBean(maskGen); _maskGen=maskGen; } @@ -132,7 +150,9 @@ public class WebSocketClientFactory extends AggregateLifeCycle { if (isRunning()) throw new IllegalStateException(getState()); + removeBean(_buffers); _buffers=new WebSocketBuffers(bufferSize); + addBean(_buffers); } /* ------------------------------------------------------------ */ @@ -161,29 +181,6 @@ public class WebSocketClientFactory extends AggregateLifeCycle protected void doStart() throws Exception { super.doStart(); - - // Start a selector threads - for (int i=0;i<_selector.getSelectSets();i++) - { - final int id=i; - _threadPool.dispatch(new Runnable() - { - public void run() - { - while(isRunning()) - { - try - { - _selector.doSelect(id); - } - catch (IOException e) - { - __log.warn(e); - } - } - } - }); - } } /* ------------------------------------------------------------ */ From 45148353ec0064d970dbc2ab43c68a9bf8e64864 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 Aug 2011 16:05:21 +1000 Subject: [PATCH 14/16] 293739 Hide stacks in named log testing. Various other minor log cleanups in output. --- .../AbstractHttpExchangeCancelTest.java | 5 ++- .../jetty/client/ProxyFakeTunnelTest.java | 39 ++++++++++--------- .../eclipse/jetty/io/nio/SelectorManager.java | 8 +++- .../server/session/JDBCSessionIdManager.java | 37 ++++++++++-------- .../jetty/server/HttpConnectionTest.java | 13 ++----- .../org/eclipse/jetty/server/RFC2616Test.java | 3 -- .../java/org/eclipse/jetty/util/log/Log.java | 7 +--- .../org/eclipse/jetty/util/log/StdErrLog.java | 11 +++++- .../util/component/LifeCycleListenerTest.java | 31 ++++++++------- .../eclipse/jetty/util/log/StdErrLogTest.java | 31 ++++++++++++--- 10 files changed, 108 insertions(+), 77 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java index a879bddf131..cb5812780a2 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnection; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; @@ -322,7 +323,7 @@ public abstract class AbstractHttpExchangeCancelTest { try { - ((StdErrLog)Log.getLog()).setHideStacks(!LOG.isDebugEnabled()); + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true); TestHttpExchange exchange = new TestHttpExchange(); exchange.setAddress(newAddress()); exchange.setRequestURI("/?action=throw"); @@ -337,7 +338,7 @@ public abstract class AbstractHttpExchangeCancelTest } finally { - ((StdErrLog)Log.getLog()).setHideStacks(false); + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false); } } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyFakeTunnelTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyFakeTunnelTest.java index bccfb13620e..1d09edc80ad 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyFakeTunnelTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyFakeTunnelTest.java @@ -139,36 +139,37 @@ public class ProxyFakeTunnelTest extends ProxyTunnellingTest } out.flush(); - System.err.println(toserver); - final InputStream from = toserver.getInputStream(); - - Thread copy = new Thread() + if (toserver!=null) { - public void run() + final InputStream from = toserver.getInputStream(); + + Thread copy = new Thread() { - try - { - IO.copy(from,out); - out.close(); - } - catch (IOException e) - { - } - finally + public void run() { try { + IO.copy(from,out); out.close(); } catch (IOException e) { } + finally + { + try + { + out.close(); + } + catch (IOException e) + { + } + } } - } - }; - copy.setDaemon(true); - copy.start(); - + }; + copy.setDaemon(true); + copy.start(); + } } else diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java index 268e7b422eb..9ca19c3956e 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java @@ -263,14 +263,19 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa { public void run() { - SelectSet set=_selectSet[id]; String name=Thread.currentThread().getName(); int priority=Thread.currentThread().getPriority(); try { + SelectSet[] sets=_selectSet; + if (sets==null) + return; + SelectSet set=sets[id]; + Thread.currentThread().setName(name+" Selector"+id); if (getSelectorPriorityDelta()!=0) Thread.currentThread().setPriority(Thread.currentThread().getPriority()+getSelectorPriorityDelta()); + LOG.debug("Starting {} on {}",Thread.currentThread(),this); while (isRunning()) { try @@ -293,6 +298,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa } finally { + LOG.debug("Stopped {} on {}",Thread.currentThread(),this); Thread.currentThread().setName(name); if (getSelectorPriorityDelta()!=0) Thread.currentThread().setPriority(priority); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java index 4493c5bbc32..8e73f3af1d0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java @@ -52,7 +52,7 @@ import org.eclipse.jetty.util.log.Logger; */ public class JDBCSessionIdManager extends AbstractSessionIdManager { - final static Logger __log = SessionHandler.__log; + final static Logger LOG = SessionHandler.__log; protected final HashSet _sessionIds = new HashSet(); protected Server _server; @@ -106,7 +106,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager throws SQLException { _dbName = dbMeta.getDatabaseProductName().toLowerCase(); - __log.debug ("Using database "+_dbName); + LOG.debug ("Using database "+_dbName); _isLower = dbMeta.storesLowerCaseIdentifiers(); _isUpper = dbMeta.storesUpperCaseIdentifiers(); } @@ -230,7 +230,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager if ((System.currentTimeMillis()%2) == 0) _scavengeIntervalMs += tenPercent; - if (__log.isDebugEnabled()) __log.debug("Scavenging every "+_scavengeIntervalMs+" ms"); + if (LOG.isDebugEnabled()) LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms"); if (_timer!=null && (period!=old_period || _task==null)) { synchronized (this) @@ -271,7 +271,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } catch (Exception e) { - __log.warn("Problem storing session id="+id, e); + LOG.warn("Problem storing session id="+id, e); } } } @@ -294,8 +294,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager synchronized (_sessionIds) { - if (__log.isDebugEnabled()) - __log.debug("Removing session id="+id); + if (LOG.isDebugEnabled()) + LOG.debug("Removing session id="+id); try { _sessionIds.remove(id); @@ -303,7 +303,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } catch (Exception e) { - __log.warn("Problem removing session id="+id, e); + LOG.warn("Problem removing session id="+id, e); } } @@ -358,7 +358,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } catch (Exception e) { - __log.warn("Problem checking inUse for id="+clusterId, e); + LOG.warn("Problem checking inUse for id="+clusterId, e); return false; } } @@ -409,13 +409,13 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager initializeDatabase(); prepareTables(); super.doStart(); - if (__log.isDebugEnabled()) __log.debug("Scavenging interval = "+getScavengeInterval()+" sec"); + if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); _timer=new Timer("JDBCSessionScavenger", true); setScavengeInterval(getScavengeInterval()); } catch (Exception e) { - __log.warn("Problem initialising JettySessionIds table", e); + LOG.warn("Problem initialising JettySessionIds table", e); } } @@ -652,7 +652,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager List expiredSessionIds = new ArrayList(); try { - if (__log.isDebugEnabled()) __log.debug("Scavenge sweep started at "+System.currentTimeMillis()); + if (LOG.isDebugEnabled()) LOG.debug("Scavenge sweep started at "+System.currentTimeMillis()); if (_lastScavengeTime > 0) { connection = getConnection(); @@ -661,7 +661,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager PreparedStatement statement = connection.prepareStatement(_selectExpiredSessions); long lowerBound = (_lastScavengeTime - _scavengeIntervalMs); long upperBound = _lastScavengeTime; - if (__log.isDebugEnabled()) __log.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound); + if (LOG.isDebugEnabled()) LOG.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound); statement.setLong(1, lowerBound); statement.setLong(2, upperBound); @@ -670,7 +670,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager { String sessionId = result.getString("sessionId"); expiredSessionIds.add(sessionId); - if (__log.isDebugEnabled()) __log.debug (" Found expired sessionId="+sessionId); + if (LOG.isDebugEnabled()) LOG.debug (" Found expired sessionId="+sessionId); } //tell the SessionManagers to expire any sessions with a matching sessionId in memory @@ -693,7 +693,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager upperBound = _lastScavengeTime - (2 * _scavengeIntervalMs); if (upperBound > 0) { - if (__log.isDebugEnabled()) __log.debug("Deleting old expired sessions expired before "+upperBound); + if (LOG.isDebugEnabled()) LOG.debug("Deleting old expired sessions expired before "+upperBound); statement = connection.prepareStatement(_deleteOldExpiredSessions); statement.setLong(1, upperBound); statement.executeUpdate(); @@ -702,12 +702,15 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } catch (Exception e) { - __log.warn("Problem selecting expired sessions", e); + if (isRunning()) + LOG.warn("Problem selecting expired sessions", e); + else + LOG.ignore(e); } finally { _lastScavengeTime=System.currentTimeMillis(); - if (__log.isDebugEnabled()) __log.debug("Scavenge sweep ended at "+_lastScavengeTime); + if (LOG.isDebugEnabled()) LOG.debug("Scavenge sweep ended at "+_lastScavengeTime); if (connection != null) { try @@ -716,7 +719,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } catch (SQLException e) { - __log.warn(e); + LOG.warn(e); } } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java index 6201da68a39..55cecada02e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java @@ -155,7 +155,7 @@ public class HttpConnectionTest { try { - ((StdErrLog)Log.getLog()).setHideStacks(true); + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true); String response; @@ -186,7 +186,7 @@ public class HttpConnectionTest } finally { - ((StdErrLog)Log.getLog()).setHideStacks(false); + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false); } } @@ -336,11 +336,7 @@ public class HttpConnectionTest Logger logger=null; try { - if (!LOG.isDebugEnabled()) - { - logger=Log.getLog(); - Log.setLog(null); - } + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true); response=connector.getResponses(requests); offset = checkContains(response,offset,"HTTP/1.1 500"); offset = checkContains(response,offset,"Connection: close"); @@ -348,8 +344,7 @@ public class HttpConnectionTest } finally { - if (logger!=null) - Log.setLog(logger); + ((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false); } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RFC2616Test.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RFC2616Test.java index 33b5564fa45..5492ac5a437 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RFC2616Test.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RFC2616Test.java @@ -385,7 +385,6 @@ public class RFC2616Test String response; int offset=0; // Expect 100 not sent - ((StdErrLog)Log.getLog()).setHideStacks(true); offset=0; response=connector.getResponses("GET /R1?error=401 HTTP/1.1\n"+ @@ -397,8 +396,6 @@ public class RFC2616Test checkNotContained(response,offset,"HTTP/1.1 100","8.2.3 expect 100"); offset=checkContains(response,offset,"HTTP/1.1 401 ","8.2.3 expect 100")+1; offset=checkContains(response,offset,"Connection: close","8.2.3 expect 100")+1; - - ((StdErrLog)Log.getLog()).setHideStacks(false); } @Test diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index 5e74ac5f767..400805b55f3 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -38,7 +38,7 @@ import org.eclipse.jetty.util.Loader; public class Log { public final static String EXCEPTION= "EXCEPTION "; - public final static String IGNORED= "IGNORED"; + public final static String IGNORED= "IGNORED "; public static String __logClass; public static boolean __ignored; @@ -233,10 +233,7 @@ public class Log { if (!initialized()) return; - if (__ignored) - { - __log.warn(IGNORED, thrown); - } + __log.ignore(thrown); } /** diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java index 95d77c76f8c..7fd81d823a7 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java @@ -309,7 +309,12 @@ public class StdErrLog implements Logger private void format(StringBuilder builder, String msg, Object... args) { - msg = String.valueOf(msg); // Avoids NPE + if (msg==null) + { + msg=""; + for (Object o : args) + msg+="{} "; + } String braces = "{}"; int start = 0; for (Object arg : args) @@ -412,5 +417,9 @@ public class StdErrLog implements Logger { warn(Log.IGNORED, ignored); } + else + { + debug("Ignored {}",ignored.toString()); + } } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerTest.java index 9bc149c1f55..f45463b5196 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerTest.java @@ -32,11 +32,13 @@ public class LifeCycleListenerTest TestLifeCycle lifecycle = new TestLifeCycle(); TestListener listener = new TestListener(); lifecycle.addLifeCycleListener(listener); - ((StdErrLog)Log.getLog()).setHideStacks(true); + + lifecycle.setCause(cause); - + try { + ((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true); lifecycle.start(); assertTrue(false); } @@ -45,10 +47,14 @@ public class LifeCycleListenerTest assertEquals(cause,e); assertEquals(cause,listener.getCause()); } + finally + { + ((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(false); + } lifecycle.setCause(null); ((StdErrLog)Log.getLog()).setHideStacks(false); - - + + lifecycle.start(); // check that the starting event has been thrown @@ -62,6 +68,7 @@ public class LifeCycleListenerTest // check that the lifecycle's state is started assertTrue("The lifecycle state is not started",lifecycle.isStarted()); + } @Test @@ -77,12 +84,11 @@ public class LifeCycleListenerTest // stop() will return without doing anything lifecycle.start(); - - ((StdErrLog)Log.getLog()).setHideStacks(true); lifecycle.setCause(cause); try { + ((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true); lifecycle.stop(); assertTrue(false); } @@ -91,10 +97,12 @@ public class LifeCycleListenerTest assertEquals(cause,e); assertEquals(cause,listener.getCause()); } + finally + { + ((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(false); + } - lifecycle.setCause(null); - ((StdErrLog)Log.getLog()).setHideStacks(false); lifecycle.stop(); @@ -117,22 +125,15 @@ public class LifeCycleListenerTest public void testRemoveLifecycleListener () throws Exception { - - TestLifeCycle lifecycle = new TestLifeCycle(); TestListener listener = new TestListener(); lifecycle.addLifeCycleListener(listener); lifecycle.start(); - ((StdErrLog)Log.getLog()).setHideStacks(true); assertTrue("The starting event didn't occur",listener.starting); lifecycle.removeLifeCycleListener(listener); lifecycle.stop(); assertFalse("The stopping event occurred", listener.stopping); - - - - } private class TestLifeCycle extends AbstractLifeCycle { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java index b83f536017c..017816bdf25 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java @@ -27,29 +27,32 @@ public class StdErrLogTest extends TestCase log.setHideStacks(true); try { + log.info("Testing info(msg,null,null) - {} {}","arg0","arg1"); log.info("Testing info(msg,null,null) - {} {}",null,null); log.info("Testing info(msg,null,null) - {}",null,null); log.info("Testing info(msg,null,null)",null,null); - log.info(null,"- Testing","info(null,arg0,arg1)"); + log.info(null,"Testing","info(null,arg0,arg1)"); log.info(null,null,null); + log.debug("Testing debug(msg,null,null) - {} {}","arg0","arg1"); log.debug("Testing debug(msg,null,null) - {} {}",null,null); log.debug("Testing debug(msg,null,null) - {}",null,null); log.debug("Testing debug(msg,null,null)",null,null); - log.debug(null,"- Testing","debug(null,arg0,arg1)"); + log.debug(null,"Testing","debug(null,arg0,arg1)"); log.debug(null,null,null); log.debug("Testing debug(msg,null)"); - log.debug(null,new Throwable("IGNORE::Testing debug(null,thrw)").fillInStackTrace()); + log.debug(null,new Throwable("Testing debug(null,thrw)").fillInStackTrace()); + log.warn("Testing warn(msg,null,null) - {} {}","arg0","arg1"); log.warn("Testing warn(msg,null,null) - {} {}",null,null); log.warn("Testing warn(msg,null,null) - {}",null,null); log.warn("Testing warn(msg,null,null)",null,null); - log.warn(null,"- Testing","warn(msg,arg0,arg1)"); + log.warn(null,"Testing","warn(msg,arg0,arg1)"); log.warn(null,null,null); log.warn("Testing warn(msg,null)"); - log.warn(null,new Throwable("IGNORE::Testing warn(msg,thrw)").fillInStackTrace()); + log.warn(null,new Throwable("Testing warn(msg,thrw)").fillInStackTrace()); } catch (NullPointerException npe) { @@ -58,4 +61,22 @@ public class StdErrLogTest extends TestCase assertTrue("NullPointerException in StdErrLog.", false); } } + + public void testIgnores() + { + StdErrLog log = new StdErrLog(StdErrLogTest.class.getName()); + log.setHideStacks(true); + + Log.__ignored=false; + log.setDebugEnabled(false); + log.ignore(new Throwable("IGNORE ME")); + + Log.__ignored=true; + log.setDebugEnabled(false); + log.ignore(new Throwable("Don't ignore me")); + + Log.__ignored=false; + log.setDebugEnabled(true); + log.ignore(new Throwable("Debug me")); + } } From 139dd9fa66fcc57e170f5720b95af993c52cefe6 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 Aug 2011 19:23:17 +1000 Subject: [PATCH 15/16] start websocket client factory thread pool --- .../org/eclipse/jetty/websocket/WebSocketClientFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index fbd8117ba85..7861e96d9fb 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -21,6 +21,7 @@ import org.eclipse.jetty.io.nio.SelectorManager; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.component.AggregateLifeCycle; +import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.ThreadPool; @@ -181,6 +182,8 @@ public class WebSocketClientFactory extends AggregateLifeCycle protected void doStart() throws Exception { super.doStart(); + if (getThreadPool() instanceof LifeCycle && !((LifeCycle)getThreadPool()).isStarted()) + ((LifeCycle)getThreadPool()).start(); } /* ------------------------------------------------------------ */ From 0d17559f7d6c6c42933ded8d97a74b6d1cf68155 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 Aug 2011 23:37:41 +1000 Subject: [PATCH 16/16] handle -1 maxIdleTime as disabled timeout --- .../java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java | 2 +- .../org/eclipse/jetty/websocket/WebSocketConnectionD12.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java index cbfd9b0b703..fd5413ff3e0 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @@ -250,7 +250,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo public void checkIdleTimestamp(long now) { long idleTimestamp=_idleTimestamp; - if (idleTimestamp!=0 && _maxIdleTime!=0 && now>(idleTimestamp+_maxIdleTime)) + if (idleTimestamp!=0 && _maxIdleTime>0 && now>(idleTimestamp+_maxIdleTime)) idleExpired(); } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java index 8ae6afae084..26e9d3b0a88 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD12.java @@ -134,7 +134,6 @@ public class WebSocketConnectionD12 extends AbstractConnection implements WebSoc _context=Thread.currentThread().getContextClassLoader(); - // TODO - can we use the endpoint idle mechanism? if (endpoint instanceof AsyncEndPoint) ((AsyncEndPoint)endpoint).cancelIdle();