Package org.apache.storm.task

# Class WorkerUserContext

java.lang.Object
org.apache.storm.task.GeneralTopologyContext
org.apache.storm.task.WorkerTopologyContext
org.apache.storm.task.WorkerUserContext

All Implemented Interfaces:
  `org.apache.storm.shade.net.minidev.json.JSONAware`

public class WorkerUserContext extends WorkerTopologyContext

- ## Field Summary

  ### Fields inherited from class org.apache.storm.task.WorkerTopologyContext

  `SHARED_EXECUTOR`

  ### Fields inherited from class org.apache.storm.task.GeneralTopologyContext

  `doSanityCheck, topoConf`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkerUserContext(StormTopology topology, Map<String,Object> topoConf, Map<Integer,String> taskToComponent, Map<String,List<Integer>> componentToSortedTasks, Map<String,Map<String,Fields>> componentToStreamToFields, String stormId, String codeDir, String pidDir, Integer workerPort, List<Integer> workerTasks, Map<String,Object> defaultResources, Map<String,Object> userResources, AtomicReference<Map<Integer,NodeInfo>> taskToNodePort, String assignmentId, AtomicReference<Map<String,String>> nodeToHost)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `setResource(String name, Object data)`
  Sets the worker-level data for the given name.

  ### Methods inherited from class org.apache.storm.task.WorkerTopologyContext

  `getAssignmentId, getCodeDir, getNodeToHost, getPIDDir, getResource, getSharedExecutor, getTaskToNodePort, getThisWorkerPort, getThisWorkerTasks`

  ### Methods inherited from class org.apache.storm.task.GeneralTopologyContext

  `doSanityCheck, getComponentCommon, getComponentId, getComponentIds, getComponentOutputFields, getComponentOutputFields, getComponentStreams, getComponentTasks, getConf, getRawTopology, getSources, getStormId, getTargets, getTaskToComponent, maxTopologyMessageTimeout, toJSONString`

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

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

- ## Constructor Details

  - ### WorkerUserContext

    public WorkerUserContext(StormTopology topology, Map<String,Object> topoConf, Map<Integer,String> taskToComponent, Map<String,List<Integer>> componentToSortedTasks, Map<String,Map<String,Fields>> componentToStreamToFields, String stormId, String codeDir, String pidDir, Integer workerPort, List<Integer> workerTasks, Map<String,Object> defaultResources, Map<String,Object> userResources, AtomicReference<Map<Integer,NodeInfo>> taskToNodePort, String assignmentId, AtomicReference<Map<String,String>> nodeToHost)

- ## Method Details

  - ### setResource

    public void setResource(String name, Object data)
    Sets the worker-level data for the given name. This data can then be read by all components running on the same worker, i.e. tasks (spouts, bolts), task hooks and worker hooks.
    Parameters:
      `name` - name of the worker-level data to be set
      `data` - worker-level data