Package org.apache.storm.daemon.worker

# Class WorkerState

java.lang.Object
org.apache.storm.daemon.worker.WorkerState

public class WorkerState extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `WorkerState.ILocalTransferCallback`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkerState(Map<String,Object> conf, IContext mqContext, String topologyId, String assignmentId, Supplier<SupervisorIfaceFactory> supervisorIfaceSupplier, int port, String workerId, Map<String,Object> topologyConf, IStateStorage stateStorage, IStormClusterState stormClusterState, Collection<IAutoCredentials> autoCredentials, StormMetricRegistry metricRegistry, Credentials initialCredentials)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `activateWorkerWhenAllConnectionsReady()`
  we will wait all connections to be ready and then activate the spout/bolt when the worker bootup.
  `boolean`
  `areAllConnectionsReady()`
  `void`
  `checkSerialize(KryoTupleSerializer serializer, AddressedTuple tuple)`
  `void`
  `closeResources()`
  `void`
  `flushRemotes()`
  `AtomicReference<Map<String,VersionedData<Assignment>>>`
  `getAssignmentVersions()`
  `Collection<IAutoCredentials>`
  `getAutoCredentials()`
  `Map<String,Long>`
  `getBlobToLastKnownVersion()`
  `AtomicReference<Map<NodeInfo,IConnection>>`
  `getCachedNodeToPortSocket()`
  `Map<String,List<Integer>>`
  `getComponentToSortedTasks()`
  `Map<String,Map<String,Fields>>`
  `getComponentToStreamToFields()`
  `Map<String,Object>`
  `getConf()`
  `Credentials`
  `getCredentials()`
  `Map<String,Object>`
  `getDefaultSharedResources()`
  `List<IWorkerHook>`
  `getDeserializedWorkerHooks()`
  `Map<List<Long>,JCQueue>`
  `getExecutorReceiveQueueMap()`
  `AtomicBoolean`
  `getIsTopologyActive()`
  `CountDownLatch`
  `getIsWorkerActive()`
  `LoadMapping`
  `getLoadMapping()`
  `Set<List<Long>>`
  `getLocalExecutors()`
  `Map<Integer,JCQueue>`
  `getLocalReceiveQueues()`
  `List<Integer>`
  `getLocalTaskIds()`
  `StormMetricRegistry`
  `getMetricRegistry()`
  `Set<Integer>`
  `getOutboundTasks()`
  `int`
  `getPort()`
  `IConnection`
  `getReceiver()`
  `IStateStorage`
  `getStateStorage()`
  `AtomicReference<Map<String,DebugOptions>>`
  `getStormComponentToDebug()`
  `Runnable`
  `getSuicideCallback()`
  `StormTopology`
  `getSystemTopology()`
  `Map<Integer,String>`
  `getTaskToComponent()`
  `StormTopology`
  `getTopology()`
  `Map<String,Object>`
  `getTopologyConf()`
  `String`
  `getTopologyId()`
  `JCQueue`
  `getTransferQueue()`
  `Utils.UptimeComputer`
  `getUptime()`
  `Map<String,Object>`
  `getUserSharedResources()`
  `StormTimer`
  `getUserTimer()`
  `String`
  `getWorkerId()`
  `final WorkerTopologyContext`
  `getWorkerTopologyContext()`
  `final WorkerUserContext`
  `getWorkerUserContext()`
  `void`
  `haltWorkerTransfer()`
  `boolean`
  `hasRemoteOutboundTasks()`
  Check if this worker has remote outbound tasks.
  `static boolean`
  `isConnectionReady(IConnection connection)`
  `boolean`
  `isSingleWorker()`
  If all the tasks are local tasks, the topology has only one worker.
  `Utils.SmartThread`
  `makeTransferThread()`
  `void`
  `refreshBackPressureStatus()`
  `void`
  `refreshConnections()`
  `void`
  `refreshLoad(List<IRunningExecutor> execs)`
  `void`
  `refreshStormActive()`
  `void`
  `refreshStormActive(Runnable callback)`
  `void`
  `runWorkerShutdownHooks()`
  `void`
  `runWorkerStartHooks()`
  `void`
  `setCredentials(Credentials credentials)`
  `void`
  `suicideIfLocalAssignmentsChanged(Assignment assignment)`
  `boolean`
  `tryFlushRemotes()`
  `boolean`
  `tryTransferRemote(AddressedTuple tuple, Queue<AddressedTuple> pendingEmits, ITupleSerializer serializer)`

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

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

- ## Constructor Details

  - ### WorkerState

    public WorkerState(Map<String,Object> conf, IContext mqContext, String topologyId, String assignmentId, Supplier<SupervisorIfaceFactory> supervisorIfaceSupplier, int port, String workerId, Map<String,Object> topologyConf, IStateStorage stateStorage, IStormClusterState stormClusterState, Collection<IAutoCredentials> autoCredentials, StormMetricRegistry metricRegistry, Credentials initialCredentials) throws IOException, InvalidTopologyException
    Throws:
      `IOException`
      `InvalidTopologyException`

