From b45cad975c73c5f7b0329cb27ade5b26dddcb3d4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 9 Nov 2019 15:14:45 +0100 Subject: Work around race condition instead of proper rearchitecturing --- .../java/org/openslx/dnbd3/status/StatisticsGenerator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java b/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java index c9e50e4..48b075d 100644 --- a/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java +++ b/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java @@ -79,8 +79,8 @@ public class StatisticsGenerator } } statusList.clear(); - output.servers.clear(); - newOutput.servers.clear(); + List outServers = new ArrayList(); + List newOutServers = new ArrayList(); for ( Future future : futureStatusList ) { Status status; try { @@ -100,7 +100,7 @@ public class StatisticsGenerator srv.serverCount = status.getServerCount(); srv.uptime = status.getUptime(); srv.timestamp = status.getTimestamp(); - output.servers.add( srv ); + outServers.add( srv ); srv = srv.clone(); srv.images = status.getImages(); srv.clients = status.getClients(); @@ -108,8 +108,10 @@ public class StatisticsGenerator // For older dnbd3-server srv.clientCount = srv.clients.size(); } - newOutput.servers.add( srv ); + newOutServers.add( srv ); } + output.servers = outServers; + newOutput.servers = newOutServers; newOutput.timestamp = output.timestamp = System.currentTimeMillis(); synchronized ( graph ) { graph.decay(); -- cgit v1.2.3-55-g7522