本文整理汇总了Java中com.alibaba.jstorm.daemon.worker.WorkerData.getInnerTaskTransfer方法的典型用法代码示例。如果您正苦于以下问题:Java WorkerData.getInnerTaskTransfer方法的具体用法?Java WorkerData.getInnerTaskTransfer怎么用?Java WorkerData.getInnerTaskTransfer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.jstorm.daemon.worker.WorkerData
的用法示例。
在下文中一共展示了WorkerData.getInnerTaskTransfer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Task
import com.alibaba.jstorm.daemon.worker.WorkerData; //导入方法依赖的package包/类
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.taskStatus = new TaskStatus();
this.taskTransfer = getSendingTransfer(workerData);
this.innerTaskTransfer = workerData.getInnerTaskTransfer();
this.deserializeQueues = workerData.getDeserializeQueues();
this.topologyid = workerData.getTopologyId();
this.context = workerData.getContext();
this.workHalt = workerData.getWorkHalt();
this.zkCluster = new StormZkClusterState(workerData.getZkClusterstate());
this.stormConf = Common.component_conf(workerData.getStormConf(),
topologyContext, componentid);
WorkerClassLoader.switchThreadContext();
// get real task object -- spout/bolt/spoutspec
this.taskObj = Common.get_task_object(topologyContext.getRawTopology(),
componentid, WorkerClassLoader.getInstance());
WorkerClassLoader.restoreThreadContext();
int samplerate = StormConfig.sampling_rate(stormConf);
this.taskStats = new CommonStatsRolling(samplerate);
LOG.info("Loading task " + componentid + ":" + taskid);
}
示例2: TaskTransfer
import com.alibaba.jstorm.daemon.worker.WorkerData; //导入方法依赖的package包/类
public TaskTransfer(String taskName,
KryoTupleSerializer serializer, TaskStatus taskStatus,
WorkerData workerData) {
this.taskName = taskName;
this.serializer = serializer;
this.taskStatus = taskStatus;
this.storm_conf = workerData.getConf();
this.transferQueue = workerData.getTransferQueue();
this.innerTaskTransfer = workerData.getInnerTaskTransfer();
int queue_size = Utils.getInt(storm_conf
.get(Config.TOPOLOGY_EXECUTOR_SEND_BUFFER_SIZE));
WaitStrategy waitStrategy = (WaitStrategy) Utils
.newInstance((String) storm_conf
.get(Config.TOPOLOGY_DISRUPTOR_WAIT_STRATEGY));
this.serializeQueue = DisruptorQueue.mkInstance(taskName, ProducerType.MULTI,
queue_size, waitStrategy);
this.serializeQueue.consumerStarted();
String taskId = taskName.substring(taskName.indexOf(":") + 1);
Metrics.registerQueue(taskName, MetricDef.SERIALIZE_QUEUE, serializeQueue, taskId, Metrics.MetricType.TASK);
timer = Metrics.registerTimer(taskName, MetricDef.SERIALIZE_TIME, taskId, Metrics.MetricType.TASK);
serializeThread = new AsyncLoopThread(new TransferRunnable());
LOG.info("Successfully start TaskTransfer thread");
}
示例3: 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.taskStatus = new TaskStatus();
this.taskTransfer = getSendingTransfer(workerData);
this.innerTaskTransfer = workerData.getInnerTaskTransfer();
this.deserializeQueues = workerData.getDeserializeQueues();
this.topologyid = workerData.getTopologyId();
this.context = workerData.getContext();
this.workHalt = workerData.getWorkHalt();
this.zkCluster = new StormZkClusterState(workerData.getZkClusterstate());
this.stormConf = Common.component_conf(workerData.getStormConf(),
topologyContext, componentid);
WorkerClassLoader.switchThreadContext();
// get real task object -- spout/bolt/spoutspec
this.taskObj = Common.get_task_object(topologyContext.getRawTopology(),
componentid, WorkerClassLoader.getInstance());
WorkerClassLoader.restoreThreadContext();
int samplerate = StormConfig.sampling_rate(stormConf);
this.taskStats = new CommonStatsRolling(samplerate);
LOG.info("Loading task " + componentid + ":" + taskid);
}
示例4: 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);
}
示例5: 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);
}