#297104 threadpool improvements

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1517 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-04-15 11:07:09 +00:00
parent a51b1a217c
commit 547b3f310c
1 changed files with 10 additions and 6 deletions

View File

@ -44,7 +44,7 @@ public class ProxyHandler extends AbstractHandler
private volatile int _connectTimeout = 5000;
private volatile int _writeTimeout = 30000;
private volatile ThreadPool _threadPool;
private volatile ThreadPool _privateThreadPool;
private volatile boolean _privateThreadPool;
/**
* <p>Constructor to be used to make this proxy work via HTTP CONNECT.</p>
@ -102,8 +102,8 @@ public class ProxyHandler extends AbstractHandler
super.setServer(server);
server.getContainer().update(this,null,_selectorManager,"selectManager");
if (_privateThreadPool!=null)
if (_privateThreadPool)
server.getContainer().update(this,null,_privateThreadPool,"threadpool",true);
else
_threadPool=server.getThreadPool();
@ -123,8 +123,9 @@ public class ProxyHandler extends AbstractHandler
public void setThreadPool(ThreadPool threadPool)
{
if (getServer()!=null)
getServer().getContainer().update(this,_privateThreadPool,threadPool,"threadpool",true);
_threadPool=_privateThreadPool=threadPool;
getServer().getContainer().update(this,_privateThreadPool?_threadPool:null,threadPool,"threadpool",true);
_privateThreadPool=threadPool!=null;
_threadPool=threadPool;
}
@Override
@ -133,7 +134,10 @@ public class ProxyHandler extends AbstractHandler
super.doStart();
if (_threadPool==null)
{
_threadPool=getServer().getThreadPool();
_privateThreadPool=false;
}
if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
((LifeCycle)_threadPool).start();
@ -163,7 +167,7 @@ public class ProxyHandler extends AbstractHandler
_selectorManager.stop();
ThreadPool threadPool = _threadPool;
if (threadPool != null && threadPool instanceof LifeCycle)
if (_privateThreadPool && _threadPool != null && threadPool instanceof LifeCycle)
((LifeCycle)threadPool).stop();
super.doStop();