changeset 906:eaf271fb747f

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 07 Oct 2016 03:59:44 -0600
parents e7175965e6cf
children bc4e299de953
files src/org/eclipse/jetty/server/Connector.java src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java src/org/eclipse/jetty/server/nio/SelectChannelConnector.java
diffstat 3 files changed, 11 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
diff -r e7175965e6cf -r eaf271fb747f src/org/eclipse/jetty/server/Connector.java
--- a/src/org/eclipse/jetty/server/Connector.java	Fri Oct 07 00:59:18 2016 -0600
+++ b/src/org/eclipse/jetty/server/Connector.java	Fri Oct 07 03:59:44 2016 -0600
@@ -221,7 +221,7 @@
 		// Start selector thread
 		ThreadPoolExecutor _threadPool = server.threadPool;
 		for (int i = 0; i < _acceptors; i++)
-			_threadPool.execute(new Acceptor(i));
+			_threadPool.execute(new Acceptor());
 		if (server.isLowOnThreads())
 			LOG.warn("insufficient threads configured for {}",this);
 
@@ -280,7 +280,7 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	protected abstract void accept(int acceptorID) throws IOException, InterruptedException;
+	protected abstract void accept() throws IOException, InterruptedException;
 
 	/* ------------------------------------------------------------ */
 	public void stopAccept(int acceptorID) throws Exception
@@ -387,19 +387,12 @@
 	/* ------------------------------------------------------------ */
 	private class Acceptor implements Runnable
 	{
-		int _acceptor = 0;
 
-		Acceptor(int id)
-		{
-			_acceptor = id;
-		}
-
-		/* ------------------------------------------------------------ */
 		public void run()
 		{
 			Thread current = Thread.currentThread();
 			String name = current.getName();
-			current.setName(name + " Acceptor" + _acceptor + " " + Connector.this);
+			current.setName(name + " Acceptor" + " " + Connector.this);
 
 			try
 			{
@@ -407,7 +400,7 @@
 				{
 					try
 					{
-						accept(_acceptor);
+						accept();
 					}
 					catch (EofException e)
 					{
diff -r e7175965e6cf -r eaf271fb747f src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java
--- a/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Fri Oct 07 00:59:18 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Fri Oct 07 03:59:44 2016 -0600
@@ -55,7 +55,7 @@
  *
  *
  */
-public class BlockingChannelConnector extends AbstractNIOConnector
+public final class BlockingChannelConnector extends AbstractNIOConnector
 {
 	private static final Logger LOG = LoggerFactory.getLogger(BlockingChannelConnector.class);
 
@@ -127,7 +127,7 @@
 
 		// Bind the server socket to the local host and port
 		InetSocketAddress addr = getHost()==null?new InetSocketAddress(port):new InetSocketAddress(getHost(),port);
-		_acceptChannel.socket().bind(addr,0);
+		_acceptChannel.socket().bind(addr);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -140,7 +140,7 @@
 
 	/* ------------------------------------------------------------ */
 	@Override
-	public void accept(int acceptorID)
+	public void accept()
 		throws IOException, InterruptedException
 	{
 		SocketChannel channel = _acceptChannel.accept();
diff -r e7175965e6cf -r eaf271fb747f src/org/eclipse/jetty/server/nio/SelectChannelConnector.java
--- a/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Fri Oct 07 00:59:18 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Fri Oct 07 03:59:44 2016 -0600
@@ -66,7 +66,7 @@
  */
 public class SelectChannelConnector extends AbstractNIOConnector
 {
-	protected ServerSocketChannel _acceptChannel;
+	private transient ServerSocketChannel _acceptChannel;
 	private int _lowResourcesConnections;
 	private int _lowResourcesMaxIdleTime;
 	private int _localPort=-1;
@@ -88,13 +88,9 @@
 	
 	/* ------------------------------------------------------------ */
 	@Override
-	public void accept(int acceptorID) throws IOException
+	public final void accept() throws IOException
 	{
-		ServerSocketChannel server;
-		synchronized(this)
-		{
-			server = _acceptChannel;
-		}
+		ServerSocketChannel server = _acceptChannel;
 
 		if (server!=null && server.isOpen() && _manager.isStarted())
 		{
@@ -176,7 +172,7 @@
 				// Bind the server socket to the local host and port
 				_acceptChannel.socket().setReuseAddress(true);
 				InetSocketAddress addr = getHost()==null?new InetSocketAddress(port):new InetSocketAddress(getHost(),port);
-				_acceptChannel.socket().bind(addr,0);
+				_acceptChannel.socket().bind(addr);
 
 				_localPort=_acceptChannel.socket().getLocalPort();
 				if (_localPort<=0)