Hi,
I'm iterating an Arraylist inside a synchronized method, and I've set the Arraylist synchronized inside the method, but I still got the error ConcurrentModificationException. Why this is happening?
private synchronized TaskInProgress findTaskFromList(
Collection<TaskInProgress> tips,
TaskTrackerStatus ttStatus,
int numUniqueHosts,
boolean removeFailedTip) {
synchronized(tips) {
Iterator<TaskInProgress> iter = tips.iterator();
while (iter.hasNext()) {
TaskInProgress tip = iter.next();
}
}
}
java.io.IOException: java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at org.apache.hadoop.mapred.JobInProgress.findTaskFromList(JobInProgress.java:1930)
at org.apache.hadoop.mapred.JobInProgress.findNewMapTask(JobInProgress.java:2143)
at org.apache.hadoop.mapred.JobInProgress.obtainNewLocalMapTask(JobInProgress.java:1268)
at org.apache.hadoop.mapred.JobQueueTaskScheduler.assignTasks(JobQueueTaskScheduler.java:163)
at org.apache.hadoop.mapred.JobTracker.heartbeat(JobTracker.java:2576)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:508)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:959)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:955)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:953)
Thanks,