Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Troubles with Network error.

The JDBC timeout is just passed to the JDBC driver.  If your JDBC driver does
not support the timeout, or does not handle a network failure, there is
nothing EclipseLink can do.

You may wish to log this issue with your JDBC driver, or try a different
driver.


Arcangel wrote:
> 
> Hi,
> 
> I'm having some troubles with a application when I have a network
> connection 
> error. I expected some type of exception when eclipselink cannot get the 
> result of some query, instead the application blocks forever.
> 
> I tried with the query hint:
>  @QueryHint(name=QueryHints.JDBC_TIMEOUT, value="10")
> 
> And with: 
> <property name="eclipselink.jdbc.timeout" value="10"/>
> 
> This is the code of the function that blocks the app (only relevant
> parts):
> 
> @NamedQuery(name = "getAllDateNoDuplicadas", 
> 			query = "SELECT e From Solicitud e WHERE e.status = true AND
> e.fechaAlta >= 
> :fecha_inicio " +
> 			"AND e.fechaAlta <= :fecha_fin AND e.estadoExportacion <> 
> com.nettrace.ilm.enums.EstadoExportacion.DUPLICADA", 
> 			hints={ 
> 			@QueryHint(name=QueryHints.JDBC_FETCH_SIZE , value="256"),
> 			@QueryHint(name=QueryHints.READ_ONLY, value=HintValues.TRUE),
> 			@QueryHint(name=QueryHints.REFRESH , value=HintValues.TRUE),
> 			@QueryHint(name=QueryHints.READ_ONLY, value=HintValues.TRUE),
> 			@QueryHint(name=QueryHints.CACHE_USAGE,
> value=CacheUsage.DoNotCheckCache),
> 			@QueryHint(name=QueryHints.JDBC_TIMEOUT, value="10")
> 	}
> .....
> 
> @SuppressWarnings("unchecked")
> 	public static final List<Solicitud> getAllNoDuplicadas(Date fecha_inicio, 
> Date fecha_fin) {
> 		if (LOGGER.isLoggable(Level.FINE)) {
> 			LOGGER.logp(Level.FINE, "Model", "getAllNoDuplicadas(Date, Date)", 
> "start");
> 		}
> 		EntityManager em = null;
> 		try {
> 			em = factory.createEntityManager();
> 			System.out.println("1");
> 			Query q = em.createNamedQuery("getAllDateNoDuplicadas");
> 			System.out.println("2");
> 			q.setParameter("fecha_inicio", fecha_inicio);
> 			q.setParameter("fecha_fin", fecha_fin);
> 			List<Solicitud> res;
> 
> 			res = new ArrayList<Solicitud>(q.getResultList()); //Here the codec
> blocks.
> 			System.out.println("3");
> 
> 			if (LOGGER.isLoggable(Level.FINE)) {
> 				LOGGER.logp(Level.FINE, "Model", "getAllNoDuplicadas(Date, Date)",
> "end");
> 			}
> 			return res;
> 
> 		}
> 		catch (Exception e) {
> 			LOGGER.logp(Level.SEVERE, "Model", "getAllNoDuplicadas(Date, Date)",
> "", 
> e);
> 
> 			if (LOGGER.isLoggable(Level.FINE)) {
> 				LOGGER.logp(Level.FINE, "Model", "getAllNoDuplicadas(Date, Date)",
> "end");
> 			}
> 			return null;
> 		}
> 		finally{
> 			if(em != null){
> 				em.close();
> 			}
> 		}
> 	}
> 
> What is the proper way to deal with a Network disconnection Error?
> 
> To test this behavior i'm using a Virtual machine (VMware Player 3.0.0 on 
> kubuntu linux 9.04)  to disconnect the network device (sudo ifdown eth0)
> in 
> the middle of using the app. The Vm host the derby DB server.
> 
> I'm using derby 10.5.3._01 with client driver of the same version. I
> tested 
> eclipselink 1.1.3 and 2.0.0. The problem is the same.
> 
> Thanks for the help.
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/Troubles-with-Network-error.-tp27495853p27516274.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top