Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
pankaj
2014-10-08 16:42:36 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
28c356480bbfbd60ce0ee1e547c0a28ab0ff0057
28c35648
1 parent
915d95b6
endpoint needs to be created once
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
View file @
28c3564
...
...
@@ -41,6 +41,7 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
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 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
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 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
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 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
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
();
...
...
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
View file @
28c3564
...
...
@@ -16,7 +16,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
//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
host
name
=
"localhost"
;
@Argument
(
index
=
3
,
name
=
"port"
,
description
=
"Port"
,
required
=
false
,
multiValued
=
false
)
...
...
@@ -24,7 +24,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
@Argument
(
index
=
1
,
name
=
"warmupCount"
,
description
=
"Warm-up count"
,
required
=
false
,
multiValued
=
false
)
String
warmup
=
"1000"
;
String
warmup
Count
=
"1000"
;
@Argument
(
index
=
2
,
name
=
"messageCount"
,
description
=
"Message count"
,
required
=
false
,
multiValued
=
false
)
...
...
@@ -33,10 +33,9 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
try
{
startStandalone
(
new
String
[]{
host
,
port
,
warmup
,
messageCount
});
startStandalone
(
new
String
[]{
host
name
,
port
,
warmupCount
,
messageCount
});
}
catch
(
Exception
e
)
{
error
(
"Unable to start client %s"
,
e
);
}
}
}
...
...
Please
register
or
login
to post a comment