summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-08 15:32:30 +0100
committerSimon Rettberg2019-02-08 15:32:30 +0100
commitc9fdf6af44cff860ee816c90ad12863ccdfadd70 (patch)
tree7dd808eed86d414f04b9864e91b825a6090de4e1 /src/main
parentIncrease polling timeout; fix error handling (diff)
downloaddnbd3-status-c9fdf6af44cff860ee816c90ad12863ccdfadd70.tar.gz
dnbd3-status-c9fdf6af44cff860ee816c90ad12863ccdfadd70.tar.xz
dnbd3-status-c9fdf6af44cff860ee816c90ad12863ccdfadd70.zip
Support serverCount field from dnbd3 RPC
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/openslx/dnbd3/status/App.java2
-rw-r--r--src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java5
-rw-r--r--src/main/java/org/openslx/dnbd3/status/output/ServerStats.java2
-rw-r--r--src/main/java/org/openslx/dnbd3/status/rpc/Status.java12
4 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/dnbd3/status/App.java b/src/main/java/org/openslx/dnbd3/status/App.java
index 5c51e7a..1f03161 100644
--- a/src/main/java/org/openslx/dnbd3/status/App.java
+++ b/src/main/java/org/openslx/dnbd3/status/App.java
@@ -13,7 +13,7 @@ public class App
System.exit( 1 );
}
int port = Integer.parseInt( args[0] );
- String[] servers = Arrays.copyOfRange( args, 0, args.length );
+ String[] servers = Arrays.copyOfRange( args, 1, args.length );
System.setProperty( "com.example.jndi.dns.timeout.initial", "400" );
System.setProperty( "com.example.jndi.dns.timeout.retries", "2" );
WebServer ws = new WebServer( port, servers );
diff --git a/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java b/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java
index 4556378..ba0440c 100644
--- a/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java
+++ b/src/main/java/org/openslx/dnbd3/status/StatisticsGenerator.java
@@ -75,6 +75,7 @@ public class StatisticsGenerator
Future<Status> ret = threadPool.submit( task );
futureStatusList.add( ret );
} catch ( Exception e ) {
+ e.printStackTrace();
}
}
statusList.clear();
@@ -85,6 +86,7 @@ public class StatisticsGenerator
try {
status = future.get();
} catch ( Exception e ) {
+ System.out.println("Future timeout");
continue;
}
if ( status == null )
@@ -94,7 +96,8 @@ public class StatisticsGenerator
srv.address = status.getAddress();
srv.bytesReceived = status.getBytesReceived();
srv.bytesSent = status.getBytesSent();
- srv.clientCount = status.getClients().size();
+ srv.clientCount = status.getClientCount();
+ srv.serverCount = status.getServerCount();
srv.uptime = status.getUptime();
srv.timestamp = status.getTimestamp();
output.servers.add( srv );
diff --git a/src/main/java/org/openslx/dnbd3/status/output/ServerStats.java b/src/main/java/org/openslx/dnbd3/status/output/ServerStats.java
index 67dda59..97a8ea8 100644
--- a/src/main/java/org/openslx/dnbd3/status/output/ServerStats.java
+++ b/src/main/java/org/openslx/dnbd3/status/output/ServerStats.java
@@ -16,6 +16,8 @@ public class ServerStats implements Cloneable
@Expose
public int clientCount;
@Expose
+ public int serverCount;
+ @Expose
public long uptime;
@Expose
public long bytesSent;
diff --git a/src/main/java/org/openslx/dnbd3/status/rpc/Status.java b/src/main/java/org/openslx/dnbd3/status/rpc/Status.java
index 07fc782..22a32f6 100644
--- a/src/main/java/org/openslx/dnbd3/status/rpc/Status.java
+++ b/src/main/java/org/openslx/dnbd3/status/rpc/Status.java
@@ -12,6 +12,8 @@ public class Status
private List<Client> clients = null;
private String address = null;
private long timeStamp = -1;
+ private int clientCount;
+ private int serverCount;
public long getBytesReceived()
{
@@ -69,5 +71,15 @@ public class Status
{
return this.timeStamp;
}
+
+ public int getClientCount()
+ {
+ return clientCount;
+ }
+
+ public int getServerCount()
+ {
+ return serverCount;
+ }
}