summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-09 15:14:45 +0100
committerSimon Rettberg2019-11-09 15:14:45 +0100
commitb45cad975c73c5f7b0329cb27ade5b26dddcb3d4 (patch)
tree9574b2a353b4c587ea3267e5d6ae44a27c8ee2d1 /src
parentMerge branch 'master' of git.openslx.org:dnbd3-status (diff)
downloaddnbd3-status-b45cad975c73c5f7b0329cb27ade5b26dddcb3d4.tar.gz
dnbd3-status-b45cad975c73c5f7b0329cb27ade5b26dddcb3d4.tar.xz
dnbd3-status-b45cad975c73c5f7b0329cb27ade5b26dddcb3d4.zip
Work around race condition instead of proper rearchitecturing
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java10
1 files 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<ServerStats> outServers = new ArrayList<ServerStats>();
+ List<ServerStats> newOutServers = new ArrayList<ServerStats>();
for ( Future<Status> 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();