331230 Fixed low thread warnings when acceptors>threadpool
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2564 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
654544b5ec
commit
748eadeda3
|
@ -1,3 +1,6 @@
|
|||
|
||||
+ 331230 Fixed low thread warnings when acceptors>threadpool
|
||||
|
||||
jetty-7.2.2.v20101201 1 December 2010
|
||||
+ 330210 Improve performance of writing large bytes arrays
|
||||
+ 330208 Support new wording on servlet-mapping and filter-mapping merging from servlet3.0a
|
||||
|
|
|
@ -374,13 +374,9 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
|||
_acceptorThread = new Thread[getAcceptors()];
|
||||
|
||||
for (int i = 0; i < _acceptorThread.length; i++)
|
||||
{
|
||||
if (!_threadPool.dispatch(new Acceptor(i)))
|
||||
{
|
||||
Log.warn("insufficient maxThreads configured for {}",this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_threadPool.dispatch(new Acceptor(i));
|
||||
if (_threadPool.isLowOnThreads())
|
||||
Log.warn("insufficient threads configured for {}",this);
|
||||
}
|
||||
|
||||
Log.info("Started {}",this);
|
||||
|
|
|
@ -138,7 +138,7 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
|
|||
if (_executor instanceof ThreadPoolExecutor)
|
||||
{
|
||||
final ThreadPoolExecutor tpe = (ThreadPoolExecutor)_executor;
|
||||
return tpe.getActiveCount()>=tpe.getMaximumPoolSize();
|
||||
return tpe.getTaskCount()>=(tpe.getMaximumPoolSize());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -186,9 +186,9 @@ public class QueuedThreadPool extends AbstractLifeCycle implements ThreadPool, E
|
|||
*/
|
||||
public void setMaxThreads(int maxThreads)
|
||||
{
|
||||
if (isStarted() && maxThreads<_minThreads)
|
||||
throw new IllegalArgumentException("!minThreads<maxThreads");
|
||||
_maxThreads=maxThreads;
|
||||
if (_minThreads>_maxThreads)
|
||||
_minThreads=_maxThreads;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -199,10 +199,11 @@ public class QueuedThreadPool extends AbstractLifeCycle implements ThreadPool, E
|
|||
*/
|
||||
public void setMinThreads(int minThreads)
|
||||
{
|
||||
if (isStarted() && (minThreads<=0 || minThreads>_maxThreads))
|
||||
throw new IllegalArgumentException("!0<=minThreads<maxThreads");
|
||||
_minThreads=minThreads;
|
||||
|
||||
if (_minThreads>_maxThreads)
|
||||
_maxThreads=_minThreads;
|
||||
|
||||
int threads=_threadsStarted.get();
|
||||
while (isStarted() && threads<_minThreads)
|
||||
{
|
||||
|
@ -386,11 +387,11 @@ public class QueuedThreadPool extends AbstractLifeCycle implements ThreadPool, E
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return True if the pool is at maxThreads and there are more queued jobs than idle threads
|
||||
* @return True if the pool is at maxThreads and there are not more idle threads than queued jobs
|
||||
*/
|
||||
public boolean isLowOnThreads()
|
||||
{
|
||||
return _threadsStarted.get()==_maxThreads && _jobs.size()>_threadsIdle.get();
|
||||
return _threadsStarted.get()==_maxThreads && _jobs.size()>=_threadsIdle.get();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue