@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { this.collector = collector; this.pending = new RotatingMap<>(TIMEOUT_BUCKET_NUM); }
public RichSpoutEmitter(Map<String, Object> conf, TopologyContext context) { _conf = conf; _context = context; Number batchSize = (Number) conf.get(MAX_BATCH_SIZE_CONF); if (batchSize == null) { batchSize = 1000; } _maxBatchSize = batchSize.intValue(); _collector = new CaptureCollector(); idsMap = new RotatingMap<>(3); rotateTime = 1000L * ((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue(); }
public TimeCacheMap(int expirationSecs, int numBuckets, ExpiredCallback<K, V> callback) { _rotatingMap = new RotatingMap<>(numBuckets); _callback = callback; final long expirationMillis = expirationSecs * 1000L; final long sleepTime = expirationMillis / (numBuckets - 1); _cleaner = new Thread(new Runnable() { 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) { } } }); _cleaner.setDaemon(true); _cleaner.start(); }
/** * Invoked once immediately after construction * * @param topoConf Storm configuration */ @Override public void prepare(Map<String, Object> topoConf) { timeoutMs = TimeUnit.SECONDS.toMillis(ObjectReader.getInt(topoConf.get(Config.STORM_GROUP_MAPPING_SERVICE_CACHE_DURATION_SECS))); lastRotationMs = Time.currentTimeMillis(); cachedGroups = new RotatingMap<>(2); }
this.name = name; batchMessageMap = new RotatingMap<Long, List<Message>>(3); rotateTimeMillis = 1000L * ((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue(); lastRotate = System.currentTimeMillis();
_messageTimeoutMs = context.maxTopologyMessageTimeout() * 1000L; _lastRotate = System.currentTimeMillis(); _batches = new RotatingMap<>(2); _context = context; _collector = collector;
this.pending = new RotatingMap<>(2, new RotatingMap.ExpiredCallback<Long, TupleInfo>() { @Override public void expire(Long key, TupleInfo tupleInfo) {
public RichSpoutEmitter(Map conf, TopologyContext context) { _conf = conf; _context = context; Number batchSize = (Number) conf.get(MAX_BATCH_SIZE_CONF); if(batchSize==null) batchSize = 1000; _maxBatchSize = batchSize.intValue(); _collector = new CaptureCollector(); idsMap = new RotatingMap<>(3); rotateTime = 1000L * ((Number)conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue(); }
public TimeCacheMap(int expirationSecs, int numBuckets, ExpiredCallback<K, V> callback) { _rotatingMap = new RotatingMap<>(numBuckets); _callback = callback; final long expirationMillis = expirationSecs * 1000L; final long sleepTime = expirationMillis / (numBuckets-1); _cleaner = new Thread(new Runnable() { 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) { } } }); _cleaner.setDaemon(true); _cleaner.start(); }
this.name = name; batchMessageMap = new RotatingMap<Long, List<Message>>(3); rotateTimeMillis = 1000L * ((Number)conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue(); lastRotate = System.currentTimeMillis();
this.name = name; batchMessageMap = new RotatingMap<Long, List<Message>>(3); rotateTimeMillis = 1000L * ((Number)conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue(); lastRotate = System.currentTimeMillis();
@SuppressWarnings("unchecked") @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { super.prepare(stormConf, context, collector); bufferedMetadata = new HashMap<>(); queries = new HashMap<>(); int preStartDelayTicks = config.getAs(BulletStormConfig.JOIN_BOLT_WINDOW_PRE_START_DELAY_TICKS, Integer.class); preStartBuffer = new RotatingMap<>(preStartDelayTicks); int postFinishBufferTicks = config.getAs(BulletStormConfig.JOIN_BOLT_QUERY_POST_FINISH_BUFFER_TICKS, Integer.class); postFinishBuffer = new RotatingMap<>(postFinishBufferTicks); if (metricsEnabled) { activeQueriesCount = registerAbsoluteCountMetric(TopologyConstants.ACTIVE_QUERIES_METRIC, context); createdQueriesCount = registerAbsoluteCountMetric(TopologyConstants.CREATED_QUERIES_METRIC, context); improperQueriesCount = registerAbsoluteCountMetric(TopologyConstants.IMPROPER_QUERIES_METRIC, context); rateExceededQueries = registerAbsoluteCountMetric(TopologyConstants.RATE_EXCEEDED_QUERIES_METRIC, context); duplicatedQueriesCount = registerAbsoluteCountMetric(TopologyConstants.DUPLICATED_QUERIES_METRIC, context); } }
@SuppressWarnings("unchecked") @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { super.prepare(stormConf, context, collector); bufferedMetadata = new HashMap<>(); queries = new HashMap<>(); int preStartDelayTicks = config.getAs(BulletStormConfig.JOIN_BOLT_WINDOW_PRE_START_DELAY_TICKS, Integer.class); preStartBuffer = new RotatingMap<>(preStartDelayTicks); int postFinishBufferTicks = config.getAs(BulletStormConfig.JOIN_BOLT_QUERY_POST_FINISH_BUFFER_TICKS, Integer.class); postFinishBuffer = new RotatingMap<>(postFinishBufferTicks); if (metricsEnabled) { activeQueriesCount = registerAbsoluteCountMetric(TopologyConstants.ACTIVE_QUERIES_METRIC, context); createdQueriesCount = registerAbsoluteCountMetric(TopologyConstants.CREATED_QUERIES_METRIC, context); improperQueriesCount = registerAbsoluteCountMetric(TopologyConstants.IMPROPER_QUERIES_METRIC, context); rateExceededQueries = registerAbsoluteCountMetric(TopologyConstants.RATE_EXCEEDED_QUERIES_METRIC, context); duplicatedQueriesCount = registerAbsoluteCountMetric(TopologyConstants.DUPLICATED_QUERIES_METRIC, context); } }
_messageTimeoutMs = context.maxTopologyMessageTimeout() * 1000L; _lastRotate = System.currentTimeMillis(); _batches = new RotatingMap<>(2); _context = context; _collector = collector;