activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] michaelandrepearce commented on a change in pull request #2514: ARTEMIS-2236 Address Latency Impact caused by ARTEMIS-1451
Date Wed, 23 Jan 2019 10:04:19 GMT
michaelandrepearce commented on a change in pull request #2514: ARTEMIS-2236 Address Latency
Impact caused by ARTEMIS-1451
URL: https://github.com/apache/activemq-artemis/pull/2514#discussion_r250125913
 
 

 ##########
 File path: artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadPoolExecutor.java
 ##########
 @@ -64,20 +63,15 @@ public void setExecutor(ActiveMQThreadPoolExecutor executor) {
       public boolean offer(Runnable runnable) {
          boolean retval = false;
 
-         // Need to lock for 2 reasons:
-         // 1. to safely handle poll timeouts
-         // 2. to protect the delta from parallel updates
-         synchronized (lock) {
-            if ((executor.getPoolSize() >= executor.getMaximumPoolSize()) || (threadTaskDelta
> 0)) {
-               // A new task will be added to the queue if the maximum number of threads
has been reached
-               // or if the delta is > 0, which means that there are enough idle threads.
+         if (threadTaskDelta > 0 || (executor.getPoolSize() >= executor.getMaximumPoolSize()))
{
 
 Review comment:
    getPoolSize uses a lock underneath in the executor, so we possible can avoid that when
we have idle threads.
   
   if threadTaskDelta > 0 (which means we have idle) then we can offer, we only need to
see if we are at max if we dont have idle. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message