Package org.apache.storm.task
Class WorkerTopologyContext
- java.lang.Object
-
- org.apache.storm.task.GeneralTopologyContext
-
- org.apache.storm.task.WorkerTopologyContext
-
- All Implemented Interfaces:
org.json.simple.JSONAware
- Direct Known Subclasses:
TopologyContext
public class WorkerTopologyContext extends GeneralTopologyContext
-
-
Constructor Summary
Constructors Constructor Description WorkerTopologyContext(org.apache.heron.api.topology.TopologyContext newDelegate)
WorkerTopologyContext(StormTopology topology, Map stormConf, 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCodeDir()
Gets the location of the external resources for this worker on the local filesystem.String
getPIDDir()
If this task spawns any subprocesses, those subprocesses must immediately write their PID to this directory on the local filesystem to ensure that Storm properly destroys that process when the worker is shutdown.Object
getResource(String name)
ExecutorService
getSharedExecutor()
Integer
getThisWorkerPort()
Return the port that the worker is running on.List<Integer>
getThisWorkerTasks()
Gets all the task ids that are running in this worker process (including the task for this task).-
Methods inherited from class org.apache.storm.task.GeneralTopologyContext
getComponentId, getComponentIds, getComponentOutputFields, getComponentStreams, getComponentTasks, getRawTopology, getStormId, getTaskToComponent, toJSONString
-
-
-
-
Constructor Detail
-
WorkerTopologyContext
public WorkerTopologyContext(StormTopology topology, Map stormConf, 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)
-
WorkerTopologyContext
public WorkerTopologyContext(org.apache.heron.api.topology.TopologyContext newDelegate)
-
-
Method Detail
-
getThisWorkerTasks
public List<Integer> getThisWorkerTasks()
Gets all the task ids that are running in this worker process (including the task for this task). In Heron parlance, since every instance is running as a seperate process this will just return the current instance's taskId
-
getThisWorkerPort
public Integer getThisWorkerPort()
Return the port that the worker is running on. This was typically done to differentiate workers running on the same machine. In Heron parlance, we just return the taskId since that should be unique
-
getCodeDir
public String getCodeDir()
Gets the location of the external resources for this worker on the local filesystem. These external resources typically include bolts implemented in other languages, such as Ruby or Python.
-
getPIDDir
public String getPIDDir()
If this task spawns any subprocesses, those subprocesses must immediately write their PID to this directory on the local filesystem to ensure that Storm properly destroys that process when the worker is shutdown.
-
getSharedExecutor
public ExecutorService getSharedExecutor()
-
-