Things that were important enough at the time when they were written.

Viktor Klang is a legendary programmer, known from places like the Internet. Consider following him on Twitter.

Posts tagged actors

Mar 6

Implementing PostStart in #Akka

This question comes up every now and then, and my answer has since the first time, been refined, so I thought I’d give the answer here.

"How do I run some initialization logic in the thread of the dispatcher and not the creator of the actor?"

I present to you, PostStart:

If you can’t see the code, click here



Dec 28

All #Actors in #Scala - compared

As a late Christmas present I bring this to you dear readers:

I recently invited David Pollak (of Lift fame), Jason Zaugg (of Scalaz fame), Philipp Haller (of Scala Actors fame) and myself to collaborate on a feature matrix that would allow people to see the similarities and differences between the Actor libraries on the Scala platform.

So I’d like to start out by thanking David, Jason, Runar, Jonas, Philipp, Martin and all the people involved in these great projects for taking the time to fill out the matrix.

Here’s a link to a PDF-version of the document, enjoy!

PS. I attempted to embed the comparison to this blog post, but the formatting simply goes haywire. DS.

Dec 27

√iktor needs your help!

I’ve got some ideas for conference/group talks that I have yet to assemble, but I thought I’d let the community have a vote in what they’d think be interesting.

Proposal 1:

Git things done

Approx time: 45 minutes

"This is a case-study on moving from CVS/SVN to Git I did at a previous employer. It’s about the challenges faced - cultural problems, technical problems, process problems and touches areas like: Code reviews, agile&lean (Scrum/Kanban), pragmatisism and corporate politics."

Proposal 2:

The Kay Way - True Object Orientation

Approx time: 30 minutes

"This talk explores OO using Actors, a model of concurrency that encapsulates Alan Kays original concept of object-orientation, showing different models of composition and inheritance, message-passing, asynchronous and synchronous messaging using the Akka framework"

Proposal 3:

Faster, Harder, Actor

Approx time: 25 minutes

"At the very core of Akka lies the Executor-Based-Event-Driven-Dispatcher, or EBEDD as we call it for short. This talk goes through its design and how it manages to provide the best default for Akka Actors in terms of performance and reliability and what configuration is possible to tune it for your workloads."

Proposal 4:


Approx time: 20 minutes

"This talk is some tips and tricks to write Scala-code that can be easily consumed by Java code, with dos and don’ts and examples from Scala projects."

So what I need from you is to comment on this blog post what you’ find interesting of the above mentioned proposals, or if you have any other suggestions on what you’d like for me to present.

Thanks for helping me out!

Nov 27

The self matters

What’s new in Akka 1.0-RC1 is that HotSwap now takes the following signature:

case class HotSwap(code: ActorRef => Actor.Receive, discardOld: Boolean = true)

Before it only had:

case class HotSwap(code: Actor.Receive)

So what’s new is that you can use the “discardOld” parameter to control if you want behaviors to be stacked or not. “discardOld = true” will essentially issue an “unbecome” before it applies the new code.

The problem with HotSwap before was that you couldn’t have any reference to “self”, and that became a major pain in the rear, so we changed the signature to be a function from ActorRef to Receive, and the parameter passed to that function will be “self”.

So now you can do:

val newBehavior = (self:ActorRef) => {

  case msg => self.reply(“Service temporarily unavailable”)

}: Receive

and send it to any actor:

actorRef ! HotSwap(newBehavior)

Happy hAkking!

Aug 17

Dining hakkers

Ladies and gentlemen,

I got inspired reading Actors all the way down so without more BS, I present to you:

Dining Hakkers implemented in Akka using the ActorModel

Can’t see the code?