Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink 2.1.0 - timeout on idle connections (how to configure EclipseLink so that idle connections do not time out)
EclipseLink 2.1.0 - timeout on idle connections [message #559121] Wed, 15 September 2010 16:32 Go to next message
Matteo Palmieri is currently offline Matteo PalmieriFriend
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 15:06 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
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 : Twitter
[SOLVED] EclipseLink 2.1.0 - timeout on idle connections [message #559596 is a reply to message #559420] Fri, 17 September 2010 10:29 Go to previous message
Matteo Palmieri is currently offline Matteo PalmieriFriend
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!
Previous Topic:Using database defaults
Next Topic:MOXy performance
Goto Forum:
  


Current Time: Thu Mar 28 13:28:03 GMT 2024

Powered by FUDForum. Page generated in 0.03179 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top