private void rotateIfNeeded() { long nowMs = Time.currentTimeMillis(); if (nowMs >= lastRotationMs + timeoutMs) { //Rotate once per timeout period that has passed since last time this was called. //This is necessary since this method may be called at arbitrary intervals. int rotationsToDo = (int) ((nowMs - lastRotationMs) / timeoutMs); for (int i = 0; i < rotationsToDo; i++) { cachedGroups.rotate(); } lastRotationMs = nowMs; } }
public void run() { try { while (true) { Map<K, V> dead = null; Time.sleep(sleepTime); synchronized (_lock) { dead = _rotatingMap.rotate(); } if (_callback != null) { for (Entry<K, V> entry : dead.entrySet()) { _callback.expire(entry.getKey(), entry.getValue()); } } } } catch (InterruptedException ex) { } } });
private static void rotateTopologyCleanupMap(long deletionDelay) { if (Time.currentTimeMillis() - topologyCleanupRotationTime > deletionDelay) { topologyCleanupDetected.rotate(); topologyCleanupRotationTime = Time.currentTimeMillis(); } }
spoutOutputCollector.flush(); } else if (streamId.equals(Constants.SYSTEM_TICK_STREAM_ID)) { pending.rotate(); } else if (streamId.equals(Constants.METRICS_TICK_STREAM_ID)) { metricsTick(idToTask.get(taskId - idToTaskBase), tuple);
Map<Long, List<Message>> failed = batchMessageMap.rotate(); for (Long id : failed.keySet()) { LOG.warn("TIMED OUT batch with transaction id " + id + " for " + name);
@Override public void emitBatch(TransactionAttempt tx, Object coordinatorMeta, TridentCollector collector) { long txid = tx.getTransactionId(); long now = System.currentTimeMillis(); if (now - lastRotate > rotateTime) { Map<Long, List<Object>> failed = idsMap.rotate(); for (Long id : failed.keySet()) { //TODO: this isn't right... it's not in the map anymore fail(id); } lastRotate = now; } if (idsMap.containsKey(txid)) { fail(txid); } _collector.reset(collector); if (!prepared) { _spout.open(_conf, _context, new SpoutOutputCollector(_collector)); prepared = true; } for (int i = 0; i < _maxBatchSize; i++) { _spout.nextTuple(); if (_collector.numEmitted < i) { break; } } idsMap.put(txid, _collector.ids); _collector.pendingCount = idsMap.size(); }
@Override public void execute(Tuple input) { if (TupleUtils.isTick(input)) { Map<Object, AckObject> tmp = pending.rotate(); LOG.debug("Number of timeout tuples:{}", tmp.size()); return;
long now = System.currentTimeMillis(); if (now - _lastRotate > _messageTimeoutMs) { _batches.rotate(); _lastRotate = now;
private void onTick() { // Force emit all the done queries queries that are being rotated out. Map<String, Querier> forceDone = postFinishBuffer.rotate(); forceDone.entrySet().forEach(this::emitFinished); // The active queries count is not updated for these since these queries are not in any map, so do it here updateCount(activeQueriesCount, -forceDone.size()); // Start all the delayed queries and add them to queries Map<String, Querier> delayed = preStartBuffer.rotate(); delayed.entrySet().forEach(this::startDelayed); // Categorize all the active queries and do the buffering or emit as necessary handleCategorizedQueries(new QueryCategorizer().categorize(queries)); }
private void onTick() { // Force emit all the done queries queries that are being rotated out. Map<String, Querier> forceDone = postFinishBuffer.rotate(); forceDone.entrySet().forEach(this::emitFinished); // The active queries count is not updated for these since these queries are not in any map, so do it here updateCount(activeQueriesCount, -forceDone.size()); // Start all the delayed queries and add them to queries Map<String, Querier> delayed = preStartBuffer.rotate(); delayed.entrySet().forEach(this::startDelayed); // Categorize all the active queries and do the buffering or emit as necessary handleCategorizedQueries(new QueryCategorizer().categorize(queries)); }
public void run() { try { while(true) { Map<K, V> dead = null; Time.sleep(sleepTime); synchronized(_lock) { dead = _rotatingMap.rotate(); } if(_callback!=null) { for(Entry<K, V> entry: dead.entrySet()) { _callback.expire(entry.getKey(), entry.getValue()); } } } } catch (InterruptedException ex) { } } });
Map<Long, List<Message>> failed = batchMessageMap.rotate(); for(Long id: failed.keySet()) { LOG.warn("TIMED OUT batch with transaction id "+id+" for "+name);
Map<Long, List<Message>> failed = batchMessageMap.rotate(); for(Long id: failed.keySet()) { LOG.warn("TIMED OUT batch with transaction id "+id+" for "+name);
Map<Long, List<Object>> failed = idsMap.rotate(); for(Long id: failed.keySet()) {
long now = System.currentTimeMillis(); if(now - _lastRotate > _messageTimeoutMs) { _batches.rotate(); _lastRotate = now;