In Akka/Scala one is able to pass parameters to the custom receive function, so it is possible to pass the whole actor state through params, without using mutable variables.
context.become(myCustomReceive(param1, param2))
But in Java Api you can pass only Procedure which gets the received message as the only param
getContext().become( new Procedure<Object> {
public void apply(Object param) throws Exception
{
// ...
}
}
Is there a clean way to do the same trick in Java?