0

I have huge problem and don`t know what to do. I have one event listener in my program, which listen for events from serial port. I read the data from serial port. Then do simple transformation of this data. Then set one simple text field and send next request to serial port. But, this works too fast. Then I try to wait 1 second between recive data and send new request. I try

TimeUnit.SECONDS.sleep(1);

and

 this.wait(1000);

and

Thread.currentThread().sleep(1000);

and others... But every time after 20-30 minutes my program throws exception

Exception in thread "JavaFX Application Thread" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:386)
at java.util.AbstractList$Itr.next(AbstractList.java:355)
at com.sun.javafx.scene.shape.PathUtils.configShape(PathUtils.java:45)
at javafx.scene.shape.Path.impl_configShape(Path.java:251)
at javafx.scene.shape.Path.impl_updatePeer(Path.java:304)
at javafx.scene.Node.impl_syncPeer(Node.java:503)
at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:2290)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2419)
at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:748)

After this exception more others exceptions are thrown... Anyway, my listener continue to work.

If this exception don't throw, one of my video streams interrupts and my program work perfectly... I have remote understanding why this happens, but I have no ideas how to fix this...

Exception java.util.ConcurrentModificationException I have even I don't do sleep or wait, even throws earlier...

Hans
  • 752
  • 1
  • 15
  • 29

0 Answers0