use become() from Java

You are confusing Akka Java and Scala API. Technically you can use Scala libraries like Akka from Java code, but quite often it's verbose and cumbersome. So the Akka team decided to develop to separate APIs - native in Scala and Java adapter.

In Scala API you extend akka.actor.Actor which has a context field of type akka.actor.ActorContext. This ActorContext.become() accepts PartialFunction, which is a Scala-specific class.

On the other hand in Java API you extend akka.actor.UntypedActor having (Java-like) method getContext(), returning akka.actor.UntypedActorContext. This one accepts akka.japi.Procedure.

To cut the long story short - if you are using Java API, stick to it. There is a clear distinction between Scala and Java documentation.

Tags:

Java

Akka