use of com.alibaba.jstorm.utils.IntervalCheck in project jstorm by alibaba.
the class BatchSpoutTrigger method open.
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
batchQueue = new LinkedBlockingQueue<BatchSpoutMsgId>();
this.collector = collector;
this.conf = conf;
taskName = context.getThisComponentId() + "_" + context.getThisTaskId();
intervalCheck = new IntervalCheck();
try {
zkClient = BatchCommon.getZkClient(conf);
initMsgId();
} catch (Exception e) {
LOG.error("", e);
throw new RuntimeException("Failed to init");
}
LOG.info("Successfully open " + taskName);
}
use of com.alibaba.jstorm.utils.IntervalCheck in project jstorm by alibaba.
the class TransactionSpout method open.
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
this.conf = conf;
this.topologyContext = context;
this.topologyId = topologyContext.getTopologyId();
this.taskId = topologyContext.getThisTaskId();
this.topologyMasterId = topologyContext.getTopologyMasterId();
this.componentId = topologyContext.getThisComponentId();
this.groupId = TransactionCommon.groupIndex(context.getRawTopology(), componentId);
this.downstreamTasks = TransactionCommon.getDownstreamTasks(componentId, topologyContext);
this.outputCollector = new TransactionSpoutOutputCollector(collector, this);
this.spoutStatus = State.INIT;
this.committingBatches = new TreeSet<Long>();
this.isMaxPending = false;
this.MAX_PENDING_BATCH_NUM = JStormUtils.parseInt(conf.get("transaction.max.pending.batch"), 2);
int taskLaunchTimeout = JStormUtils.parseInt(conf.get(Config.NIMBUS_TASK_LAUNCH_SECS));
int spoutInitRetryDelaySec = JStormUtils.parseInt(conf.get("transaction.spout.init.retry.secs"), taskLaunchTimeout);
this.initRetryCheck = new IntervalCheck();
initRetryCheck.setInterval(spoutInitRetryDelaySec);
this.lock = new ReentrantLock(true);
spoutExecutor.open(conf, context, new SpoutOutputCollector(outputCollector));
}
use of com.alibaba.jstorm.utils.IntervalCheck in project jstorm by alibaba.
the class Metric method init.
public void init() {
if (defaultValue == null || updater == null || merger == null || convertor == null) {
throw new IllegalArgumentException("Invalid argements");
}
rollingWindows = new ArrayList<RollingWindow<V>>();
if (windowSeconds != null) {
rollingWindows.clear();
for (int windowSize : windowSeconds) {
RollingWindow<V> rollingWindow = new RollingWindow<V>(defaultValue, windowSize / bucketSize, windowSize, updater, merger);
rollingWindows.add(rollingWindow);
}
}
allWindow = new AllWindow<V>(defaultValue, updater, merger);
this.interval = getInterval();
this.intervalCheck = new IntervalCheck();
this.intervalCheck.setInterval(interval);
}
Aggregations