Package org.apache.storm.hooks

# Interface IWorkerHook

All Superinterfaces:
  `Serializable`

All Known Implementing Classes:
  `BaseWorkerHook`

public interface IWorkerHook extends Serializable
An IWorkerHook represents a topology component that can be executed when a worker starts, and when a worker shuts down. It can be useful when you want to execute operations before topology processing starts, or cleanup operations before your workers shut down.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `shutdown()`
  This method is called right before a worker shuts down.
  `default void`
  `start(Map<String,Object> topoConf, WorkerTopologyContext context)`
  Deprecated.
  see `start(Map, WorkerUserContext)`
  `default void`
  `start(Map<String,Object> topoConf, WorkerUserContext context)`
  This method is called when a worker is started and can be used to do necessary prep-processing and allow initialization of shared application state.

- ## Method Details

  - ### start

    default void start(Map<String,Object> topoConf, WorkerTopologyContext context)
    Deprecated.
    see `start(Map, WorkerUserContext)`
    This method is called when a worker is started.
    Parameters:
      `topoConf` - The Storm configuration for this worker
      `context` - This object can be used to get information about this worker's place within the topology

  - ### start

    default void start(Map<String,Object> topoConf, WorkerUserContext context)
    This method is called when a worker is started and can be used to do necessary prep-processing and allow initialization of shared application state.
    Parameters:
      `topoConf` - The Storm configuration for this worker
      `context` - This object can be used to get information about this worker's place within the topology and exposes `WorkerUserContext.setResource(String, Object)` to set the shared application state.

  - ### shutdown

    void shutdown()
    This method is called right before a worker shuts down.