I did a quick test client that looks up one proxy and then calls a method on it from multiple threads.
If the bean is Stateful, I get immediatelly a javax.ejb.ConcurrentAccessException.
If the bean is Stateless, I get no error and it seems to work. Can I assume that it is thread safe?
Are there any docs or specs? The EJB spec is a bit unlear on this issue (for me at least).
So in 4.2.3 they are not thread safe?
Should each thread have an own EJB stub?
Additionally in EJB 3.1 (JBoss AS 6), one can specify what needs to happen if multiple threads access the same client proxy simultaneously.
The default behavior in EJB 3 is to serialize access. In EJB 3.1 this is still the case for session beans other than a Singleton session bean, and obviously for non-asynchronous methods, but as an alternative you can now request that an exception is thrown instead.