Summary - While testing on another issue, I came across a java.util.ConcurrentModificationException. Upon further inspection I noticed a timestamp validity check that seems problematic.
Bug Details
What? - We seem to be checking if updates happened before the proxy's local time as a sort of validity check, if the updates happened after, we remove them from the array that is being iterated over, which causes the ConcurentModificationException (textbook case).
When?/How often? - It seems to occur when rapid successions of events are generated. This also obviously happens when the moodle services local time is later than the proxy's.
How?/Current state - The generated exception was such:
java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) at java.util.ArrayList$Itr.next(ArrayList.java:859) at i5.las2peer.services.moodleDataProxyService.MoodleDataProxyService$DataStreamThread.run(MoodleDataProxyService.java:197) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
Fixed state - The proxy probably shouldn't be making this validity check at all, it's own local time should be irrelevant to the system, only moodle's time should be the relevant one (and the LRS's). This check might have been implemented because of duplicate statements being generated, therefore the check will be removed with caution
java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) at java.util.ArrayList$Itr.next(ArrayList.java:859) at i5.las2peer.services.moodleDataProxyService.MoodleDataProxyService$DataStreamThread.run(MoodleDataProxyService.java:197) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)