Check the maximum connections in the configuration file (on the server side), maybe your application occasionally hits the maximum? Try using 0 for unlimitted.
Are the client and server on the same machine? createEntityManager
requires a new TCP/IP connection. Maybe the delay is due to a firewall or other external network settings?
If you can take a thread dump on the client side when this happens we can check where the client is waiting. You can try using Thread
methods (dumpStack
, getStackTrace
, getAllStackTraces
) automatically from another thread that will monitor the threads that invoke createEntityManager.
Note also that ObjectDB 2.7.6 that you use is old. If it is an issue with ObjectDB rather than something external, it is quite possible that a new ObjectDB version will not have this issue.