Package akka.actor

Class UntypedAbstractActor

  • All Implemented Interfaces:
    Actor

    public abstract class UntypedAbstractActor
    extends AbstractActor
    If the validation of the ReceiveBuilder match logic turns out to be a bottleneck for some of your actors you can consider to implement it at lower level by extending UntypedAbstractActor instead of AbstractActor. The partial functions created by the ReceiveBuilder consist of multiple lambda expressions for every match statement, where each lambda is referencing the code to be run. This is something that the JVM can have problems optimizing and the resulting code might not be as performant as the untyped version. When extending UntypedAbstractActor each message is received as an untyped Object and you have to inspect and cast it to the actual message type in other ways (instanceof checks).
    • Constructor Detail

      • UntypedAbstractActor

        public UntypedAbstractActor()
    • Method Detail

      • onReceive

        public abstract void onReceive​(java.lang.Object message)
                                throws java.lang.Throwable
        To be implemented by concrete UntypedAbstractActor, this defines the behavior of the actor.
        Throws:
        java.lang.Throwable
      • receive

        public scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receive()
        Description copied from interface: Actor
        Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
        Specified by:
        receive in interface Actor
        Overrides:
        receive in class AbstractActor