Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
23b3dee4
Commit
23b3dee4
authored
Apr 26, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
num argument
parent
aa1db2b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
benchmarks/PingPong.scala
benchmarks/PingPong.scala
+4
-4
No files found.
benchmarks/PingPong.scala
View file @
23b3dee4
...
@@ -12,9 +12,9 @@ object global {
...
@@ -12,9 +12,9 @@ object global {
val
latch
=
new
java
.
util
.
concurrent
.
CountDownLatch
(
1
)
val
latch
=
new
java
.
util
.
concurrent
.
CountDownLatch
(
1
)
}
}
class
PingActor
(
pong
:
akka.actor.ActorRef
)
extends
akka
.
actor
.
Actor
{
class
PingActor
(
num
:
Int
,
pong
:
akka.actor.ActorRef
)
extends
akka
.
actor
.
Actor
{
def
receive
=
{
def
receive
=
{
case
Pong
(
1000
)
=>
{
case
Pong
(
value
)
if
value
==
num
=>
{
//println("Received final pong")
//println("Received final pong")
global
.
latch
.
countDown
global
.
latch
.
countDown
self
.
exit
self
.
exit
...
@@ -40,13 +40,13 @@ class PongActor extends akka.actor.Actor {
...
@@ -40,13 +40,13 @@ class PongActor extends akka.actor.Actor {
object
pingApp
{
object
pingApp
{
def
main
(
args
:
Array
[
String
])
=
{
def
main
(
args
:
Array
[
String
])
=
{
if
(
args
.
size
!=
2
)
{
if
(
args
.
size
!=
3
)
{
println
(
"usage: pingApp (host) (port)"
)
println
(
"usage: pingApp (host) (port)"
)
println
(
" (connects to pong-service of (host) on given port)"
)
println
(
" (connects to pong-service of (host) on given port)"
)
System
.
exit
(
1
)
System
.
exit
(
1
)
}
}
val
pong
=
remote
.
actorFor
(
"pong-service"
,
args
(
0
),
args
(
1
).
toInt
)
val
pong
=
remote
.
actorFor
(
"pong-service"
,
args
(
0
),
args
(
1
).
toInt
)
val
myPing
=
actorOf
(
new
PingActor
(
pong
)).
start
val
myPing
=
actorOf
(
new
PingActor
(
args
(
2
).
toInt
,
pong
)).
start
remote
.
start
(
"localhost"
,
64002
).
register
(
"ping-service"
,
myPing
)
remote
.
start
(
"localhost"
,
64002
).
register
(
"ping-service"
,
myPing
)
myPing
!
KickOff
myPing
!
KickOff
global
.
latch
.
await
global
.
latch
.
await
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment