类com.codahale.metrics.InstrumentedExecutorService源码实例Demo

下面列出了怎么用com.codahale.metrics.InstrumentedExecutorService的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: flux   文件: MessageManagerService.java
@Inject
public MessageManagerService(MessageDao messageDao,
                             @Named("redriver.noOfPersistenceWorkers") int noOfPersistenceWorkers,
                             @Named("redriver.batchDelete.intervalms") Integer batchDeleteInterval,
                             @Named("redriver.batchDelete.batchSize") Integer batchDeleteSize,
                             @Named("redriver.batchInsert.batchSize") Integer batchInsertSize,
                             @Named("redriver.batchInsert.intervalms") Integer batchInsertInterval) {
    this.messageDao = messageDao;
    this.batchDeleteInterval = batchDeleteInterval;
    this.batchDeleteSize = batchDeleteSize;
    this.batchInsertInterval = batchInsertInterval;
    this.batchInsertSize = batchInsertSize;
    this.messagesToInsertOrUpdate = new ConcurrentLinkedQueue<>();
    this.messagesToDelete = new ConcurrentLinkedQueue<>();
    scheduledInsertionService = new InstrumentedScheduledExecutorService(Executors.newScheduledThreadPool(3),
            SharedMetricRegistries.getOrCreate(METRIC_REGISTRY_NAME), scheduledInsertionSvcName);
    scheduledDeletionService =
            new InstrumentedScheduledExecutorService(Executors.newScheduledThreadPool(2), SharedMetricRegistries.getOrCreate(METRIC_REGISTRY_NAME), scheduledDeletionSvcName);
    persistenceExecutorService =
            new InstrumentedExecutorService(Executors.newFixedThreadPool(noOfPersistenceWorkers), SharedMetricRegistries.getOrCreate(METRIC_REGISTRY_NAME), taskRegisterSvcName);
}
 
@Inject
public MultipartUploader(final MetricRegistry metricRegistry,
                         @Named("${"+CHUNK_SIZE_PROPERTY +":-0}") final int chunkSize) {
  checkArgument(chunkSize >= 0, CHUNK_SIZE_PROPERTY + " cannot be negative");
  this.chunkSize = chunkSize;
  this.executorService = MoreExecutors.listeningDecorator(
      new InstrumentedExecutorService(
        Executors.newCachedThreadPool(
          new NexusThreadFactory("multipart-upload", "nexus-blobstore-google-cloud")),
        metricRegistry, format("%s.%s", MultipartUploader.class.getName(), "executor-service")));
  this.numberOfChunks = metricRegistry.histogram(MetricRegistry.name(MultipartUploader.class, "chunks"));
  this.composeLimitHitCounter = metricRegistry.counter(MetricRegistry.name(MultipartUploader.class, "composeLimitHits"));
}
 
源代码3 项目: lucene-solr   文件: MetricUtils.java
/**
 * Returns an instrumented wrapper over the given executor service.
 */
public static ExecutorService instrumentedExecutorService(ExecutorService delegate, SolrInfoBean info, MetricRegistry metricRegistry, String scope)  {
  if (info != null && info.getSolrMetricsContext() != null) {
    info.getSolrMetricsContext().registerMetricName(MetricRegistry.name(scope, "submitted"));
    info.getSolrMetricsContext().registerMetricName(MetricRegistry.name(scope, "running"));
    info.getSolrMetricsContext().registerMetricName(MetricRegistry.name(scope, "completed"));
    info.getSolrMetricsContext().registerMetricName(MetricRegistry.name(scope, "duration"));
  }
  return new InstrumentedExecutorService(delegate, metricRegistry, scope);
}
 
源代码4 项目: cassandra-reaper   文件: ClusterResource.java
public ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor) {
  this.context = context;
  this.executor = new InstrumentedExecutorService(executor, context.metricRegistry);
  this.clusterRepairScheduler = new ClusterRepairScheduler(context);
  this.clusterFacade = ClusterFacade.create(context);
  this.cryptograph = cryptograph;
}
 
源代码5 项目: cassandra-reaper   文件: CompactionProxy.java
private CompactionProxy(JmxProxyImpl proxy, MetricRegistry metrics) {
  this.proxy = proxy;
  if (null == EXECUTOR.get()) {
    EXECUTOR.set(new InstrumentedExecutorService(Executors.newCachedThreadPool(), metrics, "CompactionProxy"));
  }
}
 
源代码6 项目: cassandra-reaper   文件: SnapshotService.java
private SnapshotService(AppContext context, ExecutorService executor, Supplier<ClusterFacade> clusterFacadeSupplier) {
  this.context = context;
  this.clusterFacade = clusterFacadeSupplier.get();
  this.executor = new InstrumentedExecutorService(executor, context.metricRegistry);
}
 
 类所在包
 同包方法