Class Supervisor

    • Constructor Detail

    • Method Detail

      • addChild

        public final <T extends ActorRef<M>,​M> T addChild​(Supervisor.ChildSpec spec)
                                                         throws SuspendExecution,
                                                                java.lang.InterruptedException
        Adds a new child actor to the supervisor. If the child has not been started, it will be started by the supervisor. This method does not block when called from within the Supervisor's context, so, in particular, it may be called by an actor constructor, constructed by the supervisor.
        Parameters:
        spec - the child's spec.
        Returns:
        the actor (possibly after it has been started by the supervisor).
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • getChild

        public final <T extends ActorRef<M>,​M> T getChild​(java.lang.Object id)
                                                         throws SuspendExecution,
                                                                java.lang.InterruptedException
        Retrieves a child actor by its id This method does not block when called from within the Supervisor's context, so, in particular, it may be called by an actor constructor, constructed by the supervisor.
        Parameters:
        id - the child's id in the supervisor.
        Returns:
        the child, if found; null if the child was not found
        Throws:
        SuspendExecution
        java.lang.InterruptedException
      • getChildren

        public final java.util.List<? extends ActorRef<?>> getChildren()
                                                                throws SuspendExecution,
                                                                       java.lang.InterruptedException
        Retrieves the children actor references as an immutable list. This method does not block when called from within the Supervisor's context, so, in particular, it may be called by an actor constructor, constructed by the supervisor.
        Returns:
        the children ActorRefs.
        Throws:
        SuspendExecution
        java.lang.InterruptedException
      • removeChild

        public final boolean removeChild​(java.lang.Object id,
                                         boolean terminate)
                                  throws SuspendExecution,
                                         java.lang.InterruptedException
        Removes a child actor from the supervisor. This method does not block when called from within the Supervisor's context, so, in particular, it may be called by an actor constructor, constructed by the supervisor.
        Parameters:
        id - the child's id in the supervisor.
        terminate - whether or not the supervisor should terminate the actor
        Returns:
        true if the actor has been successfully removed from the supervisor; false if the child was not found.
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • removeChild

        public boolean removeChild​(ActorRef<?> actor,
                                   boolean terminate)
                            throws SuspendExecution,
                                   java.lang.InterruptedException
        Removes a child actor from the supervisor. This method does not block when called from within the Supervisor's context, so, in particular, it may be called by an actor constructor, constructed by the supervisor.
        Parameters:
        actor - the child actor
        terminate - whether or not the supervisor should terminate the actor
        Returns:
        true if the actor has been successfully removed from the supervisor; false if the child was not found.
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class ActorRef<java.lang.Object>