Skip to main content

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

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.



Back to the top