|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectakka.actor.AbstractActor
public abstract class AbstractActor
Java API: compatible with lambda expressions
Actor base class that should be extended to create Java actors that use lambdas.
Example:public class MyActor extends AbstractActor { int count = 0; public MyActor() { receive(ReceiveBuilder. match(Double.class, d -> { sender().tell(d.isNaN() ? 0 : d, self()); }). match(Integer.class, i -> { sender().tell(i * 10, self()); }). match(String.class, s -> s.startsWith("foo"), s -> { sender().tell(s.toUpperCase(), self()); }).build() ); } }
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface akka.actor.Actor |
---|
Actor.emptyBehavior$ |
Constructor Summary | |
---|---|
AbstractActor()
|
Method Summary | |
---|---|
static Actor.emptyBehavior$ |
emptyBehavior()
emptyBehavior is a Receive-expression that matches no messages at all, ever. |
AbstractActorContext |
getContext()
Returns this AbstractActor's AbstractActorContext The AbstractActorContext is not thread safe so do not expose it outside of the AbstractActor. |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function with the actor logic. |
protected void |
receive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive)
Set up the initial receive behavior of the Actor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface akka.actor.Actor |
---|
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, postRestart, postStop, preRestart, preStart, self, sender, supervisorStrategy, unhandled |
Constructor Detail |
---|
public AbstractActor()
Method Detail |
---|
public static final Actor.emptyBehavior$ emptyBehavior()
protected void receive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive)
receive
- The receive behavior.public AbstractActorContext getContext()
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
receive
in interface Actor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |