From 558a479ff72d13ec6849da973f4491e53fbf385d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 14 Mar 2016 14:20:00 +0100 Subject: Change json attributes --- src/main/java/fi/iki/elonen/NanoHTTPD.java | 2 +- src/main/java/org/openslx/dnbd3/status/WebServer.java | 5 +++-- .../openslx/dnbd3/status/output/EdgeSerializer.java | 2 +- src/main/java/org/openslx/graph/ClientNode.java | 1 - src/main/java/org/openslx/graph/Edge.java | 4 ++-- src/main/java/org/openslx/graph/Graph.java | 4 ++-- src/main/java/org/openslx/graph/Node.java | 18 ------------------ src/main/java/org/openslx/graph/ServerNode.java | 1 - 8 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/main/java/fi/iki/elonen/NanoHTTPD.java b/src/main/java/fi/iki/elonen/NanoHTTPD.java index 822a6bb..75026ee 100644 --- a/src/main/java/fi/iki/elonen/NanoHTTPD.java +++ b/src/main/java/fi/iki/elonen/NanoHTTPD.java @@ -450,7 +450,7 @@ public abstract class NanoHTTPD implements Runnable public static class DefaultAsyncRunner implements AsyncRunner { private long requestCount; - private ExecutorService pool = new ThreadPoolExecutor( 4, 32, 1, TimeUnit.MINUTES, new ArrayBlockingQueue( 2 ) ); + private ExecutorService pool = new ThreadPoolExecutor( 6, 32, 1, TimeUnit.MINUTES, new ArrayBlockingQueue( 1 ) ); @Override public void exec( Runnable code ) diff --git a/src/main/java/org/openslx/dnbd3/status/WebServer.java b/src/main/java/org/openslx/dnbd3/status/WebServer.java index c8750b8..70978c1 100644 --- a/src/main/java/org/openslx/dnbd3/status/WebServer.java +++ b/src/main/java/org/openslx/dnbd3/status/WebServer.java @@ -22,10 +22,11 @@ public class WebServer extends NanoHTTPD { super( port ); List pollers = new ArrayList<>(); + pollers.add( new ServerPoller( "132.230.4.2", 5003 ) ); pollers.add( new ServerPoller( "132.230.8.113", 5003 ) ); pollers.add( new ServerPoller( "132.230.4.60", 5003 ) ); - pollers.add( new ServerPoller( "10.4.128.38", 5003 ) ); - pollers.add( new ServerPoller( "132.230.4.2", 5003 ) ); + pollers.add( new ServerPoller( "10.16.0.1", 5003 ) ); + pollers.add( new ServerPoller( "10.16.0.2", 5003 ) ); imageGenerator = new StatisticsGenerator( pollers ); } diff --git a/src/main/java/org/openslx/dnbd3/status/output/EdgeSerializer.java b/src/main/java/org/openslx/dnbd3/status/output/EdgeSerializer.java index e014bb3..04dd45e 100644 --- a/src/main/java/org/openslx/dnbd3/status/output/EdgeSerializer.java +++ b/src/main/java/org/openslx/dnbd3/status/output/EdgeSerializer.java @@ -18,7 +18,7 @@ public class EdgeSerializer implements JsonSerializer final JsonObject out = new JsonObject(); out.addProperty( "source", src.getSource().getId() ); out.addProperty( "target", src.getTarget().getId() ); - out.addProperty( "width", src.getWeight() ); + out.addProperty( "received", src.getWeight() ); return out; } diff --git a/src/main/java/org/openslx/graph/ClientNode.java b/src/main/java/org/openslx/graph/ClientNode.java index 2d4d1f4..b1c826a 100644 --- a/src/main/java/org/openslx/graph/ClientNode.java +++ b/src/main/java/org/openslx/graph/ClientNode.java @@ -11,7 +11,6 @@ public class ClientNode extends Node { super( ip, ip, null ); setDesiredDistance( 2 ); - setRadius( 4 ); setColor( Color.BLUE ); } diff --git a/src/main/java/org/openslx/graph/Edge.java b/src/main/java/org/openslx/graph/Edge.java index ece5250..9d03aeb 100644 --- a/src/main/java/org/openslx/graph/Edge.java +++ b/src/main/java/org/openslx/graph/Edge.java @@ -58,9 +58,9 @@ public class Edge implements java.io.Serializable return _health > 0; } - public void addWeight( double weight ) + public void setWeight( double weight ) { - _weight += weight; + _weight = weight; _health = _maxHealth; } diff --git a/src/main/java/org/openslx/graph/Graph.java b/src/main/java/org/openslx/graph/Graph.java index b3ab8b2..65110f6 100644 --- a/src/main/java/org/openslx/graph/Graph.java +++ b/src/main/java/org/openslx/graph/Graph.java @@ -99,7 +99,7 @@ public class Graph implements java.io.Serializable _edges.put( edge, edge ); } // Set the edge weight. - edge.addWeight( weight ); + edge.setWeight( weight ); } // Remove a Node from the Graph, along with all of its emanating Edges. @@ -207,7 +207,7 @@ public class Graph implements java.io.Serializable private static final double MOVEMENT_SLOWDOWN = 0.001; // Applies the spring embedder. - public void doLayout( Set visibleNodes, int iterations ) + private void doLayout( Set visibleNodes, int iterations ) { // For performance, copy each set into an array. diff --git a/src/main/java/org/openslx/graph/Node.java b/src/main/java/org/openslx/graph/Node.java index 0bf2fab..d5e1dc2 100644 --- a/src/main/java/org/openslx/graph/Node.java +++ b/src/main/java/org/openslx/graph/Node.java @@ -13,20 +13,8 @@ public class Node implements java.io.Serializable @Expose @SerializedName( "name" ) private final String _displayName; - @Expose - @SerializedName( "distance" ) private double _distance = 2; - @Expose - @SerializedName( "radius" ) - private int _radius = 2; - @Expose - @SerializedName( "color" ) - private String _colorString; - @Expose - @SerializedName( "x" ) private double _x; - @Expose - @SerializedName( "y" ) private double _y; private double _fx; private double _fy; @@ -157,7 +145,6 @@ public class Node implements java.io.Serializable protected final void setColor( Color color ) { _color = color; - _colorString = String.format( "#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue() ); } public final int getRadius() @@ -165,11 +152,6 @@ public class Node implements java.io.Serializable return 5; } - protected final void setRadius( int radius ) - { - _radius = radius; - } - public int getMaxHealth() { return 1; diff --git a/src/main/java/org/openslx/graph/ServerNode.java b/src/main/java/org/openslx/graph/ServerNode.java index c7604fc..d998a4c 100644 --- a/src/main/java/org/openslx/graph/ServerNode.java +++ b/src/main/java/org/openslx/graph/ServerNode.java @@ -10,7 +10,6 @@ public class ServerNode extends Node { super( ip, ip, null ); setDesiredDistance( 6 ); - setRadius( 15 ); setColor( Color.LIGHT_GRAY ); } -- cgit v1.2.3-55-g7522