Search in sources :

Example 1 with IntervalCheck

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);
}
Also used : IntervalCheck(com.alibaba.jstorm.utils.IntervalCheck)

Example 2 with IntervalCheck

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));
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) SpoutOutputCollector(backtype.storm.spout.SpoutOutputCollector) IntervalCheck(com.alibaba.jstorm.utils.IntervalCheck)

Example 3 with IntervalCheck

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);
}
Also used : IntervalCheck(com.alibaba.jstorm.utils.IntervalCheck)

Aggregations

IntervalCheck (com.alibaba.jstorm.utils.IntervalCheck)3 SpoutOutputCollector (backtype.storm.spout.SpoutOutputCollector)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1