changeset 905:e7175965e6cf

remove Connector._acceptorThreads
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 07 Oct 2016 00:59:18 -0600
parents 5d9b213aaed0
children eaf271fb747f
files src/org/eclipse/jetty/server/Connector.java
diffstat 1 files changed, 7 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
diff -r 5d9b213aaed0 -r e7175965e6cf src/org/eclipse/jetty/server/Connector.java
--- a/src/org/eclipse/jetty/server/Connector.java	Fri Oct 07 00:28:38 2016 -0600
+++ b/src/org/eclipse/jetty/server/Connector.java	Fri Oct 07 00:59:18 2016 -0600
@@ -68,8 +68,6 @@
 	protected int _lowResourceMaxIdleTime = -1;
 	protected int _soLingerTime = -1;
 
-	private transient Thread[] _acceptorThreads;
-
 	protected final HttpBuffersImpl _buffers = new HttpBuffersImpl();
 
 	public Connector(Server server,int port) {
@@ -221,16 +219,11 @@
 		super.doStart();
 
 		// Start selector thread
-		synchronized (this)
-		{
-			_acceptorThreads = new Thread[getAcceptors()];
-
-			ThreadPoolExecutor _threadPool = server.threadPool;
-			for (int i = 0; i < _acceptorThreads.length; i++)
-				_threadPool.execute(new Acceptor(i));
-			if (server.isLowOnThreads())
-				LOG.warn("insufficient threads configured for {}",this);
-		}
+		ThreadPoolExecutor _threadPool = server.threadPool;
+		for (int i = 0; i < _acceptors; i++)
+			_threadPool.execute(new Acceptor(i));
+		if (server.isLowOnThreads())
+			LOG.warn("insufficient threads configured for {}",this);
 
 		LOG.info("Started {}",this);
 	}
@@ -249,36 +242,8 @@
 		}
 
 		super.doStop();
-
-		Thread[] acceptors;
-		synchronized (this)
-		{
-			acceptors = _acceptorThreads;
-			_acceptorThreads = null;
-		}
-		if (acceptors != null)
-		{
-			for (Thread thread : acceptors)
-			{
-				if (thread != null)
-					thread.interrupt();
-			}
-		}
 	}
 
-	/* ------------------------------------------------------------ */
-	public void join() throws InterruptedException
-	{
-		Thread[] threads;
-		synchronized(this)
-		{
-			threads=_acceptorThreads;
-		}
-		if (threads != null)
-			for (Thread thread : threads)
-				if (thread != null)
-					thread.join();
-	}
 
 	/* ------------------------------------------------------------ */
 	protected void configure(Socket socket) throws IOException
@@ -433,16 +398,8 @@
 		public void run()
 		{
 			Thread current = Thread.currentThread();
-			String name;
-			synchronized (Connector.this)
-			{
-				if (_acceptorThreads == null)
-					return;
-
-				_acceptorThreads[_acceptor] = current;
-				name = _acceptorThreads[_acceptor].getName();
-				current.setName(name + " Acceptor" + _acceptor + " " + Connector.this);
-			}
+			String name = current.getName();
+			current.setName(name + " Acceptor" + _acceptor + " " + Connector.this);
 
 			try
 			{
@@ -474,12 +431,6 @@
 			finally
 			{
 				current.setName(name);
-
-				synchronized (Connector.this)
-				{
-					if (_acceptorThreads != null)
-						_acceptorThreads[_acceptor] = null;
-				}
 			}
 		}
 	}