diff src/org/eclipse/jetty/io/nio/SelectorManager.java @ 958:fc521d2f098e

simplify SelectorManager
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Oct 2016 18:48:20 -0600
parents d6b6d3e40161
children 7b94f5b33c64
line wrap: on
line diff
--- 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);