PipelineInterpreter.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:graylog-plugin-pipeline-processor 作者:
@AssistedInject
public State(@Assisted ImmutableMap<String, Pipeline> currentPipelines,
             @Assisted ImmutableSetMultimap<String, Pipeline> streamPipelineConnections,
             MetricRegistry metricRegistry,
             @Named("processbuffer_processors") int processorCount,
             @Named("cached_stageiterators") boolean cachedIterators) {
    this.currentPipelines = currentPipelines;
    this.streamPipelineConnections = streamPipelineConnections;
    this.cachedIterators = cachedIterators;

    cache = CacheBuilder.newBuilder()
            .concurrencyLevel(processorCount)
            .recordStats()
            .build(new CacheLoader<Set<Pipeline>, StageIterator.Configuration>() {
                @Override
                public StageIterator.Configuration load(@Nonnull Set<Pipeline> pipelines) throws Exception {
                    return new StageIterator.Configuration(pipelines);
                }
            });

    // we have to remove the metrics, because otherwise we leak references to the cache (and the register call with throw)
    metricRegistry.removeMatching((name, metric) -> name.startsWith(name(PipelineInterpreter.class, "stage-cache")));
    MetricUtils.safelyRegisterAll(metricRegistry, new CacheStatsSet(name(PipelineInterpreter.class, "stage-cache"), cache));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号