Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How To modify Eclipselink JPA 2.0 connection retry behaviour(How To modify Eclipselink JPA 2.0 connection retry behaviour)
How To modify Eclipselink JPA 2.0 connection retry behaviour [message #659443] Mon, 14 March 2011 01:50 Go to next message
mjawath is currently offline mjawathFriend
Messages: 4
Registered: March 2011
Junior Member
EntityManager entityManager = Persistence.createEntityManagerFactory("mydb").createEntityManager();

Database connection is connected
private void cButton1ActionPerformed(java.awt.event.ActionEvent evt) {
entityManager.createQuery(".....").getResultList();

}

if Database connection is disconnected at this point.

private void cButton2ActionPerformed(java.awt.event.ActionEvent evt) {
entityManager.createQuery(".....").getResultList();

}


Eclipselink automatically tries to reconnect it self to database whenever it detects a connection failure this causes swing ui to freeze without any responses until it connects to database .
Are there any solution to modify this behavior
Ie is it possible to throw exception when connection fails without retrying
Please help on this issue
I am facing with huge problem.

I went throe eclipselink source code and google but I could not find any solution.
Re: How To modify Eclipselink JPA 2.0 connection retry behaviour [message #660818 is a reply to message #659443] Mon, 21 March 2011 18:31 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

Gordon posted the code in the response here:
http://stackoverflow.com/questions/5289075/how-to-modify-ecl ipselink-jpa-2-0-connection-retry-behavior
which will disable the retry code (method was misspelled, should be setConnectionHealthValidatedOnError ). If your gui is still stuck, do you have a thread dump showing where the code is locked?

Regards,
Chris

[Updated on: Mon, 21 March 2011 18:38]

Report message to a moderator

Re: How To modify Eclipselink JPA 2.0 connection retry behaviour [message #660870 is a reply to message #660818] Tue, 22 March 2011 07:56 Go to previous messageGo to next message
mjawath is currently offline mjawathFriend
Messages: 4
Registered: March 2011
Junior Member
i dont know how to use thread dump. i am developing network based swing database application and connect to server in directly by eclipselink , i set this even

public class LoginCustom implements SessionCustomizer {

public void customize(Session session) {
DatabaseLogin login = (DatabaseLogin)session.getDatasourceLogin();
login.setDelayBetweenConnectionAttempts(200);
login.setQueryRetryAttemptCount(0);
}
}

still if connection fails exception is thrown at lease 2 seconds later after i applied this solution it is better then unresponsiveness but still it not responsive.
what is the best architecture to develop swing based desktop applicaions using eclipselink which connects to server within the work group dirctly ?
Re: How To modify Eclipselink JPA 2.0 connection retry behaviour [message #661925 is a reply to message #660870] Mon, 28 March 2011 14:26 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Seems like your connection is dead, and when accessed takes 2 seconds before it throws the error. Not sure there is anything we can do, we have no way to know it is dead without accessing it. You may need to configure a timeout in your driver or network.

Why is your connection lost? Perhaps try to resolve that issue as well.



James : Wiki : Book : Blog : Twitter
Previous Topic:Toplink to eclipselink upgrade issue
Next Topic:Getting cache coordination working with rmi and glassfish
Goto Forum:
  


Current Time: Fri Apr 26 00:00:06 GMT 2024

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

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

Back to the top