all,
running issue of concurrentmodificationexception , struggling find resolution partly because can't see modifiying list while iterating it... ideas?? i've highlighted line causing issue (it3.remove()). @ standstill one..
edit: stacktrace:
exception in thread "thread-4" java.util.concurrentmodificationexception @ java.util.arraylist$itr.checkforcomodification(unknown source) @ java.util.arraylist$itr.next(unknown source) @ com.shimmerresearch.advancepc.internalframeandplotmanager.subtractmaps(internalframeandplotmanager.java:1621)
line 1621 corresponds it3.remove() in referenced code above.
private void subtractmaps(concurrentskiplistmap<string, plotdevicedetails> firstmap, concurrentskiplistmap<string, plotdevicedetails> secondmap) { // iterate through secondmap iterator<entry<string, plotdevicedetails>> it1 = secondmap.entryset().iterator(); while (it1.hasnext()) { entry<string, plotdevicedetails> itentry = (entry) it1.next(); string mapkey = (string) it1entry.getkey(); plotdevicedetails plotdevicedetails = (plotdevicedetails)it1entry.getvalue(); // if find entry exists in second map , not in first map continue if(!firstmap.containskey(mapkey)){ continue; } // iterate through list of channels belonging secondmap iterator <plotchanneldetails> it2 = plotdevicedetails.mlistofplotchanneldetails.iterator(); while (it2.hasnext()) { plotchanneldetails it2entry = it2.next(); // iterate through list of channels belonging firstmap iterator <plotchanneldetails> it3 = firstmap.get(mapkey).mlistofplotchanneldetails.iterator(); innerloop: while(it3.hasnext()){ // if channel common both first map , second map, remove firstmap plotchanneldetails it3entry = it3.next(); if(it3entry.mchanneldetails.mobjectclustername.equals(it2entry.mchanneldetails.mobjectclustername)){ it3.remove(); // line causing concurrentmodificationexception break innerloop; } } } } }
plotdevicedetails.mlistofplotchanneldetails
, firstmap.get(mapkey).mlistofplotchanneldetails
reference same list.
whether plotdevicedetails
, firstmap.get(mapkey)
reference same object unknown without more information, share channel list.
Comments
Post a Comment