users@glassfish.java.net

Re: Bug? <max-pool-size> seems to count only idle EJB instances

From: Major Péter <majorpetya_at_sch.bme.hu>
Date: Tue, 01 Dec 2009 14:12:31 +0100

> I don't think it will solve my problem, because with this solution I will have several independent programs (or threads, whatever) executing different code in the *same* *physical* instance of the EJB at the same time. To avoid that, I would have to add "synchronized ( ) { ... }" statements on every public business method, something which is strictly forbidden in JEE as I understand it?

As far as I know: even with multiple clients you would use the same EJB
container, and yes, it would use the same physical instance, BUT EJB's
are thread-safe by definition, so I don't think, that you should use
synchronization modifier in your EJB at all. I'm using this solution in
production for connecting to a Directory Server with only connection,
and I didn't had any problem with it.