Use synchronized for chainTasks to avoid ConcurrentModificationException
Related to
@@ -43,6 +43,7 @@ class DispatchQueueImpl implements DispatchQueue, DebugSignalHandler {
sb.append(String.format("\nTASK QUEUE NUMBER: %s\n", chainTasks.size()));
List<String> asyncTasks = new ArrayList<>();
long now = System.currentTimeMillis();
+ synchronized (chainTasks) {
for (Map.Entry<String, ChainTaskQueueWrapper> e : chainTasks.entrySet()) {
StringBuilder tb = new StringBuilder(String.format("\nQUEUE SYNC SIGNATURE: %s", e.getKey()));
ChainTaskQueueWrapper w = e.getValue();
@@ -74,6 +75,8 @@ class DispatchQueueImpl implements DispatchQueue, DebugSignalHandler {
}
asyncTasks.add(tb.toString());
}
+ }
+
sb.append(StringUtils.join(asyncTasks, "\n"));
sb.append("\n================= END TASK QUEUE DUMP ==================\n");
_threadFacade.printThreadsAndTasks();
