How is currentPoolSize for EJB3 dynamically assigned and sometimes less than maxPoolSize? What's the allocated count?

Posted on

This relates to statistics collection for the bean instance pools of EJB3 in JBoss EAP.

This solution https://access.redhat.com/solutions/1414173 explains that actually, the number of allocated EJB for a pool is the pool-max-size - pool-available-count.
This would explain why pool-current-size + pool-available-count is not equal to pool-max-size.

So, is it correct then to track currentPoolSize in JMX Statistics for JBoss as meaning the number currently allowed for the bean pool? So what happens when availableCount reaches zero, is that meaning allocated count now equals currentPoolSize or does it equal maxPoolSize?

For example, say:
maxPoolSize = 10
currentPoolSize = 5
availableCount = 0

Does that mean that allocated count = 5? Or would instead availableCount = 5, and currentPoolSize would automatically increase to maxPoolSize? So would availableCount change?
I'm seeing that most often currentPoolSize IS EQUAL to maxPoolSize, but sometimes it is less than max. So how is this managed?