Package org.apache.storm.executor

## Class Executor

- java.lang.Object
- - org.apache.storm.executor.Executor

- All Implemented Interfaces:
    `Callable`, `org.apache.storm.shade.org.jctools.queues.MessagePassingQueue.Consumer<Object>`, `JCQueue.Consumer`
  Direct Known Subclasses:
    `BoltExecutor`, `SpoutExecutor`

      public abstract class Executor
      extends Object
      implements Callable, JCQueue.Consumer

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected boolean` | `ackingEnabled` |
    `protected String` | `componentId` |
    `protected Map<String,​Object>` | `conf` |
    `protected Map<String,​String>` | `credentials` |
    `protected List<Long>` | `executorId` |
    `protected ExecutorTransfer` | `executorTransfer` |
    `protected List<LoadAwareCustomStreamGrouping>` | `groupers` |
    `protected Boolean` | `hasEventLoggers` |
    `protected String` | `hostname` |
    `protected ArrayList<Task>` | `idToTask` |
    `protected int` | `idToTaskBase` |
    `protected Map<Integer,​Map<Integer,​Map<String,​IMetric>>>` | `intervalToTaskToMetricToRegistry` |
    `protected Boolean` | `isDebug` |
    `protected AtomicBoolean` | `openOrPrepareWasCalled` |
    `protected org.apache.storm.shade.org.jctools.queues.MpscChunkedArrayQueue<AddressedTuple>` | `pendingEmits` |
    `protected Random` | `rand` |
    `protected JCQueue` | `receiveQueue` |
    `protected IReportError` | `reportError` |
    `protected ReportErrorAndDie` | `reportErrorDie` |
    `protected BooleanSupplier` | `sampler` |
    `protected HashMap` | `sharedExecutorData` |
    `protected AtomicBoolean` | `stormActive` |
    `protected IStormClusterState` | `stormClusterState` |
    `protected AtomicReference<Map<String,​DebugOptions>>` | `stormComponentDebug` |
    `protected String` | `stormId` |
    `protected Map<String,​Map<String,​LoadAwareCustomStreamGrouping>>` | `streamToComponentToGrouper` |
    `protected Runnable` | `suicideFn` |
    `protected List<Integer>` | `taskIds` |
    `protected Map<Integer,​String>` | `taskToComponent` |
    `protected Map<String,​Object>` | `topoConf` |
    `protected String` | `type` |
    `protected WorkerState` | `workerData` |
    `protected CountDownLatch` | `workerReady` |
    `protected WorkerTopologyContext` | `workerTopologyContext` |

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `Executor​(WorkerState workerData, List<Long> executorId, Map<String,​String> credentials, String type)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `accept​(Object event)` |
    `ExecutorShutdown` | `execute()` | separated from mkExecutor in order to replace executor transfer in executor data for testing.
    `void` | `flush()` |
    `String` | `getComponentId()` |
    `List<Long>` | `getExecutorId()` |
    `ExecutorTransfer` | `getExecutorTransfer()` |
    `Map<Integer,​Map<Integer,​Map<String,​IMetric>>>` | `getIntervalToTaskToMetricToRegistry()` |
    `Boolean` | `getIsDebug()` |
    `AtomicBoolean` | `getOpenOrPrepareWasCalled()` |
    `Queue<AddressedTuple>` | `getPendingEmits()` |
    `JCQueue` | `getReceiveQueue()` |
    `IReportError` | `getReportError()` |
    `HashMap` | `getSharedExecutorData()` |
    `abstract CommonStats` | `getStats()` |
    `IStormClusterState` | `getStormClusterState()` |
    `AtomicReference<Map<String,​DebugOptions>>` | `getStormComponentDebug()` |
    `String` | `getStormId()` |
    `Map<String,​Map<String,​LoadAwareCustomStreamGrouping>>` | `getStreamToComponentToGrouper()` |
    `List<Integer>` | `getTaskIds()` |
    `Map<String,​Object>` | `getTopoConf()` |
    `String` | `getType()` |
    `WorkerState` | `getWorkerData()` |
    `WorkerTopologyContext` | `getWorkerTopologyContext()` |
    `void` | `incrementReportedErrorCount()` |
    `void` | `metricsTick​(Task task, TupleImpl tuple)` |
    `static Executor` | `mkExecutor​(WorkerState workerState, List<Long> executorId, Map<String,​String> credentials)` |
    `boolean` | `publishFlushTuple()` |
    `void` | `reflectNewLoadMapping​(LoadMapping loadMapping)` |
    `boolean` | `samplerCheck()` |
    `void` | `setLocalExecutorTransfer​(ExecutorTransfer executorTransfer)` |
    `void` | `setNeedToRefreshCreds()` |
    `protected void` | `setupMetrics()` |
    `protected void` | `setupTicks​(boolean isSpout)` |
    `abstract void` | `tupleActionFn​(int taskId, TupleImpl tuple)` |
    `protected void` | `updateExecCredsIfRequired()` |

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

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

    - ### Methods inherited from interface java.util.concurrent.Callable

      `call`

