| EclipseLink 2.1.0 - timeout on idle connections [message #559121] |
Wed, 15 September 2010 12:32  |
Matteo Palmieri Messages: 3 Registered: September 2010 |
Junior Member |
|
|
Hi,
I'm using EclipseLink 2.1.0 + MySql for a web application. Internal connection pool is used instead of Tomcat maintained pool.
The issue I'm currently facing is that connections in the pool become idle during the night (when the application is indeed idle).
In the morning the first attempt to use a connection fails, but further attempts work fine.
I've heard that H3C0 (Hibernate) and other connection pools support a feature that sends a sort of heartbeat packet to
keep the connection alive so that every connection in the pool does not timeout (e.g. using the testConnectionOnCheckout
property).
Is it possible to get the same behaviour on EclipseLink in order to avoid that an idle connection times out ?
Matteo
|
|
|
| Re: EclipseLink 2.1.0 - timeout on idle connections [message #559420 is a reply to message #559121] |
Thu, 16 September 2010 11:06   |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
EclipseLink will automatically reconnect failed connections, so other than getting an error logged, you should not see any issues. This is normally the best solution to dead connections.
You could create your own thread to cycle the connection pool if you really wanted to. There is no such feature in EclipseLink.
EclipseLink does allow you to integrate with any DataSource implementation, so you could use 3CPO or any other connection pool if you want additional features.
James : Wiki : Book : Blog
|
|
|
| [SOLVED] EclipseLink 2.1.0 - timeout on idle connections [message #559596 is a reply to message #559420] |
Fri, 17 September 2010 06:29  |
Matteo Palmieri Messages: 3 Registered: September 2010 |
Junior Member |
|
|
Hi James,
thanks for your reply. I'm sorry to hear that this feature is missing in EclipseLink. It would be great to implement it in the future.
I was able to fix my problem using the second option you have just mentioned. I changed the configuration to use the Tomcat connection pool (dbcp) which actually provides the following useful parameters:
testWhileIdle="true"
validationQuery="select count(*) from dual"
minEvictableIdleTimeMillis="2880000"
Basically this checks every 8h idle connections performing the validation query, thus avoiding timeout. Simple and good!
|
|
|
Powered by
FUDForum. Page generated in 0.01474 seconds