[jboss-user] [JCA/JBoss] - Re: WorkManager thread pooling

vickyk do-not-reply at jboss.com
Thu Dec 27 03:20:43 EST 2007


"avzak" wrote : 
  | Am i missing something here?
  | 
No , I looked at the code which displays the Min/Max pool size , here is it 
public int getMinimumPoolSize()
  |    {
  |       return executor.getCorePoolSize();
  |    }
  | 
  |    public void setMinimumPoolSize(int size)
  |    {
  |       synchronized (executor)
  |       {
  |          // Don't let the min size > max size
  |          if (executor.getMaximumPoolSize() < size)
  |          {
  |             executor.setCorePoolSize(size);
  |             executor.setMaximumPoolSize(size);
  |          }
  |       }
  |    }
  | 
  |    public int getMaximumPoolSize()
  |    {
  |       return executor.getMaximumPoolSize();
  |    }
  |    
  |    public void setMaximumPoolSize(int size)
  |    {
  |       synchronized (executor)
  |       {
  |          executor.setCorePoolSize(size);
  |          executor.setMaximumPoolSize(size);
  |       }
  |    }
http://anonsvn.jboss.org/repos/common/common-core/trunk/src/main/java/org/jboss/util/threadpool/BasicThreadPool.java
In the above core you will see calling the setMaximumPoolSize() sets executor.setCorePoolSize(size) and the getMinPoolSize() displays the corePoolSize .
Actaully in setMaximumPoolSize(..) the          executor.setCorePoolSize(size); should be set only if the size(max size)<getMinimumPoolSize().

Even in older version of the ThreadPool I see the similar implementation 


  | public void setMaximumPoolSize(int size)
  |    {
  |       synchronized (executor)
  |       {
  |          executor.setMinimumPoolSize(size);
  |          executor.setMaximumPoolSize(size);
  |          // Don't let the min size > max size
  |          if (executor.getKeepAliveSize() > size)
  |             executor.setKeepAliveSize(size);
  |       }
  |    }
http://anonsvn.jboss.org/repos/common/common-core/tags/2.0.0/src/main/java/org/jboss/util/threadpool/BasicThreadPool.java

A quicker solution would be to have the custom ThreadPool Implementation which would take care of min/max pool count, you can simply take the jboss code and introduce the check as I have explained earlier .






View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115646#4115646

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115646



More information about the jboss-user mailing list