'EclipseLink connection pool exhausted: application freezes

We have a standalone application with EclipseLink's default connection pool behaviour (max connection pool size 32). If the pool is exhausted (32 connections in transactional use) than the next request for a connection freezes the application (the request for the connection is on the event queue thread).

There is a property wait documented as Amount of time (in milliseconds) to wait for a connection from the pool. According to the code in

org.eclipse.persistence.sessions.server.ConnectionPool.acquireConnection()

it is the time a thread sleeps in the loop before it retries to acquire a connection from the pool. There seems to be no way either to limit the number of trials nor to get out of the loop unless another thread releases a connection or interrupts the current thread.

How can we avoid this?

We are using EclipseLink 2.7.7.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source