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
Madan Jampani
2014-10-07 17:43:49 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f4f6fe235f28126f4e96c77568df4c43a598cf71
f4f6fe23
1 parent
38bd145d
Removed files that no longer needed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
63 deletions
utils/netty/src/main/java/org/onlab/netty/SimpleClient.java
utils/netty/src/main/java/org/onlab/netty/SimpleServer.java
utils/netty/src/main/java/org/onlab/netty/SimpleClient.java
deleted
100644 → 0
View file @
38bd145
package
org
.
onlab
.
netty
;
import
java.util.concurrent.TimeUnit
;
import
org.onlab.metrics.MetricsComponent
;
import
org.onlab.metrics.MetricsFeature
;
import
org.onlab.metrics.MetricsManager
;
import
com.codahale.metrics.Timer
;
// FIXME: Should be move out to test or app
public
final
class
SimpleClient
{
private
SimpleClient
()
{
}
public
static
void
main
(
String
...
args
)
throws
Exception
{
NettyMessagingService
messaging
=
new
TestNettyMessagingService
(
9081
);
MetricsManager
metrics
=
new
MetricsManager
();
messaging
.
activate
();
metrics
.
activate
();
MetricsFeature
feature
=
new
MetricsFeature
(
"timers"
);
MetricsComponent
component
=
metrics
.
registerComponent
(
"NettyMessaging"
);
Timer
sendAsyncTimer
=
metrics
.
createTimer
(
component
,
feature
,
"AsyncSender"
);
final
int
warmup
=
100
;
for
(
int
i
=
0
;
i
<
warmup
;
i
++)
{
Timer
.
Context
context
=
sendAsyncTimer
.
time
();
messaging
.
sendAsync
(
new
Endpoint
(
"localhost"
,
8080
),
"simple"
,
"Hello World"
.
getBytes
());
context
.
stop
();
}
metrics
.
registerMetric
(
component
,
feature
,
"AsyncTimer"
,
sendAsyncTimer
);
Timer
sendAndReceiveTimer
=
metrics
.
createTimer
(
component
,
feature
,
"SendAndReceive"
);
final
int
iterations
=
1000000
;
for
(
int
i
=
0
;
i
<
iterations
;
i
++)
{
Timer
.
Context
context
=
sendAndReceiveTimer
.
time
();
Response
response
=
messaging
.
sendAndReceive
(
new
Endpoint
(
"localhost"
,
8080
),
"echo"
,
"Hello World"
.
getBytes
());
System
.
out
.
println
(
"Got back:"
+
new
String
(
response
.
get
(
2
,
TimeUnit
.
SECONDS
)));
context
.
stop
();
}
metrics
.
registerMetric
(
component
,
feature
,
"AsyncTimer"
,
sendAndReceiveTimer
);
}
public
static
class
TestNettyMessagingService
extends
NettyMessagingService
{
public
TestNettyMessagingService
(
int
port
)
throws
Exception
{
super
(
port
);
}
}
}
utils/netty/src/main/java/org/onlab/netty/SimpleServer.java
deleted
100644 → 0
View file @
38bd145
package
org
.
onlab
.
netty
;
//FIXME: Should be move out to test or app
public
final
class
SimpleServer
{
private
SimpleServer
()
{}
public
static
void
main
(
String
...
args
)
throws
Exception
{
NettyMessagingService
server
=
new
NettyMessagingService
(
8080
);
server
.
activate
();
server
.
registerHandler
(
"simple"
,
new
LoggingHandler
());
server
.
registerHandler
(
"echo"
,
new
EchoHandler
());
}
}
Please
register
or
login
to post a comment