Package org.apache.storm.trident.operation

## Interface Operation

- All Superinterfaces:
    `Serializable`
  All Known Subinterfaces:
    `Aggregator<T>`, `EachOperation`, `Filter`, `Function`, `OperationAwareFlatMapFunction`, `OperationAwareMapFunction`, `QueryFunction<S,​T>`, `StateUpdater<S>`
  All Known Implementing Classes:
    `AbstractRedisStateQuerier`, `AbstractRedisStateUpdater`, `BaseAggregator`, `BaseFilter`, `BaseFunction`, `BaseOperation`, `BaseQueryFunction`, `BaseStateUpdater`, `ChainedAggregatorImpl`, `CombinerAggregatorCombineImpl`, `CombinerAggregatorInitImpl`, `CombinerAggStateUpdater`, `ComparisonAggregator`, `ConsumerExecutor`, `CountAsAggregator`, `Debug`, `Equals`, `FilterExecutor`, `FilterNull`, `FirstN.FirstNAgg`, `FirstN.FirstNSortedAgg`, `FlatMapFunctionExecutor`, `GroupedAggregator`, `HdfsUpdater`, `HiveUpdater`, `JdbcQuery`, `JdbcUpdater`, `JmsUpdater`, `MapCombinerAggStateUpdater`, `MapFunctionExecutor`, `MapGet`, `MapReducerAggStateUpdater`, `Max`, `MaxWithComparator`, `Min`, `MinWithComparator`, `Negate`, `PrintFunction`, `RedisClusterStateQuerier`, `RedisClusterStateUpdater`, `RedisStateQuerier`, `RedisStateUpdater`, `ReducerAggregatorImpl`, `ReducerAggStateUpdater`, `SingleEmitAggregator`, `SnapshotGet`, `Split`, `StringLength`, `TridentKafkaStateUpdater`, `TridentReach.ExpandList`, `TridentWordCount.Split`, `TrueFilter`, `TrueFilter`, `TupleCollectionGet`, `TuplifyArgs`, `WindowsStateUpdater`

      public interface Operation
      extends Serializable

  Parent interface for Trident `Filter`s and `Function`s.

  `Operation` defines two lifecycle methods for Trident components. The `prepare()` method is called once when the `Operation` is first initialized. The `cleanup()` method is called in local mode when the local cluster is being shut down. In distributed mode, the `cleanup()` method is not guaranteed to be called in every situation, but Storm will make a best effort call `cleanup()` whenever possible.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `cleanup()` | When running in local mode, called when the local cluster is being shut down.
    `void` | `prepare​(Map<String,​Object> conf, TridentOperationContext context)` | Called when the `Operation` is first initialized.

- - ### Method Detail

    - #### prepare

          void prepare​(Map<String,​Object> conf,
                       TridentOperationContext context)

      Called when the `Operation` is first initialized.
      Parameters:
        `conf` - the Storm configuration map
        `context` - the operation context which provides information such as the number of partitions in the stream, and the current partition index. It also provides methods for registering operation-specific metrics.
      See Also:
        `TridentOperationContext`

    - #### cleanup

          void cleanup()

      When running in local mode, called when the local cluster is being shut down.