Mercurial Hosting > luan
changeset 875:b9aa175d9a29
remove Server.getThreadPool()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 04 Oct 2016 13:45:47 -0600 |
parents | ad495e897c32 |
children | 2efdb98f3543 |
files | src/org/eclipse/jetty/server/AbstractConnector.java src/org/eclipse/jetty/server/AsyncContinuation.java src/org/eclipse/jetty/server/Server.java src/org/eclipse/jetty/server/handler/HandlerCollection.java |
diffstat | 4 files changed, 9 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
diff -r ad495e897c32 -r b9aa175d9a29 src/org/eclipse/jetty/server/AbstractConnector.java --- a/src/org/eclipse/jetty/server/AbstractConnector.java Tue Oct 04 13:34:23 2016 -0600 +++ b/src/org/eclipse/jetty/server/AbstractConnector.java Tue Oct 04 13:45:47 2016 -0600 @@ -114,7 +114,7 @@ /* ------------------------------------------------------------ */ public ThreadPoolExecutor getThreadPool() { - return _server.getThreadPool(); + return _server.threadPool; } /* ------------------------------------------------------------ */
diff -r ad495e897c32 -r b9aa175d9a29 src/org/eclipse/jetty/server/AsyncContinuation.java --- a/src/org/eclipse/jetty/server/AsyncContinuation.java Tue Oct 04 13:34:23 2016 -0600 +++ b/src/org/eclipse/jetty/server/AsyncContinuation.java Tue Oct 04 13:45:47 2016 -0600 @@ -904,7 +904,7 @@ final AsyncEventState event=_event; if (event!=null) { - _connection.getServer().getThreadPool().execute(new Runnable() + _connection.getServer().threadPool.execute(new Runnable() { public void run() {
diff -r ad495e897c32 -r b9aa175d9a29 src/org/eclipse/jetty/server/Server.java --- 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(); }
diff -r ad495e897c32 -r b9aa175d9a29 src/org/eclipse/jetty/server/handler/HandlerCollection.java --- a/src/org/eclipse/jetty/server/handler/HandlerCollection.java Tue Oct 04 13:34:23 2016 -0600 +++ b/src/org/eclipse/jetty/server/handler/HandlerCollection.java Tue Oct 04 13:45:47 2016 -0600 @@ -193,7 +193,7 @@ for (int i=0;i<_handlers.length;i++) { final int h=i; - getServer().getThreadPool().execute( + getServer().threadPool.execute( new Runnable() { public void run()