we get into a deadlock, if two threads try to close an entity manager.
The first thread try to close the entity manager factory which close all opened entity managers.
The second thread is triggered by an event and try to close the entity manager after a database access.
Both threads keep in the close method of the entity manager and never leave the close.
Why one of the threads cannot leave the close?