Dmitry  Adonin
Dmitry Adonin

Reputation: 1204

Getting Akka actor self-reference difference

I use Akka framework with Java API, so then I try to understand source code of framework - I can't, because it's written in Scala, unfortunately I don't know this language. So, what is the difference between getting ActorRef pointing to self with self() and getSelf() method?

UPDATE: And what about context() and getContext()? I've noticed they return objects of different types within actor, extended from UntypedActor.

Upvotes: 1

Views: 1785

Answers (2)

Endre Varga
Endre Varga

Reputation: 1863

self() is the idiomatic scala API and getSelf() is the idiomatic Java API. They return the same value, but getSelf() is only accessible from subclasses of UntypedActor which is the class to be extended from Java to implement actors.

Upvotes: 4

Jean Logeart
Jean Logeart

Reputation: 53869

There is no difference: they point to the same final value.

Upvotes: 3

Related Questions