[ https://issues.apache.org/jira/browse/POOL-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14329075#comment-14329075 ]
Abin commented on POOL-288: --------------------------- Pool version : commons-pool-1.5.4.jar My counter is in the constructor of ZdSmppSession which is the pooled object. Pool config : <bean id="smppSessionPoolAcc" class="org.springframework.aop.target.CommonsPoolTargetSource"> <property name="targetBeanName" value="smppSessionTargetAcc"/> <property name="maxSize" value="40"/> <property name="minIdle" value="40"/> <property name="whenExhaustedActionName" value="WHEN_EXHAUSTED_BLOCK"/> </bean> This is the spring config for CommonsPoolTargetSource. With this config it should not create more than 40 objects, which it is doing One observation I made is that this does not happen when i do not call submit() method in the cloudhopper library. com.cloudhopper.smpp.SmppSession.submit(x, y); > Objects growing out of bound (beyond max limit) > ----------------------------------------------- > > Key: POOL-288 > URL: https://issues.apache.org/jira/browse/POOL-288 > Project: Commons Pool > Issue Type: Bug > Reporter: Abin > > My messaging application is a stand-alone spring boot application. I am > maintaining an apache commons pool of smpp sessions to be kept alive and used > when needed. But the pool starts to grow beyond its max limit. I have > explained my application design below. Any help/suggestion would be greatly > appreciated. > Current Design > I have an object pool of type ZdSmppSession (Apache Commons Pool), with pool > size set to 40 > Each ZdSmppSession has the following > 1. A sendMessage method > 2. A private variable of type com.cloudhopper.smpp.SmppSession > 3. A PostConstruct method > The Post Construct method does the following > 1. initiates a handshake and initialize the private variable > com.cloudhopper.smpp.SmppSession > 2. schedules an enquire link to be sent every 60 secs > I have about 120 worker threads which does the following > 1. Read message from rmq > 2. Get a ZdSmppSession object from pool > 3. Calls sendMessage on the object > 4. Release it back to pool > So when a ZdSmppSession object is created in the pool it is ready to send > messages > When ZdSmppSession is released back to pool it keeps the connection alive by > sending enquire link every 60 secs. A session object is never destructed. > Issue > The issue I am facing is that the pool grows beyond its maximum limit, even > though the max limit is set to 40. -- This message was sent by Atlassian JIRA (v6.3.4#6332)