changeset 958:fc521d2f098e

simplify SelectorManager
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Oct 2016 18:48:20 -0600
parents d6b6d3e40161
children 7b94f5b33c64
files src/org/eclipse/jetty/io/nio/ChannelEndPoint.java src/org/eclipse/jetty/io/nio/SelectorManager.java src/org/eclipse/jetty/server/nio/SelectChannelConnector.java
diffstat 3 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Oct 13 18:29:36 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Oct 13 18:48:20 2016 -0600
@@ -475,10 +475,6 @@
 		return _remote==null?-1:_remote.getPort();
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see org.eclipse.io.EndPoint#getConnection()
-	 */
 	public Object getTransport()
 	{
 		return _channel;
--- a/src/org/eclipse/jetty/io/nio/SelectorManager.java	Thu Oct 13 18:29:36 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SelectorManager.java	Thu Oct 13 18:48:20 2016 -0600
@@ -174,7 +174,7 @@
 		super.doStop();
 	}
 
-	public abstract AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint, Object attachment);
+	public abstract AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint);
 
 	public String dump()
 	{
@@ -194,7 +194,7 @@
 
 		private final SaneSelector _selector;
 
-		SelectSet() throws IOException
+		private SelectSet() throws IOException
 		{
 			_selector = new SaneSelector();
 		}
@@ -205,7 +205,10 @@
 //System.out.println("qqqqqqqqqqqqqqqqqqqqqqqqqqqqq a");
 //				SelectionKey key = _selector.register(channel,SelectionKey.OP_READ,null);
 				SelectionKey key = _selector.register(channel,0,null);
-				SelectChannelEndPoint endpoint = createEndPoint(channel,key);
+
+				SelectChannelEndPoint endpoint = new SelectChannelEndPoint(channel,this,key, _maxIdleTime);
+				endpoint.setConnection(newConnection(channel,endpoint));
+
 				key.attach(endpoint);
 				key.interestOps(SelectionKey.OP_READ);
 				_selector.update();
@@ -287,14 +290,6 @@
 			return _now;
 		}
 
-		private SelectChannelEndPoint createEndPoint(SocketChannel channel, SelectionKey sKey) throws IOException
-		{
-			SelectChannelEndPoint endp = new SelectChannelEndPoint(channel,this,sKey, _maxIdleTime);
-			endp.setConnection(getManager().newConnection(channel,endp, sKey.attachment()));
-			LOG.debug("created {}",endp);
-			return endp;
-		}
-
 		public void destroyEndPoint(SelectChannelEndPoint endp)
 		{
 			LOG.debug("destroyEndPoint {}",endp);
--- a/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Thu Oct 13 18:29:36 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Thu Oct 13 18:48:20 2016 -0600
@@ -127,7 +127,7 @@
 		}
 
 		@Override
-		public AsyncConnection newConnection(SocketChannel channel,SelectChannelEndPoint endpoint, Object attachment)
+		public AsyncConnection newConnection(SocketChannel channel,SelectChannelEndPoint endpoint)
 		{
 			return SelectChannelConnector.this.newConnection(channel,endpoint);
 		}