Hi -
I having difficulties understanding the source of a ConcurrentModificationException I am observing.
The code region
Code:
try
{
logger.debug("Creating query");
List<Object> list = session.createQuery(query).setCacheable(true).list();
logger.debug("Query OK ");
logger.debug("List null : "+ (list == null));
logger.debug("List size : "+list.size());
for (Object object : list)
{
logger.debug("Adding from list to set");
set.add((T) object);
}
logger.debug("DONE, everything looks OK...");
}
catch (JDBCConnectionException e){
logger.error("getAll() cought Exception");
logger.error(e.getMessage());
logger.error(e.getCause());
logger.error(e);
logger.error("JDBCConnectionException IS UNMANAGEBEL!!!");
logger.error("--- Restarting server !!! ---");
System.out.println("getAll() cought Exception");
System.out.println(e.getMessage());
System.out.println(e.getCause());
System.out.println(e);
System.out.println("JDBCConnectionException IS UNMANAGEBEL!!!");
System.out.println("--- Restarting server !!! ---");
System.exit(0);
}
catch (Exception e)
{
logger.error("getAll() cought Exception");
logger.error(e.getMessage());
logger.error(e.getCause());
logger.error(e);
logger.error("Session was null : "+(session == null));
logger.error("Session is open : "+session.isOpen());
logger.error("Query is: "+query);
logger.error("Re-trying query : ");
try{
List<Object> list = session.createQuery(query).setCacheable(true).list();
logger.error("Query OK ");
logger.error("List null : "+ (list == null));
logger.error("List size : "+list.size());
for (Object object : list)
{
logger.error("Adding from list to set");
set.add((T) object);
}
logger.error("DONE, everything looks OK...");
} catch (Exception innerEx){
logger.error("getAll() (retry) cought Exception");
logger.error(innerEx.getMessage());
logger.error(innerEx.getCause());
logger.error(innerEx);
}
//Well, we failed...
throw new InternalServerError(e);
}
Error log from the first catch clause and forward:
Code:
2007-11-26 12:23:18,416 ERROR reflection.AEntity - getAll() cought Exception
2007-11-26 12:23:18,417 ERROR reflection.AEntity -
2007-11-26 12:23:18,417 ERROR reflection.AEntity -
2007-11-26 12:23:18,417 ERROR reflection.AEntity - java.util.ConcurrentModificationException
2007-11-26 12:23:18,417 ERROR reflection.AEntity - Session was null : false
2007-11-26 12:23:18,417 ERROR reflection.AEntity - Session is open : true
2007-11-26 12:23:18,417 ERROR reflection.AEntity - Query is: from integration.hibernate.IntegrationMapEntry where entityPattern='/SURGERYROOM/2029'
2007-11-26 12:23:18,417 ERROR reflection.AEntity - Re-trying query :
2007-11-26 12:23:18,444 ERROR reflection.AEntity - Query OK
2007-11-26 12:23:18,445 ERROR reflection.AEntity - List null : false
2007-11-26 12:23:18,445 ERROR reflection.AEntity - List size : 14
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - Adding from list to set
2007-11-26 12:23:18,445 ERROR reflection.AEntity - DONE, everything looks OK...
2007-11-26 12:23:19,012 ERROR reflection.AEntity - getAll() cought Exception
2007-11-26 12:23:19,012 ERROR reflection.AEntity -
2007-11-26 12:23:19,012 ERROR reflection.AEntity -
2007-11-26 12:23:19,012 ERROR reflection.AEntity - java.util.ConcurrentModificationException
2007-11-26 12:23:19,012 ERROR reflection.AEntity - Session was null : false
2007-11-26 12:23:19,012 ERROR reflection.AEntity - Session is open : true
2007-11-26 12:23:19,012 ERROR reflection.AEntity - Query is: from integration.hibernate.IntegrationMapEntry where entityPattern='/SURGERYROOM/2028'
2007-11-26 12:23:19,012 ERROR reflection.AEntity - Re-trying query :
2007-11-26 12:23:19,018 ERROR reflection.AEntity - getAll() (retry) cought Exception
Could it have something to do with the query.setCacheable?
Only one session is used.