[jetty-dev] [jira] (JETTY-1527) QueuedThreadPool Anomaly

"David Wade (JIRA)" <[email protected]> Wed, 20 Jun 2012 20:54:21 -0500 (CDT)
Newsgroups gmane.comp.java.jetty.general
Message-ID <1091288398.14567.1340243661423.JavaMail.j2ee-jira@codehaus01.managed.contegix.com>
David Wade
commented on JETTY-1527

QueuedThreadPool Anomaly

Actually, after taking a look at the existing dispatch method, I don't know why the logic contains an OR such that a thread is created when there are no idle threads... Surely the only issue is, are there more items in the queue then we have idle threads to process them; in which case the dispatch method should change to something like this (which passes my contrived test).

public boolean dispatch(Runnable job)

{

if (isRunning())

{

if (_jobs.offer(job))

{

final int jobQ = _jobs.size();

final int idle = getIdleThreads();

// If is greater than the idle threads

if (jobQ > idle)

{
int threads = _threadsStarted.get();
if (threads <= _maxThreads)
startThread(threads);
}

return true;

}

else

{

LOG.debug("Declined {} on {}", job, this);

}

}

LOG.debug("Dispatched {} to stopped {}", job, this);

return false;

}

This message is automatically generated by JIRA.

If you think it was sent incorrectly, please contact your JIRA administrators .

For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email