New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrent Modification Exception #557
Comments
Why is this a |
That's a very good question. I thought that I might have had an indeterminate state, leading to a mistaken exception, but that line has been Set not Map for as long as I went back... |
Also,
I am inclined to close this and maybe open an issue about 1 if you think it's a bug. |
The oCam is a regular camera, it uses JavaShotDetector |
In that case, we should give the thread a better name if we control it. |
I changed the thread name to the camera name because if I had two cameras and one of the threads hung or crashed, I didn't know which camera it was. We could add the detection method to the thread name as well. |
I'll do that in a second. I made a few other tweaks. |
PS. The problem is explained here: https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedSet(java.util.Set). We just have to synchronize on the for loop. This should solve the problem given the way synchronizedSet wraps a normal set. I have a few other messaging tweaks, but nothing that's a big deal. |
Exception in thread "oCam-5CRO-U 1" java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)
at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
at com.shootoff.camera.shotdetection.JavaShotDetector.processFrame(JavaShotDetector.java:292)
at com.shootoff.camera.CameraManager.processFrame(CameraManager.java:626)
at com.shootoff.camera.CameraManager.handleFrame(CameraManager.java:515)
at com.shootoff.camera.CameraManager.newFrame(CameraManager.java:498)
at com.shootoff.camera.cameratypes.SarxosCaptureCamera.run(SarxosCaptureCamera.java:186)
at java.lang.Thread.run(Thread.java:745)
The text was updated successfully, but these errors were encountered: