do the EJB container create only one instance for the session bean and use threading? or a new instance for each client when a client invoke the session bean?
For singleton session beans, there will be one instance in your application. This one instance may be accessed by several different threads. By default the container makes sure only one method may be accessed, but you can changed that using @Lock(LockType.READ) or @ConcurrencyManagement(ConcurrencyManagementType.BEAN).
For stateless session beans there are usually multiple instances. These may be reused (the container may pool some instances, and return instances from this pool), but each instance will be accessed by only one thread at a time.
Stateful session beans may be accessed from multiple threads at the same time, but the container must ensure that only one thread will have access at any given time. That means that if thread A calls method X of a stateful session bean, and thread B calls method Y of the same bean, then the container must make sure that the call to method X finishes for thread A before method Y will be called for thread B.
Post by:autobot
Let's go to the waterfront with this tiny ad:
a bit of art, as a gift, that will fit in a stocking