I am getting java.util.concurrentmodificationexception for my implementation below
try{
Date fromDate = new Date().parse("yyyy-MM-dd", SfromDate);
Date toDate = new Date().parse("yyyy-MM-dd", StoDate);
def sTblList = this.getMonths(SfromDate,StoDate)
def resourceInstance=Resources.get(res_id);
sTblList.each{
def OnemonthList=it.createCriteria().get {
eq('graresource',resourceInstance)
between('currentdate', fromDate, toDate)
projections {
sum(sumCol,'t_cnt')
groupProperty(groupCol)
order('t_cnt', 'desc')
maxResults(maxCount)
}
}
if (OnemonthList)
sumMap.addAll(OnemonthList)
}
return sumMap
}
catch(Exception e){
log.error("Error in SummaryUtilsService:getTop10UsersChart:" + e)
}
Is it because I am try to group on an aggregate property, and something wrong with this syntax?
Your sTblList is getting modified somewhere else. This happens if the reference is shared among different threads. Try synchronizing the block.