Class ActorContextAdapter<T>

    • Method Detail

      • self

        public final ActorRef<T> self()
        Description copied from interface: ActorContext
        The identity of this Actor, bound to the lifecycle of this Actor instance. An Actor with the same name that lives before or after this instance will have a different ActorRef.

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

        Specified by:
        self in interface ActorContext<T>
        Returns:
        (undocumented)
      • system

        public final ActorSystem<scala.runtime.Nothing$> system()
        Description copied from interface: ActorContext
        The ActorSystem to which this Actor belongs.

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

        Specified by:
        system in interface ActorContext<T>
        Returns:
        (undocumented)
      • children

        public scala.collection.Iterable<ActorRef<scala.runtime.Nothing$>> children()
        Description copied from interface: ActorContext
        The list of child Actors created by this Actor during its lifetime that are still alive, in no particular order.

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

        Specified by:
        children in interface ActorContext<T>
        Returns:
        (undocumented)
      • child

        public scala.Option<ActorRef<scala.runtime.Nothing$>> child​(java.lang.String name)
        Description copied from interface: ActorContext
        The named child Actor if it is alive.

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

        Specified by:
        child in interface ActorContext<T>
        Parameters:
        name - (undocumented)
        Returns:
        (undocumented)
      • spawnAnonymous

        public <U> ActorRef<U> spawnAnonymous​(Behavior<U> behavior,
                                              Props props)
        Description copied from interface: ActorContext
        Create a child Actor from the given Behavior under a randomly chosen name. It is good practice to name Actors wherever practical.

        *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.

        Specified by:
        spawnAnonymous in interface ActorContext<T>
        Specified by:
        spawnAnonymous in interface ActorContext<T>
        Parameters:
        behavior - (undocumented)
        props - (undocumented)
        Returns:
        (undocumented)
      • spawn

        public <U> ActorRef<U> spawn​(Behavior<U> behavior,
                                     java.lang.String name,
                                     Props props)
        Description copied from interface: ActorContext
        Create a child Actor from the given Behavior and with the given name.

        *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.

        Specified by:
        spawn in interface ActorContext<T>
        Specified by:
        spawn in interface ActorContext<T>
        Parameters:
        behavior - (undocumented)
        name - (undocumented)
        props - (undocumented)
        Returns:
        (undocumented)
      • spawn$default$3

        public <U> Props spawn$default$3()
        Description copied from interface: ActorContext
        Create a child Actor from the given Behavior and with the given name.

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

        Specified by:
        spawn$default$3 in interface ActorContext<T>
        Returns:
        (undocumented)
      • stop

        public <U> void stop​(ActorRef<U> child)
        Description copied from interface: ActorContext
        Force the child Actor under the given name to terminate after it finishes processing its current message. Nothing happens if the ActorRef is a child that is already stopped.

        *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.

        Specified by:
        stop in interface ActorContext<T>
        Specified by:
        stop in interface ActorContext<T>
        Parameters:
        child - (undocumented)
      • watch

        public <U> void watch​(ActorRef<U> other)
        Description copied from interface: ActorContext
        Register for Terminated notification once the Actor identified by the given ActorRef terminates. This message is also sent when the watched actor is on a node that has been removed from the cluster when using Akka Cluster.

        watch is idempotent if it is not mixed with watchWith.

        It will fail with an IllegalStateException if the same subject was watched before using watchWith. To clear the termination message, unwatch first.

        *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.

        Specified by:
        watch in interface ActorContext<T>
        Specified by:
        watch in interface ActorContext<T>
        Parameters:
        other - (undocumented)
      • watchWith

        public <U> void watchWith​(ActorRef<U> other,
                                  T msg)
        Description copied from interface: ActorContext
        Register for termination notification with a custom message once the Actor identified by the given ActorRef terminates. This message is also sent when the watched actor is on a node that has been removed from the cluster when using Akka Cluster.

        watchWith is idempotent if it is called with the same msg and not mixed with watch.

        It will fail with an IllegalStateException if the same subject was watched before using watch or watchWith with another termination message. To change the termination message, unwatch first.

        *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.

        Specified by:
        watchWith in interface ActorContext<T>
        Specified by:
        watchWith in interface ActorContext<T>
        Parameters:
        other - (undocumented)
        msg - (undocumented)
      • unwatch

        public <U> void unwatch​(ActorRef<U> other)
        Description copied from interface: ActorContext
        Revoke the registration established by watch. A Terminated notification will not subsequently be received for the referenced Actor.

        *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.

        Specified by:
        unwatch in interface ActorContext<T>
        Specified by:
        unwatch in interface ActorContext<T>
        Parameters:
        other - (undocumented)
      • receiveTimeoutMsg

        public T receiveTimeoutMsg()
      • receiveTimeoutMsg_$eq

        public void receiveTimeoutMsg_$eq​(T x$1)
      • setReceiveTimeout

        public void setReceiveTimeout​(scala.concurrent.duration.FiniteDuration d,
                                      T msg)
        Description copied from interface: ActorContext
        Schedule the sending of a notification in case no other message is received during the given period of time. The timeout starts anew with each received message. Use cancelReceiveTimeout to switch off this mechanism.

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

        Specified by:
        setReceiveTimeout in interface ActorContext<T>
        Parameters:
        d - (undocumented)
        msg - (undocumented)
      • cancelReceiveTimeout

        public void cancelReceiveTimeout()
        Description copied from interface: ActorContext
        Cancel the sending of receive timeout notifications.

        *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.

        Specified by:
        cancelReceiveTimeout in interface ActorContext<T>
        Specified by:
        cancelReceiveTimeout in interface ActorContext<T>
      • executionContext

        public scala.concurrent.ExecutionContextExecutor executionContext()
        Description copied from interface: ActorContext
        This Actor&rsquo;s execution context. It can be used to run asynchronous tasks like Future operators.

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

        Specified by:
        executionContext in interface ActorContext<T>
        Returns:
        (undocumented)
      • scheduleOnce

        public <U> Cancellable scheduleOnce​(scala.concurrent.duration.FiniteDuration delay,
                                            ActorRef<U> target,
                                            U msg)
        Description copied from interface: ActorContext
        Schedule the sending of the given message to the given target Actor after the given time period has elapsed. The scheduled action can be cancelled by invoking Cancellable.cancel() on the returned handle.

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

        Specified by:
        scheduleOnce in interface ActorContext<T>
        Parameters:
        delay - (undocumented)
        target - (undocumented)
        msg - (undocumented)
        Returns:
        (undocumented)
      • internalSpawnMessageAdapter

        public <U> ActorRef<U> internalSpawnMessageAdapter​(scala.Function1<U,​T> f,
                                                           java.lang.String _name)
        Description copied from interface: ActorContextImpl
        INTERNAL API: Needed to make Scala 2.12 compiler happy if spawnMessageAdapter is overloaded for scaladsl/javadsl. Otherwise "ambiguous reference to overloaded definition" because Function is lambda.
        Specified by:
        internalSpawnMessageAdapter in interface ActorContextImpl<T>
        Parameters:
        f - (undocumented)
        _name - (undocumented)
        Returns:
        (undocumented)
      • onUnhandled

        public void onUnhandled​(T msg)
        Made accessible to allow stash to deal with unhandled messages as though they were interpreted by the adapter itself, even though the unstashing occurs inside the behavior stack.
        Specified by:
        onUnhandled in interface ActorContext<T>
        Parameters:
        msg - (undocumented)