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
975b8ccb
Commit
975b8ccb
authored
Aug 31, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more consistent become() usage
parent
e63cd5e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
benchmarks/scala/MixedCase.scala
benchmarks/scala/MixedCase.scala
+18
-17
No files found.
benchmarks/scala/MixedCase.scala
View file @
975b8ccb
...
@@ -155,28 +155,29 @@ class AkkaWorker(supervisor: AkkaActorRef) extends AkkaActor {
...
@@ -155,28 +155,29 @@ class AkkaWorker(supervisor: AkkaActorRef) extends AkkaActor {
class
AkkaChainLink
(
next
:
AkkaActorRef
)
extends
AkkaActor
{
class
AkkaChainLink
(
next
:
AkkaActorRef
)
extends
AkkaActor
{
def
receive
=
{
def
receive
=
{
case
Token
(
value
)
=>
next
!
Token
(
value
);
if
(
value
==
0
)
context
.
stop
(
self
)
case
Token
(
value
)
=>
{
next
!
Token
(
value
)
if
(
value
==
0
)
context
.
stop
(
self
)
}
}
}
}
}
class
AkkaChainMaster
(
supervisor
:
akka.actor.ActorRef
)
extends
akka
.
actor
.
Actor
{
class
AkkaChainMaster
(
supervisor
:
AkkaActorRef
)
extends
AkkaActor
{
var
initialTokenValue
=
0
var
repetitions
=
0
var
iteration
=
0
var
rsize
=
0
var
next
:
akka.actor.ActorRef
=
null
val
worker
=
context
.
actorOf
(
Props
(
new
AkkaWorker
(
supervisor
)))
val
worker
=
context
.
actorOf
(
Props
(
new
AkkaWorker
(
supervisor
)))
@tailrec
final
def
newRing
(
next
:
akka.actor.ActorRef
,
rsize
:
Int
)
:
akka.actor.ActorRef
=
{
@tailrec
final
def
newRing
(
next
:
AkkaActorRef
,
rsize
:
Int
)
:
AkkaActorRef
=
{
if
(
rsize
==
0
)
next
if
(
rsize
==
0
)
next
else
newRing
(
context
.
actorOf
(
Props
(
new
AkkaChainLink
(
next
))),
rsize
-
1
)
else
newRing
(
context
.
actorOf
(
Props
(
new
AkkaChainLink
(
next
))),
rsize
-
1
)
}
}
def
initialized
:
Receive
=
{
def
initialized
(
ringSize
:
Int
,
initialTokenValue
:
Int
,
repetitions
:
Int
,
next
:
AkkaActorRef
,
iteration
:
Int
)
:
Receive
=
{
case
Token
(
0
)
=>
case
Token
(
0
)
=>
iteration
+=
1
if
(
iteration
+
1
<
repetitions
)
{
if
(
iteration
<
repetitions
)
{
worker
!
Calc
(
global
.
taskN
)
worker
!
Calc
(
global
.
taskN
)
next
=
newRing
(
self
,
rsize
-
1
)
val
next
=
newRing
(
self
,
ringSize
-
1
)
next
!
Token
(
initialTokenValue
)
next
!
Token
(
initialTokenValue
)
context
.
become
(
initialized
(
ringSize
,
initialTokenValue
,
repetitions
,
next
,
iteration
+
1
))
}
}
else
else
{
{
...
@@ -186,17 +187,17 @@ class AkkaChainMaster(supervisor: akka.actor.ActorRef) extends akka.actor.Actor
...
@@ -186,17 +187,17 @@ class AkkaChainMaster(supervisor: akka.actor.ActorRef) extends akka.actor.Actor
}
}
case
Token
(
value
)
=>
next
!
Token
(
value
-
1
)
case
Token
(
value
)
=>
next
!
Token
(
value
-
1
)
}
}
def
receive
=
{
def
receive
=
{
case
Init
(
rs
,
itv
,
rep
)
=>
case
Init
(
rs
,
itv
,
rep
)
=>
rsize
=
rs
;
initialTokenValue
=
itv
;
repetitions
=
rep
worker
!
Calc
(
global
.
taskN
)
worker
!
Calc
(
global
.
taskN
)
next
=
newRing
(
self
,
rsize
-
1
)
val
next
=
newRing
(
self
,
rs
-
1
)
next
!
Token
(
i
nitialTokenValue
)
next
!
Token
(
i
tv
)
context
.
become
(
initialized
)
context
.
become
(
initialized
(
rs
,
itv
,
rep
,
next
,
0
)
)
}
}
}
}
class
AkkaSupervisor
(
numMessages
:
Int
)
extends
akka
.
actor
.
Actor
{
class
AkkaSupervisor
(
numMessages
:
Int
)
extends
Akka
Actor
{
var
i
=
0
var
i
=
0
def
inc
()
{
def
inc
()
{
i
+=
1
;
i
+=
1
;
...
...
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