Interface AbstractActor.ActorContext

    • Method Detail

      • become

        void become​(AbstractActor.Receive behavior)
        Changes the Actor's behavior to become the new 'Receive' handler. Replaces the current behavior on the top of the behavior stack.

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • become

        void become​(AbstractActor.Receive behavior,
                    boolean discardOld)
        Changes the Actor's behavior to become the new 'Receive' handler. This method acts upon the behavior stack as follows:

        - if discardOld = true it will replace the top element (i.e. the current behavior) - if discardOld = false it will keep the current behavior and push the given one atop

        The default of replacing the current behavior on the stack has been chosen to avoid memory leaks in case client code is written without consulting this documentation first (i.e. always pushing new behaviors and never issuing an unbecome())

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • cancelReceiveTimeout

        void cancelReceiveTimeout()
        Cancel the sending of receive timeout notifications.
      • findChild

        java.util.Optional<ActorRef> findChild​(java.lang.String name)
        Returns a reference to the named child if it exists.

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • getChildren

        java.lang.Iterable<ActorRef> getChildren()
        Returns an unmodifiable Java Collection containing the linked actors

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • getDispatcher

        scala.concurrent.ExecutionContextExecutor getDispatcher()
        Returns the dispatcher (MessageDispatcher) that is used for this Actor.

        This method is thread-safe and can be called from other threads than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.

      • getParent

        ActorRef getParent()
        Returns the supervisor of this actor.

        Same as parent().

        This method is thread-safe and can be called from other threads than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • getProps

        Props getProps()
        Retrieve the Props which were used to create this actor.

        This method is thread-safe and can be called from other threads than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.

      • getReceiveTimeout

        java.time.Duration getReceiveTimeout()
        Gets the current receive timeout. When specified, the receive method should be able to handle a pekko.actor.ReceiveTimeout message.

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.

      • getSelf

        ActorRef getSelf()
        The ActorRef representing this actor

        This method is thread-safe and can be called from other threads than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.

      • getSender

        ActorRef getSender()
        Returns the sender 'ActorRef' of the current message.

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.

      • getSystem

        ActorSystem getSystem()
        Returns the system this actor is running in.

        Same as system()

        This method is thread-safe and can be called from other threads than the ordinary actor message processing thread, such as CompletionStage callbacks.

      • setReceiveTimeout

        void setReceiveTimeout​(java.time.Duration timeout)
        Defines the inactivity timeout after which the sending of a pekko.actor.ReceiveTimeout message is triggered. When specified, the receive function should be able to handle a pekko.actor.ReceiveTimeout message. 1 millisecond is the minimum supported timeout.

        Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is '''not guaranteed''' that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method.

        Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity periods). Pass in Duration.Undefined to switch off this feature.

        Messages marked with NotInfluenceReceiveTimeout will not reset the timer. This can be useful when ReceiveTimeout should be fired by external inactivity but not influenced by internal activity, e.g. scheduled tick messages.

        *Warning*: This method is not thread-safe and must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage and Future callbacks.