pankaj

Reverse the order of test to unblock the channel from async tests

1 package org.onlab.onos.foo; 1 package org.onlab.onos.foo;
2 2
3 +import static java.lang.Thread.sleep;
4 +
3 import java.io.IOException; 5 import java.io.IOException;
4 import java.util.concurrent.ExecutionException; 6 import java.util.concurrent.ExecutionException;
5 import java.util.concurrent.TimeUnit; 7 import java.util.concurrent.TimeUnit;
...@@ -79,15 +81,6 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class); ...@@ -79,15 +81,6 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
79 response.get(100000, TimeUnit.MILLISECONDS); 81 response.get(100000, TimeUnit.MILLISECONDS);
80 } 82 }
81 83
82 - log.info("measuring async sender");
83 - Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender");
84 -
85 - for (int i = 0; i < iterations; i++) {
86 - Timer.Context context = sendAsyncTimer.time();
87 - messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
88 - context.stop();
89 - }
90 -
91 log.info("measuring round-trip send & receive"); 84 log.info("measuring round-trip send & receive");
92 Timer sendAndReceiveTimer = metrics.createTimer(component, feature, "SendAndReceive"); 85 Timer sendAndReceiveTimer = metrics.createTimer(component, feature, "SendAndReceive");
93 int timeouts = 0; 86 int timeouts = 0;
...@@ -108,6 +101,17 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class); ...@@ -108,6 +101,17 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
108 } 101 }
109 // System.out.println("Got back:" + new String(response.get(2, TimeUnit.SECONDS))); 102 // System.out.println("Got back:" + new String(response.get(2, TimeUnit.SECONDS)));
110 } 103 }
104 +
105 + sleep(1000);
106 + log.info("measuring async sender");
107 + Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender");
108 +
109 + for (int i = 0; i < iterations; i++) {
110 + Timer.Context context = sendAsyncTimer.time();
111 + messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
112 + context.stop();
113 + }
114 + sleep(1000);
111 } 115 }
112 116
113 public static void stop() { 117 public static void stop() {
......
...@@ -25,7 +25,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand { ...@@ -25,7 +25,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
25 25
26 @Argument(index = 2, name = "warmupCount", description = "Warm-up count", 26 @Argument(index = 2, name = "warmupCount", description = "Warm-up count",
27 required = false, multiValued = false) 27 required = false, multiValued = false)
28 - String warmupCount = "10000"; 28 + String warmupCount = "1000";
29 29
30 @Argument(index = 3, name = "messageCount", description = "Message count", 30 @Argument(index = 3, name = "messageCount", description = "Message count",
31 required = false, multiValued = false) 31 required = false, multiValued = false)
......