Announcement Announcement Module
Collapse
No announcement yet.
GenericObjectPool threshold config Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • GenericObjectPool threshold config

    The GenericObjectPool is configured for 12 Threads. Once 12 threads are exhausted, I find the caller thread goes zombie. I think default behaviour is to enqueue extra requests and serve once available instead of killing caller thread.

    Code:
    private ImplClass implObject;
    
    for (Iterator iter = anArrayList.iterator(); iter.hasNext();) {
    
        //Gets a GenericObjectPool Object
        implObject = (ImplClass) this.getImplPool().borrowObject();
    
        some code
    
    }
    I have tried both configurations as below for configuring pool. For me blocking is fine so long as it resumes from borrow statement and process lines below it inside loop.

    Code:
    <bean id="ImplPool" class="org.apache.commons.pool.impl.GenericObjectPool">
        <constructor-arg>
            <ref local="ImplFactory"/>
        </constructor-arg>
        <constructor-arg>
            <value>12</value>
        </constructor-arg>    
    </bean> 
    
    
    
    <bean id="ImplPool" class="org.apache.commons.pool.impl.GenericObjectPool">
        <constructor-arg>
            <ref local="ImplFactory"/>
        </constructor-arg>
        <constructor-arg>
            <value>12</value>
        </constructor-arg>    
    <constructor-arg>
             <bean id="org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_BLOCK" 
             class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean" />
        </constructor-arg>      
    <constructor-arg>
            <value>-1</value>
        </constructor-arg>
    </bean>
    Can you please suggest a config for a blocking GenericObjectPool on reaching threshold ?
Working...
X