@Deprecated public static long generateId() { return Utils.secureRandomLong(); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { long id = Utils.secureRandomLong(); List<Object> toEmit = new ArrayList<>(); toEmit.add(id); toEmit.addAll(input.getValues()); collector.emit(toEmit); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector))); _outputTasks = new ArrayList<>(); for(String component: Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) { _outputTasks.addAll(context.getComponentTasks(component)); } _rand = new Random(Utils.secureRandomLong()); }
random.setSeed(System.currentTimeMillis()); idGenerate = new Random(Utils.secureRandomLong());
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _rand = new Random(Utils.secureRandomLong()); _state = TransactionalState.newCoordinatorState(conf, (String) conf.get(Config.TOPOLOGY_TRANSACTIONAL_ID), _spout.getComponentConfiguration()); _coordinatorState = new RotatingTransactionalState(_state, META_DIR, true); _collector = collector; _coordinator = _spout.getCoordinator(conf, context); _currTransaction = getStoredCurrTransaction(_state); Object active = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING); if (active == null) { _maxTransactionActive = 1; } else { _maxTransactionActive = Utils.getInt(active); } _initializer = new StateInitializer(); }
@Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.batchXorTracker = new AckPendingBatchTracker<>(); this.ackOutputCollector = new AckOutputCollector(collector.getDelegate(), batchXorTracker); this.bolt.prepare(stormConf, context, new OutputCollector(ackOutputCollector)); this.componentId = context.getThisComponentId(); this.taskId = context.getThisTaskId(); this.taskStats = new TaskBaseMetric(context.getTopologyId(), componentId, taskId); this.batchTimeout = ConfigExtension.getTransactionBatchSnapshotTimeout(stormConf) * 1000; this.random = new Random(Utils.secureRandomLong()); LOG.info("batchTimeout: {}", batchTimeout); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { SpoutOutputCollectorCb ackOutput = new AckSpoutOutputCollector(collector.getDelegate()); spoutExecutor.open(conf, context, new SpoutOutputCollector(ackOutput)); tracker = new AckPendingBatchTracker<>(); taskStats = new TaskBaseMetric(context.getTopologyId(), context.getThisComponentId(), context.getThisTaskId()); random = new Random(Utils.secureRandomLong()); }
public BoltCollector(Task task, RotatingMap<Tuple, Long> tupleStartTimes, int message_timeout_secs) { this.rotateTime = 1000L * message_timeout_secs / (Acker.TIMEOUT_BUCKET_NUM - 1); this.reportError = task.getReportErrorDie(); this.sendTargets = task.getTaskSendTargets(); this.stormConf = task.getStormConf(); this.taskTransfer = task.getTaskTransfer(); this.topologyContext = task.getTopologyContext(); this.taskId = task.getTaskId(); this.taskStats = task.getTaskStats(); this.pendingAcks = new RotatingMap<>(Acker.TIMEOUT_BUCKET_NUM); // this.pending_acks = new TimeCacheMap<Tuple, // Long>(messageTimeoutSecs, // Acker.TIMEOUT_BUCKET_NUM); this.tupleStartTimes = tupleStartTimes; this.ackerNum = JStormUtils.parseInt(stormConf.get(Config.TOPOLOGY_ACKER_EXECUTORS)); String componentId = topologyContext.getThisComponentId(); this.emitTimer = (AsmHistogram) JStormMetrics.registerTaskMetric(MetricUtils.taskMetricName( topologyContext.getTopologyId(), componentId, taskId, MetricDef.COLLECTOR_EMIT_TIME, MetricType.HISTOGRAM), new AsmHistogram()); this.emitTimer.setEnabled(false); this.random = new Random(Utils.secureRandomLong()); }
public SpoutCollector(Task task, TimeOutMap<Long, TupleInfo> pending, DisruptorQueue disruptorAckerQueue) { this.sendTargets = task.getTaskSendTargets(); this.storm_conf = task.getStormConf(); this.transfer_fn = task.getTaskTransfer(); this.pending = pending; this.topology_context = task.getTopologyContext(); this.disruptorAckerQueue = disruptorAckerQueue; this.task_stats = task.getTaskStats(); this.spout = (ISpout) task.getTaskObj(); this.task_id = task.getTaskId(); this.report_error = task.getReportErrorDie(); ackerNum = JStormUtils.parseInt(storm_conf.get(Config.TOPOLOGY_ACKER_EXECUTORS)); random = new Random(Utils.secureRandomLong()); if (spout instanceof IAckValueSpout || spout instanceof IFailValueSpout) isCacheTuple = true; else isCacheTuple = false; String componentId = topology_context.getThisComponentId(); emitTotalTimer = (AsmHistogram) JStormMetrics.registerTaskMetric(MetricUtils.taskMetricName( topology_context.getTopologyId(), componentId, task_id, MetricDef.COLLECTOR_EMIT_TIME, MetricType.HISTOGRAM), new AsmHistogram()); emitTotalTimer.setEnabled(false); }
@Deprecated public static long generateId() { return Utils.secureRandomLong(); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { long id = Utils.secureRandomLong(); List<Object> toEmit = new ArrayList<Object>(); toEmit.add(id); toEmit.addAll(input.getValues()); collector.emit(toEmit); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { long id = Utils.secureRandomLong(); List<Object> toEmit = new ArrayList<Object>(); toEmit.add(id); toEmit.addAll(input.getValues()); collector.emit(toEmit); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector))); _outputTasks = new ArrayList<Integer>(); for(String component: Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) { _outputTasks.addAll(context.getComponentTasks(component)); } _rand = new Random(Utils.secureRandomLong()); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector))); _outputTasks = new ArrayList<>(); for(String component: Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) { _outputTasks.addAll(context.getComponentTasks(component)); } _rand = new Random(Utils.secureRandomLong()); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _rand = new Random(Utils.secureRandomLong()); _state = TransactionalState.newCoordinatorState(conf, (String) conf.get(Config.TOPOLOGY_TRANSACTIONAL_ID), _spout.getComponentConfiguration()); _coordinatorState = new RotatingTransactionalState(_state, META_DIR, true); _collector = collector; _coordinator = _spout.getCoordinator(conf, context); _currTransaction = getStoredCurrTransaction(_state); Object active = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING); if(active==null) { _maxTransactionActive = 1; } else { _maxTransactionActive = Utils.getInt(active); } _initializer = new StateInitializer(); }
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _rand = new Random(Utils.secureRandomLong()); _state = TransactionalState.newCoordinatorState(conf, (String) conf.get(Config.TOPOLOGY_TRANSACTIONAL_ID), _spout.getComponentConfiguration()); _coordinatorState = new RotatingTransactionalState(_state, META_DIR, true); _collector = collector; _coordinator = _spout.getCoordinator(conf, context); _currTransaction = getStoredCurrTransaction(_state); Object active = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING); if (active == null) { _maxTransactionActive = 1; } else { _maxTransactionActive = Utils.getInt(active); } _initializer = new StateInitializer(); }
public SpoutCollector(Task task, TimeOutMap<Long, TupleInfo> pending, DisruptorQueue disruptorAckerQueue) { this.sendTargets = task.getTaskSendTargets(); this.storm_conf = task.getStormConf(); this.transfer_fn = task.getTaskTransfer(); this.pending = pending; this.topology_context = task.getTopologyContext(); this.disruptorAckerQueue = disruptorAckerQueue; this.task_stats = task.getTaskStats(); this.spout = (ISpout) task.getTaskObj(); this.task_id = task.getTaskId(); this.report_error = task.getReportErrorDie(); ackerNum = JStormUtils.parseInt(storm_conf.get(Config.TOPOLOGY_ACKER_EXECUTORS)); random = new Random(Utils.secureRandomLong()); /* random.setSeed(System.currentTimeMillis());*/ String componentId = topology_context.getThisComponentId(); emitTotalTimer = (AsmHistogram) JStormMetrics.registerTaskMetric(MetricUtils.taskMetricName( topology_context.getTopologyId(), componentId, task_id, MetricDef.COLLECTOR_EMIT_TIME, MetricType.HISTOGRAM), new AsmHistogram()); emitTotalTimer.setEnabled(false); }
public BoltCollector(Task task, RotatingMap<Tuple, Long> tuple_start_times, int message_timeout_secs) { this.rotateTime = 1000L * message_timeout_secs / (Acker.TIMEOUT_BUCKET_NUM - 1); this.reportError = task.getReportErrorDie(); this.sendTargets = task.getTaskSendTargets(); this.storm_conf = task.getStormConf(); this.taskTransfer = task.getTaskTransfer(); this.topologyContext = task.getTopologyContext(); this.task_id = task.getTaskId(); this.task_stats = task.getTaskStats(); this.pending_acks = new RotatingMap<Tuple, Long>(Acker.TIMEOUT_BUCKET_NUM); // this.pending_acks = new TimeCacheMap<Tuple, // Long>(message_timeout_secs, // Acker.TIMEOUT_BUCKET_NUM); this.tuple_start_times = tuple_start_times; this.ackerNum = JStormUtils.parseInt(storm_conf.get(Config.TOPOLOGY_ACKER_EXECUTORS)); String componentId = topologyContext.getThisComponentId(); this.emitTimer = (AsmHistogram) JStormMetrics.registerTaskMetric(MetricUtils.taskMetricName( topologyContext.getTopologyId(), componentId, task_id, MetricDef.COLLECTOR_EMIT_TIME, MetricType.HISTOGRAM), new AsmHistogram()); this.emitTimer.setEnabled(false); //this.emitTimer.setTimeUnit(TimeUnit.NANOSECONDS); random = new Random(Utils.secureRandomLong()); /* random.setSeed(System.currentTimeMillis());*/ }