[jboss-user] [EJB3] - Re: EJB3 Session Bean Pool

Robert Geisler do-not-reply at jboss.com
Fri Apr 8 12:36:04 EDT 2011


Robert Geisler [http://community.jboss.org/people/robert.geisler] created the discussion

"Re: EJB3 Session Bean Pool"

To view the discussion, visit: http://community.jboss.org/message/598913#598913

--------------------------------------------------------------
hello carlo,

i finally implemented a custom org.jboss.ejb3.Pool and i am going to test it during the next days.
when all the bugs are gone, i'll post the code in JBoss forum; or on github as suggested.

but today i have a few more questions: 

*I) remove instances that are in use??*
i had a look at the code of org.jboss.ejb3.InfinitePool (written by you : )) and i noticed that InfinitePool holds a List<BeanContext> of >>active<< contexts. i guess, active means that these contexts are currently used (by a single thread)? whenever a context is created, the new instance is added to actives and then it stays there until it get released/ removed.
when the pool is destroyed (e.g. the bean gets undeployed?), InfinitePool iterates through its actives and calls remove() for each of these instances/ contexts created before. but StrictMaxPool (written by Kabir Khan) for example does not maintain such a list and thus does not call remove for active instances. so instances that are in use (/ are not located in the pool) while the pool is destroyed will never be removed, right?
is it critical? in which cases is Pool.destroy() called and is the pool required to remove such active instances?? what happens to these instances after the pool is destroyed?

*II) how to synchronize pool?*
a) InfinitePool and StrictMaxPool do not use synchronized methods, but synchronized statements for changes in the pool structure. i tried to adopt this for my pool. but i wonder if synchronized methods would also do the trick? or could it cause a bottleneck??
b) i checked sources of pool implementations in JBoss6. i noticed that org.jboss.ejb3.AbstractPool uses AtomicInteger to count create() and remove() while JBoss4 used a primitive instead. should a adopt this as well??


thanks in advance.
robert
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/598913#598913]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110408/bf671815/attachment.html 


More information about the jboss-user mailing list