but sometimes, it hangs on q.getResultList(); so i close my app (an rcp app) an open it again. so i open the view that does this select, and then eclipselink says
A signal was attempted before wait() on ConcurrencyManager. This normally means that an attempt was made to
commit or rollback a transaction before it was started, or to rollback a transaction twice.
The only way to tell what is going on is to get a java thread dump and check out what other threads the process might be waiting on. What does your AggressiveCacheQueryRedirector do?
package br.com.germantech.cache;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
import org.eclipse.persistence.internal.sessions.AbstractRecord;
import org.eclipse.persistence.internal.sessions.AbstractSession;
import org.eclipse.persistence.queries.DatabaseQuery;
import org.eclipse.persistence.queries.QueryRedirector;
import org.eclipse.persistence.sessions.Record;
import org.eclipse.persistence.sessions.Session;
public class AggressiveCacheQueryRedirector implements QueryRedirector {
private static final long serialVersionUID = -7875812708013000151L;
public Object invokeQuery(DatabaseQuery query, Record arguments, Session session) {
// Para evitar loop infinito
query.setDoNotRedirect(true);
// Cacheando todas as caches do tipo 'read-all'
// if (query.isReadAllQuery()) {
// Procura ou cria o cache de acordo com a classe
EhCacheWrapper cacheWrapper = EhCacheWrapper.getInstance();
Cache cache = cacheWrapper.findOrCreateCache(query.getDescriptor().getJavaClass());
// Cria uma key para o cache e armazena
CacheKey key = new CacheKey(query.getName(), arguments.values().toArray());
Element element;
// Retorna o resultado cacheado
if ((element = cache.get(key)) != null) {
return element.getValue();
// Executa a query e armazena os resultados em cache
} else {
Object object = query.execute((AbstractSession)session, (AbstractRecord) arguments);
if (object != null) {
cache.put(new Element(key, object));
}
return object;
}
// Executa a query sem passar pelo cache
// } else {
// return query.execute((AbstractSession)session, (AbstractRecord) arguments);
// }
}
}
Your query redirector seems to be attempt to do some kind of query cache. Note that EclipseLink support query caching, you can define any NamedQuery to cache its results using the query hint "eclipselink.query-results-cache".
Are you sure the record was not updated in any way, or is there maybe another record in the same table was updated (and the database has page level locking) and that its transaction is still open?
i'm sure about the update...it's just a 'read' method...
now, about the transaction or page locking, i don't know... because the only method who manage a transaction is the 'saveOrUpdate' method