- ## Method Details

  - ### isConnectionReady

    public static boolean isConnectionReady(IConnection connection)

  - ### getDeserializedWorkerHooks

    public List<IWorkerHook> getDeserializedWorkerHooks()

  - ### getConf

    public Map<String,Object> getConf()

  - ### getReceiver

    public IConnection getReceiver()

  - ### getTopologyId

    public String getTopologyId()

  - ### getPort

    public int getPort()

  - ### getWorkerId

    public String getWorkerId()

  - ### getStateStorage

    public IStateStorage getStateStorage()

  - ### getIsWorkerActive

    public CountDownLatch getIsWorkerActive()

  - ### getIsTopologyActive

    public AtomicBoolean getIsTopologyActive()

  - ### getStormComponentToDebug

    public AtomicReference<Map<String,DebugOptions>> getStormComponentToDebug()

  - ### getLocalExecutors

    public Set<List<Long>> getLocalExecutors()

  - ### getLocalTaskIds

    public List<Integer> getLocalTaskIds()

  - ### getLocalReceiveQueues

    public Map<Integer,JCQueue> getLocalReceiveQueues()

  - ### getTopologyConf

    public Map<String,Object> getTopologyConf()

  - ### getTopology

    public StormTopology getTopology()

  - ### getSystemTopology

    public StormTopology getSystemTopology()

  - ### getTaskToComponent

    public Map<Integer,String> getTaskToComponent()

  - ### getComponentToStreamToFields

    public Map<String,Map<String,Fields>> getComponentToStreamToFields()

  - ### getComponentToSortedTasks

    public Map<String,List<Integer>> getComponentToSortedTasks()

  - ### getBlobToLastKnownVersion

    public Map<String,Long> getBlobToLastKnownVersion()

  - ### getCachedNodeToPortSocket

    public AtomicReference<Map<NodeInfo,IConnection>> getCachedNodeToPortSocket()

  - ### getExecutorReceiveQueueMap

    public Map<List<Long>,JCQueue> getExecutorReceiveQueueMap()

  - ### getSuicideCallback

    public Runnable getSuicideCallback()

  - ### getUptime

    public Utils.UptimeComputer getUptime()

  - ### getDefaultSharedResources

    public Map<String,Object> getDefaultSharedResources()

  - ### getUserSharedResources

    public Map<String,Object> getUserSharedResources()

  - ### getLoadMapping

    public LoadMapping getLoadMapping()

  - ### getAssignmentVersions

    public AtomicReference<Map<String,VersionedData<Assignment>>> getAssignmentVersions()

  - ### getUserTimer

    public StormTimer getUserTimer()

  - ### makeTransferThread

    public Utils.SmartThread makeTransferThread()

  - ### suicideIfLocalAssignmentsChanged

    public void suicideIfLocalAssignmentsChanged(Assignment assignment)

  - ### refreshConnections

    public void refreshConnections()

  - ### refreshStormActive

    public void refreshStormActive()

  - ### refreshStormActive

    public void refreshStormActive(Runnable callback)

  - ### refreshLoad

    public void refreshLoad(List<IRunningExecutor> execs)

  - ### refreshBackPressureStatus

    public void refreshBackPressureStatus()

  - ### activateWorkerWhenAllConnectionsReady

    public void activateWorkerWhenAllConnectionsReady()
    we will wait all connections to be ready and then activate the spout/bolt when the worker bootup.

  - ### tryTransferRemote

    public boolean tryTransferRemote(AddressedTuple tuple, Queue<AddressedTuple> pendingEmits, ITupleSerializer serializer)

  - ### flushRemotes

    public void flushRemotes() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### tryFlushRemotes

    public boolean tryFlushRemotes()

  - ### checkSerialize

    public void checkSerialize(KryoTupleSerializer serializer, AddressedTuple tuple)

  - ### getWorkerTopologyContext

    public final WorkerTopologyContext getWorkerTopologyContext()

  - ### getWorkerUserContext

    public final WorkerUserContext getWorkerUserContext()

  - ### runWorkerStartHooks

    public void runWorkerStartHooks()

  - ### runWorkerShutdownHooks

    public void runWorkerShutdownHooks()

  - ### closeResources

    public void closeResources()

  - ### areAllConnectionsReady

    public boolean areAllConnectionsReady()

  - ### getAutoCredentials

    public Collection<IAutoCredentials> getAutoCredentials()

  - ### getCredentials

    public Credentials getCredentials()

  - ### setCredentials

    public void setCredentials(Credentials credentials)

  - ### getOutboundTasks

    public Set<Integer> getOutboundTasks()

  - ### hasRemoteOutboundTasks

    public boolean hasRemoteOutboundTasks()
    Check if this worker has remote outbound tasks.
    Returns:
      true if this worker has remote outbound tasks; false otherwise.

  - ### isSingleWorker

    public boolean isSingleWorker()
    If all the tasks are local tasks, the topology has only one worker.
    Returns:
      true if this worker is the single worker; false otherwise.

  - ### haltWorkerTransfer

    public void haltWorkerTransfer()

  - ### getTransferQueue

    public JCQueue getTransferQueue()

  - ### getMetricRegistry

    public StormMetricRegistry getMetricRegistry()