Package org.apache.storm.daemon.supervisor

## Class Supervisor

- java.lang.Object
- - org.apache.storm.daemon.supervisor.Supervisor

- All Implemented Interfaces:
    `AutoCloseable`, `DaemonCommon`

      public class Supervisor
      extends Object
      implements DaemonCommon, AutoCloseable

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Supervisor​(Map<String,​Object> conf, IContext sharedContext, ISupervisor iSupervisor, StormMetricsRegistry metricsRegistry)` | Constructor for supervisor daemon.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `checkAuthorization​(String operation)` |
    `void` | `checkAuthorization​(String topoName, Map<String,​Object> topoConf, String operation)` |
    `void` | `checkAuthorization​(String topoName, Map<String,​Object> topoConf, String operation, ReqContext context)` |
    `void` | `close()` |
    `String` | `getAssignmentId()` |
    `Map<String,​Object>` | `getConf()` |
    `AtomicReference<Map<Long,​LocalAssignment>>` | `getCurrAssignment()` |
    `ExecutorService` | `getHeartbeatExecutor()` | Get the executor service that is supposed to be used for heart-beats.
    `String` | `getHostName()` |
    `String` | `getId()` |
    `ISupervisor` | `getiSupervisor()` |
    `Nimbus.Iface` | `getLocalNimbus()` |
    `StormMetricsRegistry` | `getMetricsRegistry()` |
    `ReadClusterState` | `getReadClusterState()` |
    `IStormClusterState` | `getStormClusterState()` |
    `String` | `getStormVersion()` |
    `Supervisor.Iface` | `getSupervisorThriftInterface()` |
    `int` | `getThriftServerPort()` |
    `Utils.UptimeComputer` | `getUpTime()` |
    `boolean` | `isWaiting()` |
    `void` | `launch()` | Launch the supervisor.
    `void` | `launchDaemon()` | start distribute supervisor.
    `static void` | `main​(String[] args)` | supervisor daemon enter entrance.
    `void` | `sendSupervisorAssignments​(SupervisorAssignments assignments)` | Used for local cluster assignments distribution.
    `void` | `setLocalNimbus​(Nimbus.Iface nimbus)` |
    `void` | `shutdownAllWorkers​(BiConsumer<Slot,​Long> onWarnTimeout, UniFunc<Slot> onErrorTimeout)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Supervisor

          public Supervisor​(Map<String,​Object> conf,
                            IContext sharedContext,
                            ISupervisor iSupervisor,
                            StormMetricsRegistry metricsRegistry)
                     throws IOException,
                            IllegalAccessException,
                            ClassNotFoundException,
                            InstantiationException

      Constructor for supervisor daemon.
      Parameters:
        `conf` - config
        `sharedContext` - `IContext`
        `iSupervisor` - `ISupervisor`
      Throws:
        `IOException`
        `IllegalAccessException`
        `ClassNotFoundException`
        `InstantiationException`

  - ### Method Detail

    - #### main

          public static void main​(String[] args)
                           throws Exception

      supervisor daemon enter entrance.
      Throws:
        `Exception`

    - #### getHeartbeatExecutor

          public ExecutorService getHeartbeatExecutor()

      Get the executor service that is supposed to be used for heart-beats.

    - #### getId

          public String getId()

    - #### getMetricsRegistry

          public StormMetricsRegistry getMetricsRegistry()

    - #### getConf

          public Map<String,​Object> getConf()

    - #### getiSupervisor

          public ISupervisor getiSupervisor()

    - #### getUpTime

          public Utils.UptimeComputer getUpTime()

    - #### getStormVersion

          public String getStormVersion()

    - #### getStormClusterState

          public IStormClusterState getStormClusterState()

    - #### getReadClusterState

          public ReadClusterState getReadClusterState()

    - #### getAssignmentId

          public String getAssignmentId()

    - #### getThriftServerPort

          public int getThriftServerPort()

    - #### getHostName

          public String getHostName()

    - #### getCurrAssignment

          public AtomicReference<Map<Long,​LocalAssignment>> getCurrAssignment()

    - #### getLocalNimbus

          public Nimbus.Iface getLocalNimbus()

    - #### setLocalNimbus

          public void setLocalNimbus​(Nimbus.Iface nimbus)

    - #### launch

          public void launch()
                      throws Exception

      Launch the supervisor.
      Throws:
        `Exception`

    - #### launchDaemon

          public void launchDaemon()

      start distribute supervisor.

    - #### checkAuthorization

          public void checkAuthorization​(String operation)
                                  throws AuthorizationException

      Throws:
        `AuthorizationException`

    - #### checkAuthorization

          public void checkAuthorization​(String topoName,
                                         Map<String,​Object> topoConf,
                                         String operation)
                                  throws AuthorizationException

      Throws:
        `AuthorizationException`

    - #### checkAuthorization

          public void checkAuthorization​(String topoName,
                                         Map<String,​Object> topoConf,
                                         String operation,
                                         ReqContext context)
                                  throws AuthorizationException

      Throws:
        `AuthorizationException`

    - #### getSupervisorThriftInterface

          public Supervisor.Iface getSupervisorThriftInterface()

    - #### sendSupervisorAssignments

          public void sendSupervisorAssignments​(SupervisorAssignments assignments)

      Used for local cluster assignments distribution.
      Parameters:
        `assignments` - `SupervisorAssignments`

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

    - #### shutdownAllWorkers

          public void shutdownAllWorkers​(BiConsumer<Slot,​Long> onWarnTimeout,
                                         UniFunc<Slot> onErrorTimeout)

    - #### isWaiting

          public boolean isWaiting()

      Specified by:
        `isWaiting` in interface `DaemonCommon`