-
Bug
-
Resolution: Done
-
Major
-
1.0.0-Beta11, 1.0.0-Beta12, 1.1.0
-
None
This relates to the fix implemented for http://jira.jboss.com/jira/browse/EJBTHREE-1116
The locking/unlocking performed during create/start/stop uses a ReentrantReadWrite lock which assumes that the lifecycle events are called by the same thread. This is not a safe assumption.
If EJBContainer is stopped and restarted by different threads, start() will throw an IllegalMonitorStateException when it tries to unlock the write lock acquired in stop().
Additionally, if EJBContainer is stopped, and a second thread tries to stop it again, that thread will block until it is interrupted.
Since EJBContainer is the only object capable of acquiring the container write lock, the write lock should always be reentrant regardless of thread ownership.