Class Supervisor.ChildSpec

  • Enclosing class:
    Supervisor

    public static class Supervisor.ChildSpec
    extends java.lang.Object
    Describes a child actor's configuration in a supervisor
    • Constructor Summary

      Constructors 
      Constructor Description
      ChildSpec​(java.lang.String id, Supervisor.ChildMode mode, int maxRestarts, long duration, java.util.concurrent.TimeUnit unit, long shutdownDeadline, ActorBuilder<?,​?> builder)
      A new spec.
      ChildSpec​(java.lang.String id, Supervisor.ChildMode mode, int maxRestarts, long duration, java.util.concurrent.TimeUnit unit, long shutdownDeadline, ActorRef<?> actor)
      A new spec.
    • Constructor Detail

      • ChildSpec

        public ChildSpec​(java.lang.String id,
                         Supervisor.ChildMode mode,
                         int maxRestarts,
                         long duration,
                         java.util.concurrent.TimeUnit unit,
                         long shutdownDeadline,
                         ActorBuilder<?,​?> builder)
        A new spec.
        Parameters:
        id - the child's (optional) identifier (name)
        mode - the child's mode.
        maxRestarts - the maximum number of times the child actor is allowed to restart within the given duration before the supervisor gives up and kills itself.
        duration - the duration in which the number of restarts is counted towards maxRestarts.
        unit - the time unit of the duration for maxRestarts.
        shutdownDeadline - the time in milliseconds the supervisor should wait for the child actor to terminate from the time it was requested to shutdown; after the deadline expires, the child actor is terminated forcefully.
        builder - the child's builder
      • ChildSpec

        public ChildSpec​(java.lang.String id,
                         Supervisor.ChildMode mode,
                         int maxRestarts,
                         long duration,
                         java.util.concurrent.TimeUnit unit,
                         long shutdownDeadline,
                         ActorRef<?> actor)
        A new spec. This constructor takes an ActorRef to the actor rather than an ActorBuilder. If the ActorRef also implements ActorBuilder it will be used to restart the actor. ActorRefs to local actors implement ActorBuilder using Actor's reinstantiate method.
        Parameters:
        id - the child's (optional) identifier (name)
        mode - the child's mode.
        maxRestarts - the maximum number of times the child actor is allowed to restart within the given duration before the supervisor gives up and kills itself.
        duration - the duration in which the number of restarts is counted towards maxRestarts.
        unit - the time unit of the duration for maxRestarts.
        shutdownDeadline - the time in milliseconds the supervisor should wait for the child actor to terminate from the time it was requested to shutdown; after the deadline expires, the child actor is terminated forcefully.
        actor - the child actor
    • Method Detail

      • getId

        public java.lang.String getId()
        The child's (optional) identifier (name)
      • getMaxRestarts

        public int getMaxRestarts()
        The maximum number of times the child actor is allowed to restart within a given duration before the supervisor gives up and kills itself.
      • getDuration

        public long getDuration()
        The duration in which the number of restarts is counted towards the max restarts.
      • getDurationUnit

        public java.util.concurrent.TimeUnit getDurationUnit()
        The time unit of the duration for max restarts.
      • getShutdownDeadline

        public long getShutdownDeadline()
        The time in milliseconds the supervisor should wait for the child actor to terminate from the time it was requested to shutdown; after the deadline expires, the child actor is terminated forcefully.
      • toString

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