[ 
https://issues.apache.org/jira/browse/POOL-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14328936#comment-14328936
 ] 

Abin commented on POOL-288:
---------------------------

The object I am pooling is ZdSmppSession. I am printing a log in the 
constructor of this class and by counting the number of times the log is 
printed I can figure out how many times the object was created in the pool (The 
object is never initialized within the application). 
Once an instance of ZdSmppSession is created it starts sending an enquire_link 
every 60 seconds. I have verified the number of unique enquire_links sent and 
it confirms that there are more that the max count of objects expected. 

I am using org.springframework.aop.target.CommonsPoolTargetSource which 
implements org.apache.commons.pool.PoolableObjectFactory. It is a TargetSource 
implementation that holds objects in a configurable Apache Commons Pool. The 
spring version is 4.0.5

> 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)

Reply via email to