Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Check the connection and try to reconnect(EL, Spring)
Check the connection and try to reconnect [message #515364] Thu, 18 February 2010 15:15 Go to next message
@x.l  is currently offline @x.l Friend
Messages: 2
Registered: February 2010
Junior Member
I use EL and Spring in a RCP-Application.

There're two problems:

1.) Is there an easy way to check the database connection? Currently I create a simple query on the entitymanager and check the result. But I think, there have to be a better solution. I also tried EnityManger#isOpen: This returns always true, even when the connection is lost (strange).

2.) When I lost the connection (deactivate the network-connection) I get the following message:
[EL Fine]: 2010-02-18 15:30:22.108--ServerSession(20612044)--Thread(Thread[Thread-8,5,spring-osgi-extender[7736bd]-threads])--SELECT 1
[EL Info]: 2010-02-18 15:30:22.108--UnitOfWork(20457864)--Thread(Thread[Thread-8,5,spring-osgi-extender[7736bd]-threads])--Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query.

But when I reactivate the network connection, nothing happens and the app hangs up.

Has anyone an idea, what I could do?

[Updated on: Thu, 18 February 2010 15:15]

Report message to a moderator

Re: Check the connection and try to reconnect [message #515690 is a reply to message #515364] Fri, 19 February 2010 19:22 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Hello,

The message indicates that it detected a connection problem and is reestablish the connection and execute the query again. By default, it will make 3 attempts with a 5000 millisecond wait between attempts which can be configured as neccessary. Since it is doing this for you, you should not need to check the connection yourself, but you can if you register an exception handler as described in a response I found from Tom at:
http://markmail.org/message/6p3m62orbv72n7tn

What exactly do you mean by the app hangs up? Is it locked, or just not returning any results? If so, please get a java thread dump and post the relevant threads so we can see what exactly is stuck waiting, and say if you have changed any of the default settings.

Best Regards,
Chris
Previous Topic:EclipseLink weaving for EMF models
Next Topic:eclipselink dynamic weaving not working from remote computer
Goto Forum:
  


Current Time: Thu Nov 27 03:12:27 GMT 2014

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

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