diff src/org/eclipse/jetty/server/Server.java @ 875:b9aa175d9a29

remove Server.getThreadPool()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 13:45:47 -0600
parents 4f5547d29192
children 2efdb98f3543
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Server.java	Tue Oct 04 13:34:23 2016 -0600
+++ b/src/org/eclipse/jetty/server/Server.java	Tue Oct 04 13:45:47 2016 -0600
@@ -61,7 +61,7 @@
 	private static final String __version = "8";
 
 	private final AttributesMap _attributes = new AttributesMap();
-	private final ThreadPoolExecutor _threadPool;
+	public final ThreadPoolExecutor threadPool;
 	private Connector[] _connectors;
 	private boolean _sendServerVersion = true; //send Server: header
 	private boolean _sendDateHeader = false; //send Date: header
@@ -84,7 +84,7 @@
 		connector.setPort(port);
 		setConnectors(new Connector[]{connector});
 
-		_threadPool = new ThreadPoolExecutor(256, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
+		threadPool = new ThreadPoolExecutor(256, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
 	}
 
 
@@ -161,15 +161,6 @@
 		_connectors = connectors;
 	}
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * @return Returns the threadPool.
-	 */
-	public ThreadPoolExecutor getThreadPool()
-	{
-		return _threadPool;
-	}
-
 	/**
 	 * @return true if {@link #dumpStdErr()} is called after starting
 	 */
@@ -283,7 +274,7 @@
 				try{_connectors[i].stop();}catch(Throwable e){mex.add(e);}
 		}
 
-		_threadPool.shutdownNow();
+		threadPool.shutdownNow();
 
 		try {super.doStop(); } catch(Throwable e) { mex.add(e);}
 
@@ -360,8 +351,7 @@
 	/* ------------------------------------------------------------ */
 	public void join() throws InterruptedException
 	{
-//		getThreadPool().join();
-		_threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+		threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -521,10 +511,9 @@
 
 	public final boolean isLowOnThreads()
 	{
-		ThreadPoolExecutor tpe = getThreadPool();
 		// getActiveCount() locks the thread pool, so execute it last
-		return tpe.getPoolSize() == tpe.getMaximumPoolSize() &&
-				tpe.getQueue().size() >= tpe.getPoolSize() - tpe.getActiveCount();
+		return threadPool.getPoolSize() == threadPool.getMaximumPoolSize() &&
+				threadPool.getQueue().size() >= threadPool.getPoolSize() - threadPool.getActiveCount();
 	}