endpoint needs to be created once
diff --git a/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java b/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
index 06daad8..abe9192 100644
--- a/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
+++ b/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
@@ -41,6 +41,7 @@
int iterations = args.length > 3 ? Integer.parseInt(args[3]) : 50 * 100000;
NettyMessagingService messaging = new TestNettyMessagingService(9081);
MetricsManager metrics = new MetricsManager();
+ Endpoint endpoint = new Endpoint(host, port);
messaging.activate();
metrics.activate();
MetricsFeature feature = new MetricsFeature("latency");
@@ -48,9 +49,9 @@
log.info("warmup....");
for (int i = 0; i < warmup; i++) {
- messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes());
+ messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
Response response = messaging
- .sendAndReceive(new Endpoint(host, port), "echo",
+ .sendAndReceive(endpoint, "echo",
"Hello World".getBytes());
}
@@ -59,7 +60,7 @@
for (int i = 0; i < iterations; i++) {
Timer.Context context = sendAsyncTimer.time();
- messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes());
+ messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
context.stop();
}
@@ -67,7 +68,7 @@
for (int i = 0; i < iterations; i++) {
Timer.Context context = sendAndReceiveTimer.time();
Response response = messaging
- .sendAndReceive(new Endpoint(host, port), "echo",
+ .sendAndReceive(endpoint, "echo",
"Hello World".getBytes());
// System.out.println("Got back:" + new String(response.get(2, TimeUnit.SECONDS)));
context.stop();
diff --git a/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java b/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
index cce31db..143d319 100644
--- a/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
+++ b/apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
@@ -16,7 +16,7 @@
//FIXME: replace these arguments with proper ones needed for the test.
@Argument(index = 0, name = "hostname", description = "Server Hostname",
required = false, multiValued = false)
- String host = "localhost";
+ String hostname = "localhost";
@Argument(index = 3, name = "port", description = "Port",
required = false, multiValued = false)
@@ -24,7 +24,7 @@
@Argument(index = 1, name = "warmupCount", description = "Warm-up count",
required = false, multiValued = false)
- String warmup = "1000";
+ String warmupCount = "1000";
@Argument(index = 2, name = "messageCount", description = "Message count",
required = false, multiValued = false)
@@ -33,10 +33,9 @@
@Override
protected void execute() {
try {
- startStandalone(new String[]{host, port, warmup, messageCount});
+ startStandalone(new String[]{hostname, port, warmupCount, messageCount});
} catch (Exception e) {
error("Unable to start client %s", e);
}
}
-
}