org.apache.storm.task.TopologyContext.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.apache.storm.task.TopologyContext.<init>()方法的一些代码示例,展示了TopologyContext.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TopologyContext.<init>()方法的具体详情如下:
包路径:org.apache.storm.task.TopologyContext
类名称:TopologyContext
方法名:<init>

TopologyContext.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/storm

private TopologyContext createTopologyContext(Map<String, Object> topoConf) {
    Map<Integer, String> taskToComponent = new HashMap<Integer, String>();
    taskToComponent.put(7, "Xcom");
    return new TopologyContext(null, topoConf, taskToComponent, null, null, null, null, null, null, 7, 6703, null, null, null, null,
                  null, null);
  }
}

代码示例来源:origin: apache/storm

compToStreamToFields.put(component, streamToFields);
TopologyContext context = new TopologyContext(null,
                       ConfigUtils.readStormConfig(),
                       taskToComp,

代码示例来源:origin: apache/storm

private TopologyContext mkTopologyContext(StormTopology topology) throws IOException {
  Map<String, Object> conf = workerData.getConf();
  return new TopologyContext(
    topology,
    workerData.getTopologyConf(),
    workerData.getTaskToComponent(),
    workerData.getComponentToSortedTasks(),
    workerData.getComponentToStreamToFields(),
    // This is updated by the Worker and the topology has shared access to it
    workerData.getBlobToLastKnownVersion(),
    workerData.getTopologyId(),
    ConfigUtils.supervisorStormResourcesPath(
      ConfigUtils.supervisorStormDistRoot(conf, workerData.getTopologyId())),
    ConfigUtils.workerPidsRoot(conf, workerData.getWorkerId()),
    taskId,
    workerData.getPort(), workerData.getLocalTaskIds(),
    workerData.getDefaultSharedResources(),
    workerData.getUserSharedResources(),
    executor.getSharedExecutorData(),
    executor.getIntervalToTaskToMetricToRegistry(),
    executor.getOpenOrPrepareWasCalled());
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
@SuppressWarnings("rawtypes")
public void prepare(
  Map<String, Object> conf,
  com.twitter.heron.api.topology.TopologyContext context,
  com.twitter.heron.api.bolt.OutputCollector collector) {
 topologyContextImpl = new TopologyContext(context);
 outputCollectorImpl = new OutputCollectorImpl(collector);
 delegate.prepare(conf, topologyContextImpl, outputCollectorImpl);
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
public void prepare(com.twitter.heron.api.topology.TopologyContext context,
          String component, String streamId,
          List<Integer> targetTasks) {
 TopologyContext c = new TopologyContext(context);
 GlobalStreamId g = new GlobalStreamId(component, streamId);
 delegate.prepare(c, g, targetTasks);
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
public void prepare(Map<String, Object> newConf,
          com.twitter.heron.api.topology.TopologyContext context) {
 this.conf = newConf;
 if (!newConf.containsKey(Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS)) {
  throw new RuntimeException("StormCompat Translation not done for task hooks");
 }
 List<String> hookClassNames =
   TypeUtils.getListOfStrings(newConf.get(Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS));
 for (String className : hookClassNames) {
  ITaskHook hook;
  try {
   hook = (ITaskHook) Class.forName(className).newInstance();
  } catch (ClassNotFoundException ex) {
   throw new RuntimeException(ex + " ITaskHook class must be in class path.");
  } catch (InstantiationException ex) {
   throw new RuntimeException(ex + " ITaskHook class must be concrete.");
  } catch (IllegalAccessException ex) {
   throw new RuntimeException(ex + " ITaskHook class must have a no-arg constructor.");
  }
  hooks.add(hook);
 }
 // Invoke the prepare() for all ITaskHooks
 TopologyContext ctxt = new TopologyContext(context);
 for (ITaskHook hook : hooks) {
  hook.prepare(newConf, ctxt);
 }
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
public void prepare(
  Map<String, Object> conf,
  com.twitter.heron.api.topology.TopologyContext context,
  com.twitter.heron.api.bolt.OutputCollector collector) {
 topologyContextImpl = new TopologyContext(context);
 outputCollectorImpl = new OutputCollectorImpl(collector);
 delegate.prepare(conf, topologyContextImpl, outputCollectorImpl);
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
@SuppressWarnings("rawtypes")
public void open(Map<String, Object> conf, com.twitter.heron.api.topology.TopologyContext context,
         SpoutOutputCollector collector) {
 topologyContextImpl = new TopologyContext(context);
 spoutOutputCollectorImpl = new SpoutOutputCollectorImpl(collector);
 delegate.open(conf, topologyContextImpl, spoutOutputCollectorImpl);
}

相关文章

微信公众号

最新文章

更多