本文整理汇总了Java中com.alibaba.jstorm.daemon.worker.WorkerData.getZkCluster方法的典型用法代码示例。如果您正苦于以下问题:Java WorkerData.getZkCluster方法的具体用法?Java WorkerData.getZkCluster怎么用?Java WorkerData.getZkCluster使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.jstorm.daemon.worker.WorkerData
的用法示例。
在下文中一共展示了WorkerData.getZkCluster方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TaskHeartbeatRunable
import com.alibaba.jstorm.daemon.worker.WorkerData; //导入方法依赖的package包/类
public TaskHeartbeatRunable(WorkerData workerData) {
this.zkCluster = workerData.getZkCluster();
this.topology_id = workerData.getTopologyId();
this.uptime = new UptimeComputer();;
this.storm_conf = workerData.getStormConf();
this.active = workerData.getActive();
String key = Config.TASK_HEARTBEAT_FREQUENCY_SECS;
Object time = storm_conf.get(key);
frequence = JStormUtils.parseInt(time, 10);
}
示例2: Task
import com.alibaba.jstorm.daemon.worker.WorkerData; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public Task(WorkerData workerData, int taskId) throws Exception {
openOrPrepareWasCalled = new Atom(Boolean.valueOf(false));
this.workerData = workerData;
this.topologyContext = workerData.getContextMaker().makeTopologyContext(workerData.getSysTopology(), taskId, openOrPrepareWasCalled);
this.userContext = workerData.getContextMaker().makeTopologyContext(workerData.getRawTopology(), taskId, openOrPrepareWasCalled);
this.taskId = taskId;
this.componentId = topologyContext.getThisComponentId();
this.stormConf = Common.component_conf(workerData.getStormConf(), topologyContext, componentId);
this.taskStatus = new TaskStatus();
this.innerTaskTransfer = workerData.getInnerTaskTransfer();
this.deserializeQueues = workerData.getDeserializeQueues();
this.topologyId = workerData.getTopologyId();
this.context = workerData.getContext();
this.workHalt = workerData.getWorkHalt();
this.zkCluster =workerData.getZkCluster();
this.taskStats = new TaskBaseMetric(topologyId, componentId, taskId,
ConfigExtension.isEnableMetrics(workerData.getStormConf()));
LOG.info("Begin to deserialize taskObj " + componentId + ":" + this.taskId);
WorkerClassLoader.switchThreadContext();
// get real task object -- spout/bolt/spoutspec
this.taskObj = Common.get_task_object(topologyContext.getRawTopology(), componentId, WorkerClassLoader.getInstance());
WorkerClassLoader.restoreThreadContext();
isTaskBatchTuple = ConfigExtension.isTaskBatchTuple(stormConf);
LOG.info("Transfer/receive in batch mode :" + isTaskBatchTuple);
LOG.info("Loading task " + componentId + ":" + this.taskId);
}
示例3: Task
import com.alibaba.jstorm.daemon.worker.WorkerData; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public Task(WorkerData workerData, int taskId) throws Exception {
openOrPrepareWasCalled = new Atom(false);
this.workerData = workerData;
this.topologyContext = workerData.getContextMaker().makeTopologyContext(
workerData.getSysTopology(), taskId, openOrPrepareWasCalled);
this.userContext = workerData.getContextMaker().makeTopologyContext(
workerData.getRawTopology(), taskId, openOrPrepareWasCalled);
this.taskId = taskId;
this.componentId = topologyContext.getThisComponentId();
topologyContext.getStormConf().putAll(Common.component_conf(topologyContext, componentId));
this.stormConf = topologyContext.getStormConf();
this.taskStatus = new TaskStatus();
this.innerTaskTransfer = workerData.getInnerTaskTransfer();
this.deserializeQueues = workerData.getDeserializeQueues();
this.controlQueues = workerData.getControlQueues();
this.topologyId = workerData.getTopologyId();
this.context = workerData.getContext();
this.workHalt = workerData.getWorkHalt();
this.zkCluster = workerData.getZkCluster();
this.nodePortToSocket = workerData.getNodePortToSocket();
this.taskToNodePort = workerData.getTaskToNodePort();
// create report error callback,
// in fact it is storm_cluster.report-task-error
ITaskReportErr reportError = new TaskReportError(zkCluster, topologyId, taskId);
// report error and halt worker
reportErrorDie = new TaskReportErrorAndDie(reportError, workHalt);
this.taskStats = new TaskBaseMetric(topologyId, componentId, taskId);
//register auto hook
List<String> listHooks = Config.getTopologyAutoTaskHooks(stormConf);
for (String hook : listHooks) {
ITaskHook iTaskHook = (ITaskHook) Utils.newInstance(hook);
userContext.addTaskHook(iTaskHook);
}
LOG.info("Begin to deserialize taskObj " + componentId + ":" + this.taskId);
try {
WorkerClassLoader.switchThreadContext();
this.taskObj = Common.get_task_object(
topologyContext.getRawTopology(), componentId, WorkerClassLoader.getInstance());
WorkerClassLoader.restoreThreadContext();
} catch (Exception e) {
if (reportErrorDie != null) {
reportErrorDie.report(e);
} else {
throw e;
}
}
isTaskBatchTuple = ConfigExtension.isTaskBatchTuple(stormConf);
LOG.info("Transfer/receive in batch mode :" + isTaskBatchTuple);
LOG.info("Loading task " + componentId + ":" + this.taskId);
}