com.codahale.metrics.InstrumentedExecutorService Java Examples

The following examples show how to use com.codahale.metrics.InstrumentedExecutorService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageManagerService.java    From flux with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: MultipartUploader.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 5 votes vote down vote up
@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"));
}
 
Example #3
Source File: MetricUtils.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: ClusterResource.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: CompactionProxy.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
private CompactionProxy(JmxProxyImpl proxy, MetricRegistry metrics) {
  this.proxy = proxy;
  if (null == EXECUTOR.get()) {
    EXECUTOR.set(new InstrumentedExecutorService(Executors.newCachedThreadPool(), metrics, "CompactionProxy"));
  }
}
 
Example #6
Source File: SnapshotService.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
private SnapshotService(AppContext context, ExecutorService executor, Supplier<ClusterFacade> clusterFacadeSupplier) {
  this.context = context;
  this.clusterFacade = clusterFacadeSupplier.get();
  this.executor = new InstrumentedExecutorService(executor, context.metricRegistry);
}