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
06346ee3
Commit
06346ee3
authored
Aug 23, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'unified' main() of client and server
parent
67683923
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
34 deletions
+32
-34
benchmarks/scala/Distributed.scala
benchmarks/scala/Distributed.scala
+32
-34
No files found.
benchmarks/scala/Distributed.scala
View file @
06346ee3
...
...
@@ -313,10 +313,7 @@ class AkkaClientActor(system: ActorSystem) extends AkkaActor {
}
}
object
DistributedClientApp
{
val
NumPings
=
"num_pings=([0-9]+)"
.
r
val
SimpleUri
=
"([0-9a-zA-Z\\.]+):([0-9]+)"
.
r
object
Distributed
{
@tailrec
def
run
(
args
:
List
[
String
],
paths
:
List
[
String
],
numPings
:
Option
[
Int
],
finalizer
:
(
List
[
String
],
Int
)
=>
Unit
)
:
Unit
=
args
match
{
case
NumPings
(
num
)
::
tail
=>
numPings
match
{
...
...
@@ -333,13 +330,26 @@ object DistributedClientApp {
}
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
try
{
args
(
0
)
match
{
case
"remote_actors"
=>
run
(
args
.
toList
.
drop
(
1
),
Nil
,
None
,
((
paths
,
x
)
=>
{
val
IntStr
=
"([0-9]+)"
.
r
val
NumPings
=
"num_pings=([0-9]+)"
.
r
val
SimpleUri
=
"([0-9a-zA-Z\\.]+):([0-9]+)"
.
r
def
main
(
args
:
Array
[
String
])
:
Unit
=
args
match
{
// server mode
case
Array
(
"mode=server"
,
"remote_actors"
,
IntStr
(
istr
))
=>
(
new
ServerActor
(
istr
.
toInt
)).
start
case
Array
(
"mode=server"
,
"akka"
)
=>
{
val
system
=
ActorSystem
(
"pongServer"
,
ConfigFactory
.
load
.
getConfig
(
"pongServer"
))
val
pong
=
system
.
actorOf
(
Props
(
new
AkkaServerActor
(
system
)),
"pong"
)
Unit
}
// client mode
case
Array
(
"mode=benchmark"
,
"remote_actors"
,
_
*)
=>
{
run
(
args
.
toList
.
drop
(
2
),
Nil
,
None
,
((
paths
,
x
)
=>
{
(
new
ClientActor
(
paths
map
(
path
=>
path
match
{
case
SimpleUri
(
host
,
port
)
=>
RemoteActorPath
(
path
,
host
,
port
.
toInt
)
}),
x
)).
start
}))
case
"akka"
=>
run
(
args
.
toList
.
drop
(
1
),
Nil
,
None
,
((
paths
,
x
)
=>
{
}
case
Array
(
"mode=benchmark"
,
"akka"
,
_
*)
=>
{
run
(
args
.
toList
.
drop
(
2
),
Nil
,
None
,
((
paths
,
x
)
=>
{
val
system
=
ActorSystem
(
"benchmark"
,
ConfigFactory
.
load
.
getConfig
(
"benchmark"
))
system
.
actorOf
(
Props
(
new
AkkaClientActor
(
system
)))
!
RunAkkaClient
(
paths
,
x
)
global
.
latch
.
await
...
...
@@ -347,28 +357,16 @@ object DistributedClientApp {
System
.
exit
(
0
)
}))
}
}
catch
{
case
e
=>
{
println
(
"usage: DistributedClientApp (remote_actors|akka) {nodes...} num_pings={num}\nexample: DistributedClientApp remote_actors localhost:1234 localhost:2468 num_pings=1000\n"
)
throw
e
}
// error
case
_
=>
{
println
(
"Running in server mode:\n"
+
" mode=server\n"
+
" remote_actors PORT *or* akka\n"
+
"\n"
+
"Running the benchmark:\n"
+
" mode=benchmark\n"
+
" remote_actors ... *or* akka\n"
);
}
}
}
object
DistributedServerApp
{
val
IntStr
=
"([0-9]+)"
.
r
def
main
(
args
:
Array
[
String
])
:
Unit
=
args
match
{
case
Array
(
"remote_actors"
,
IntStr
(
istr
))
=>
(
new
ServerActor
(
istr
.
toInt
)).
start
case
Array
(
"akka"
)
=>
{
val
system
=
ActorSystem
(
"pongServer"
,
ConfigFactory
.
load
.
getConfig
(
"pongServer"
))
val
pong
=
system
.
actorOf
(
Props
(
new
AkkaServerActor
(
system
)),
"pong"
)
Unit
}
case
_
=>
println
(
"usage: DistributedServerApp remote_actors PORT\n"
+
" or: DistributedServerApp akka"
)
}
}
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