[ https://issues.apache.org/jira/browse/POOL-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14329125#comment-14329125 ]
Phil Steitz commented on POOL-288: ---------------------------------- If objects fail activation, they will be destroyed and replaced by new ones. You should do the following: 1. Upgrade at least to 1.5.7 (if you have to have binary compat with 1.5.4 or ancient JDK). Better is pool 2.x (note some configs have changed - see website and changelog). 2. Put your counters in the factory makeObject and destroyObject methods. > 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)