本文整理汇总了Java中backtype.storm.task.IBolt类的典型用法代码示例。如果您正苦于以下问题:Java IBolt类的具体用法?Java IBolt怎么用?Java IBolt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBolt类属于backtype.storm.task包,在下文中一共展示了IBolt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mk_executors
import backtype.storm.task.IBolt; //导入依赖的package包/类
public RunnableCallback mk_executors(DisruptorQueue deserializeQueue,
TaskSendTargets sendTargets, ITaskReportErr report_error) {
if (taskObj instanceof IBolt) {
return new BoltExecutors((IBolt) taskObj, taskTransfer,
innerTaskTransfer, stormConf, deserializeQueue, sendTargets,
taskStatus, topologyContext, userContext, taskStats,
report_error);
} else if (taskObj instanceof ISpout) {
if (isSingleThread(stormConf) == true) {
return new SingleThreadSpoutExecutors((ISpout) taskObj, taskTransfer,
innerTaskTransfer, stormConf, deserializeQueue, sendTargets,
taskStatus, topologyContext, userContext, taskStats,
report_error);
}else {
return new MultipleThreadSpoutExecutors((ISpout) taskObj, taskTransfer,
innerTaskTransfer, stormConf, deserializeQueue, sendTargets,
taskStatus, topologyContext, userContext, taskStats,
report_error);
}
}
return null;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:25,代码来源:Task.java
示例2: prepare
import backtype.storm.task.IBolt; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword,Object> collectorMap = new PersistentArrayMap( new Object[] {
Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context});
List<Object> args = new ArrayList<Object>() {{
add(stormConf);
add(context);
add(collectorMap);
}};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
//this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch(AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:metamx,项目名称:incubator-storm,代码行数:26,代码来源:ClojureBolt.java
示例3: add_system_components
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static StormTopology add_system_components(StormTopology topology) {
// generate inputs
Map<GlobalStreamId, Grouping> inputs = new HashMap<>();
// generate outputs
HashMap<String, StreamInfo> outputs = new HashMap<>();
//ArrayList<String> fields = new ArrayList<String>();
outputs.put(Constants.SYSTEM_TICK_STREAM_ID, Thrift.outputFields(JStormUtils.mk_list("rate_secs")));
outputs.put(Constants.METRICS_TICK_STREAM_ID, Thrift.outputFields(JStormUtils.mk_list("interval")));
outputs.put(Constants.CREDENTIALS_CHANGED_STREAM_ID, Thrift.outputFields(JStormUtils.mk_list("creds")));
// ComponentCommon common = new ComponentCommon(inputs, outputs);
IBolt ackerbolt = new SystemBolt();
Bolt bolt = Thrift.mkBolt(inputs, ackerbolt, outputs, 0);
topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, bolt);
add_system_streams(topology);
return topology;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:24,代码来源:Common.java
示例4: mkBolt
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs,
IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:Thrift.java
示例5: add_system_components
import backtype.storm.task.IBolt; //导入依赖的package包/类
@SuppressWarnings("unused")
public static StormTopology add_system_components(StormTopology topology) {
// generate inputs
Map<GlobalStreamId, Grouping> inputs = new HashMap<GlobalStreamId, Grouping>();
// generate outputs
HashMap<String, StreamInfo> outputs = new HashMap<String, StreamInfo>();
ArrayList<String> fields = new ArrayList<String>();
outputs.put(Constants.SYSTEM_TICK_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("rate_secs")));
outputs.put(Constants.METRICS_TICK_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("interval")));
outputs.put(Constants.CREDENTIALS_CHANGED_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("creds")));
ComponentCommon common = new ComponentCommon(inputs, outputs);
IBolt ackerbolt = new SystemBolt();
Bolt bolt = Thrift.mkBolt(inputs, ackerbolt, outputs,
Integer.valueOf(0));
topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, bolt);
add_system_streams(topology);
return topology;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:31,代码来源:Common.java
示例6: closeComponent
import backtype.storm.task.IBolt; //导入依赖的package包/类
private void closeComponent(Object _task_obj) {
if (_task_obj instanceof IBolt) {
((IBolt) _task_obj).cleanup();
}
if (_task_obj instanceof ISpout) {
((ISpout) _task_obj).close();
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:TaskShutdownDameon.java
示例7: setComponentType
import backtype.storm.task.IBolt; //导入依赖的package包/类
private void setComponentType() {
if (taskObj instanceof IBolt) {
componentType = "bolt";
} else if (taskObj instanceof ISpout) {
componentType = "spout";
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:Task.java
示例8: prepare
import backtype.storm.task.IBolt; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
/**
*
*/
private static final long serialVersionUID = 8969454649175064263L;
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:36,代码来源:ClojureBolt.java
示例9: add_system_components
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static StormTopology add_system_components(StormTopology topology) {
// generate inputs
Map<GlobalStreamId, Grouping> inputs = new HashMap<GlobalStreamId, Grouping>();
// generate outputs
HashMap<String, StreamInfo> outputs = new HashMap<String, StreamInfo>();
ArrayList<String> fields = new ArrayList<String>();
outputs.put(Constants.SYSTEM_TICK_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("rate_secs")));
outputs.put(Constants.METRICS_TICK_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("interval")));
outputs.put(Constants.CREDENTIALS_CHANGED_STREAM_ID,
Thrift.outputFields(JStormUtils.mk_list("creds")));
ComponentCommon common = new ComponentCommon(inputs, outputs);
IBolt ackerbolt = new SystemBolt();
Bolt bolt = Thrift.mkBolt(inputs, ackerbolt, outputs,
Integer.valueOf(0));
topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, bolt);
add_system_streams(topology);
return topology;
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:30,代码来源:Common.java
示例10: prepare
import backtype.storm.task.IBolt; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
new Object[] {
Keyword.intern(Symbol.create("output-collector")),
collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:31,代码来源:ClojureBolt.java
示例11: closeComponent
import backtype.storm.task.IBolt; //导入依赖的package包/类
private void closeComponent(Object _task_obj) {
if (_task_obj instanceof IBolt) {
((IBolt) _task_obj).cleanup();
}
if (_task_obj instanceof ISpout) {
((ISpout) _task_obj).close();
}
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:10,代码来源:TaskShutdownDameon.java
示例12: BoltExecutors
import backtype.storm.task.IBolt; //导入依赖的package包/类
public BoltExecutors(Task task) {
super(task);
this.bolt = (IBolt)task.getTaskObj();
// create TimeCacheMap
this.tuple_start_times = new RotatingMap<Tuple, Long>(Acker.TIMEOUT_BUCKET_NUM);
this.ackerNum = JStormUtils.parseInt(storm_conf.get(Config.TOPOLOGY_ACKER_EXECUTORS));
// create BoltCollector
IOutputCollector output_collector = new BoltCollector(task, tuple_start_times, message_timeout_secs);
outputCollector = new OutputCollector(output_collector);
taskHbTrigger.setBoltOutputCollector(outputCollector);
String metricName = MetricUtils.taskMetricName(topologyId, componentId, taskId, MetricDef.EXECUTE_TIME, MetricType.HISTOGRAM);
this.boltExeTimer = JStormMetrics.registerTaskMetric(metricName, new AsmHistogram());
Object tickFrequence = storm_conf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS);
if (tickFrequence != null) {
Integer frequence = JStormUtils.parseInt(tickFrequence);
TickTupleTrigger tickTupleTrigger = new TickTupleTrigger(sysTopologyCtx, frequence, idStr + Constants.SYSTEM_TICK_STREAM_ID, exeQueue);
tickTupleTrigger.register();
}
isSystemBolt = Common.isSystemComponent(componentId);
if (isSystemBolt == false) {
backpressureTrigger = new BackpressureTrigger(task, this, storm_conf, outputCollector);
int backpressureCheckFrequence = ConfigExtension.getBackpressureCheckIntervl(storm_conf);
BackpressureCheckTrigger backpressureCheckTrigger =
new BackpressureCheckTrigger(30, backpressureCheckFrequence, idStr + " backpressure check trigger", backpressureTrigger);
backpressureCheckTrigger.register(TimeUnit.MILLISECONDS);
}
LOG.info("Successfully create BoltExecutors " + idStr);
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:38,代码来源:BoltExecutors.java
示例13: prepare
import backtype.storm.task.IBolt; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap =
new PersistentArrayMap(new Object[] { Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context });
List<Object> args = new ArrayList<Object>() {
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ame) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:28,代码来源:ClojureBolt.java
示例14: mkAckerBolt
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static Bolt mkAckerBolt(Map<GlobalStreamId, Grouping> inputs,
IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkAckerComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
开发者ID:greeenSY,项目名称:Tstream,代码行数:8,代码来源:Thrift.java
示例15: mkBolt
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs, IBolt bolt,
HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
开发者ID:alibaba,项目名称:jstorm,代码行数:8,代码来源:Thrift.java
示例16: prepare
import backtype.storm.task.IBolt; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
try {
IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
final Map<Keyword, Object> collectorMap =
new PersistentArrayMap(new Object[]{Keyword.intern(Symbol.create("output-collector")), collector,
Keyword.intern(Symbol.create("context")), context});
List<Object> args = new ArrayList<Object>() {
{
add(stormConf);
add(context);
add(collectorMap);
}
};
_bolt = (IBolt) preparer.applyTo(RT.seq(args));
// this is kind of unnecessary for clojure
try {
_bolt.prepare(stormConf, context, collector);
} catch (AbstractMethodError ignored) {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:28,代码来源:ClojureBolt.java
示例17: BoltExecutors
import backtype.storm.task.IBolt; //导入依赖的package包/类
public BoltExecutors(IBolt _bolt, TaskTransfer _transfer_fn,
Map<Integer, DisruptorQueue> innerTaskTransfer, Map storm_conf,
DisruptorQueue deserializeQueue, TaskSendTargets _send_fn,
TaskStatus taskStatus, TopologyContext sysTopologyCxt,
TopologyContext userTopologyCxt, CommonStatsRolling _task_stats,
ITaskReportErr _report_error) {
super(_transfer_fn, storm_conf, deserializeQueue, innerTaskTransfer,
sysTopologyCxt, userTopologyCxt, _task_stats, taskStatus,
_report_error);
this.bolt = _bolt;
// create TimeCacheMap
this.tuple_start_times = new RotatingMap<Tuple, Long>(
Acker.TIMEOUT_BUCKET_NUM);
this.ackerNum = JStormUtils.parseInt(storm_conf
.get(Config.TOPOLOGY_ACKER_EXECUTORS));
// don't use TimeoutQueue for recv_tuple_queue,
// then other place should check the queue size
// TimeCacheQueue.DefaultExpiredCallback<Tuple> logExpireCb = new
// TimeCacheQueue.DefaultExpiredCallback<Tuple>(
// idStr);
// this.recv_tuple_queue = new
// TimeCacheQueue<Tuple>(message_timeout_secs,
// TimeCacheQueue.DEFAULT_NUM_BUCKETS, logExpireCb);
// create BoltCollector
IOutputCollector output_collector = new BoltCollector(
message_timeout_secs, _report_error, _send_fn, storm_conf,
_transfer_fn, sysTopologyCxt, taskId, tuple_start_times,
_task_stats);
outputCollector = new OutputCollector(output_collector);
boltExeTimer = Metrics.registerTimer(idStr, MetricDef.EXECUTE_TIME,
String.valueOf(taskId), Metrics.MetricType.TASK);
Object tickFrequence = storm_conf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS);
if (tickFrequence != null) {
Integer frequence = JStormUtils.parseInt(tickFrequence);
TickTupleTrigger tickTupleTrigger = new TickTupleTrigger(
sysTopologyCxt, frequence,
idStr + Constants.SYSTEM_TICK_STREAM_ID, exeQueue);
tickTupleTrigger.register();
}
try {
// do prepare
WorkerClassLoader.switchThreadContext();
// Method method = IBolt.class.getMethod("prepare", new Class[] {Map.class, TopologyContext.class,
// OutputCollector.class});
// method.invoke(bolt, new Object[] {storm_conf, userTopologyCxt, outputCollector});
bolt.prepare(storm_conf, userTopologyCtx, outputCollector);
} catch (Throwable e) {
error = e;
LOG.error("bolt prepare error ", e);
report_error.report(e);
} finally {
WorkerClassLoader.restoreThreadContext();
}
LOG.info("Successfully create BoltExecutors " + idStr);
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:71,代码来源:BoltExecutors.java
示例18: TaskBundle
import backtype.storm.task.IBolt; //导入依赖的package包/类
public TaskBundle(IBolt task, int componentId) {
this.task = task;
this.componentId = componentId;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:5,代码来源:TaskBundle.java
示例19: NonRichBoltTracker
import backtype.storm.task.IBolt; //导入依赖的package包/类
public NonRichBoltTracker(IBolt delegate, String id) {
_delegate = delegate;
_trackId = id;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:5,代码来源:NonRichBoltTracker.java
示例20: mkBolt
import backtype.storm.task.IBolt; //导入依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs, IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:7,代码来源:Thrift.java
注:本文中的backtype.storm.task.IBolt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论