- - ### Field Detail

    - #### workerData

          protected final WorkerState workerData

    - #### workerTopologyContext

          protected final WorkerTopologyContext workerTopologyContext

    - #### executorId

          protected final List<Long> executorId

    - #### taskIds

          protected final List<Integer> taskIds

    - #### componentId

          protected final String componentId

    - #### openOrPrepareWasCalled

          protected final AtomicBoolean openOrPrepareWasCalled

    - #### topoConf

          protected final Map<String,​Object> topoConf

    - #### conf

          protected final Map<String,​Object> conf

    - #### stormId

          protected final String stormId

    - #### sharedExecutorData

          protected final HashMap sharedExecutorData

    - #### workerReady

          protected final CountDownLatch workerReady

    - #### stormActive

          protected final AtomicBoolean stormActive

    - #### stormComponentDebug

          protected final AtomicReference<Map<String,​DebugOptions>> stormComponentDebug

    - #### suicideFn

          protected final Runnable suicideFn

    - #### stormClusterState

          protected final IStormClusterState stormClusterState

    - #### taskToComponent

          protected final Map<Integer,​String> taskToComponent

    - #### intervalToTaskToMetricToRegistry

          protected final Map<Integer,​Map<Integer,​Map<String,​IMetric>>> intervalToTaskToMetricToRegistry

    - #### streamToComponentToGrouper

          protected final Map<String,​Map<String,​LoadAwareCustomStreamGrouping>> streamToComponentToGrouper

    - #### groupers

          protected final List<LoadAwareCustomStreamGrouping> groupers

    - #### reportErrorDie

          protected final ReportErrorAndDie reportErrorDie

    - #### sampler

          protected final BooleanSupplier sampler

    - #### type

          protected final String type

    - #### reportError

          protected final IReportError reportError

    - #### rand

          protected final Random rand

    - #### receiveQueue

          protected final JCQueue receiveQueue

    - #### credentials

          protected final Map<String,​String> credentials

    - #### isDebug

          protected final Boolean isDebug

    - #### hasEventLoggers

          protected final Boolean hasEventLoggers

    - #### ackingEnabled

          protected final boolean ackingEnabled

    - #### pendingEmits

          protected final org.apache.storm.shade.org.jctools.queues.MpscChunkedArrayQueue<AddressedTuple> pendingEmits

    - #### executorTransfer

          protected ExecutorTransfer executorTransfer

    - #### idToTask

          protected ArrayList<Task> idToTask

    - #### idToTaskBase

          protected int idToTaskBase

    - #### hostname

          protected String hostname

  - ### Constructor Detail

    - #### Executor

          protected Executor​(WorkerState workerData,
                             List<Long> executorId,
                             Map<String,​String> credentials,
                             String type)

  - ### Method Detail

    - #### mkExecutor

          public static Executor mkExecutor​(WorkerState workerState,
                                            List<Long> executorId,
                                            Map<String,​String> credentials)

    - #### getPendingEmits

          public Queue<AddressedTuple> getPendingEmits()

    - #### execute

          public ExecutorShutdown execute()
                                   throws Exception

      separated from mkExecutor in order to replace executor transfer in executor data for testing.
      Throws:
        `Exception`

    - #### tupleActionFn

          public abstract void tupleActionFn​(int taskId,
                                             TupleImpl tuple)
                                      throws Exception

      Throws:
        `Exception`

    - #### accept

          public void accept​(Object event)

      Specified by:
        `accept` in interface `JCQueue.Consumer`
      Specified by:
        `accept` in interface `org.apache.storm.shade.org.jctools.queues.MessagePassingQueue.Consumer<Object>`

    - #### setNeedToRefreshCreds

          public void setNeedToRefreshCreds()

    - #### updateExecCredsIfRequired

          protected void updateExecCredsIfRequired()

    - #### flush

          public void flush()

      Specified by:
        `flush` in interface `JCQueue.Consumer`

    - #### metricsTick

          public void metricsTick​(Task task,
                                  TupleImpl tuple)

    - #### setupMetrics

          protected void setupMetrics()

    - #### setupTicks

          protected void setupTicks​(boolean isSpout)

    - #### reflectNewLoadMapping

          public void reflectNewLoadMapping​(LoadMapping loadMapping)

    - #### publishFlushTuple

          public boolean publishFlushTuple()

    - #### getExecutorId

          public List<Long> getExecutorId()

    - #### getTaskIds

          public List<Integer> getTaskIds()

    - #### getComponentId

          public String getComponentId()

    - #### getOpenOrPrepareWasCalled

          public AtomicBoolean getOpenOrPrepareWasCalled()

    - #### getTopoConf

          public Map<String,​Object> getTopoConf()

    - #### getStormId

          public String getStormId()

    - #### getStats

          public abstract CommonStats getStats()

    - #### getType

          public String getType()

    - #### getIsDebug

          public Boolean getIsDebug()

    - #### getExecutorTransfer

          public ExecutorTransfer getExecutorTransfer()

    - #### getReportError

          public IReportError getReportError()

    - #### getWorkerTopologyContext

          public WorkerTopologyContext getWorkerTopologyContext()

    - #### samplerCheck

          public boolean samplerCheck()

    - #### getStormComponentDebug

          public AtomicReference<Map<String,​DebugOptions>> getStormComponentDebug()

    - #### getReceiveQueue

          public JCQueue getReceiveQueue()

    - #### getStormClusterState

          public IStormClusterState getStormClusterState()

    - #### getWorkerData

          public WorkerState getWorkerData()

    - #### getStreamToComponentToGrouper

          public Map<String,​Map<String,​LoadAwareCustomStreamGrouping>> getStreamToComponentToGrouper()

    - #### getSharedExecutorData

          public HashMap getSharedExecutorData()

    - #### getIntervalToTaskToMetricToRegistry

          public Map<Integer,​Map<Integer,​Map<String,​IMetric>>> getIntervalToTaskToMetricToRegistry()

    - #### setLocalExecutorTransfer

          public void setLocalExecutorTransfer​(ExecutorTransfer executorTransfer)

    - #### incrementReportedErrorCount

          public void incrementReportedErrorCount()