Package com.codahale.metrics

Examples of com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable


    public EventBus get() {
        return new AsyncEventBus("graylog2-eventbus", executorService(configuration.getAsyncEventbusProcessors()));
    }

    private ExecutorService executorService(int nThreads) {
        return new InstrumentedExecutorService(Executors.newFixedThreadPool(nThreads, threadFactory()), metricRegistry);
    }
View Full Code Here


        this.pluginRestResources = pluginRestResources;
        this.bootstrap = bootstrap;
    }

    private static ExecutorService instrumentedExecutor(final String nameFormat, final MetricRegistry metricRegistry) {
        return new InstrumentedExecutorService(
                Executors.newCachedThreadPool(threadFactory(nameFormat, metricRegistry)), metricRegistry);
    }
View Full Code Here

            tlsCertFile = configuration.getRestTlsCertFile();
            tlsKeyFile = configuration.getRestTlsKeyFile();
        }

        // TODO Magic numbers
        final ExecutorService executor = new InstrumentedExecutorService(new OrderedMemoryAwareThreadPoolExecutor(configuration.getRestThreadPoolSize(), 1048576, 1048576), metricRegistry);

        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                final ChannelPipeline pipeline = Channels.pipeline();
View Full Code Here

        this.buffer = Lists.newArrayListWithCapacity(maxBufferSize);
        this.processTime = metricRegistry.timer(name(this.getClass(), "processTime"));
        this.batchSize = metricRegistry.histogram(name(this.getClass(), "batchSize"));
        this.bufferFlushes = metricRegistry.meter(name(this.getClass(), "bufferFlushes"));
        this.bufferFlushesRequested = metricRegistry.meter(name(this.getClass(), "bufferFlushesRequested"));
        this.flushThread = new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), metricRegistry);
    }
View Full Code Here

        this.processTime = metricRegistry.timer(name(OutputBufferProcessor.class, "processTime"));
    }

    private ExecutorService executorService(final MetricRegistry metricRegistry, final String nameFormat,
                                            final int corePoolSize, final int maxPoolSize, final int keepAliveTime) {
        return new InstrumentedExecutorService(new ThreadPoolExecutor(
                corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(), threadFactory(metricRegistry, nameFormat)), metricRegistry);
    }
View Full Code Here

        this.executor = executorService();
        this.timeLimiter = new SimpleTimeLimiter(executor);
    }

    private ExecutorService executorService() {
        return new InstrumentedExecutorService(Executors.newCachedThreadPool(threadFactory()), metricRegistry);
    }
View Full Code Here

    @Override
    protected void shutDown() throws Exception {
        LOG.debug("Stopping BufferSynchronizerService");
        if (indexerAvailable && cluster.isConnectedAndHealthy()) {
            final ExecutorService executorService = new InstrumentedExecutorService(Executors.newFixedThreadPool(2), metricRegistry);

            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    bufferSynchronizer.waitForEmptyBuffers(configuration.getShutdownTimeout(), TimeUnit.MILLISECONDS);
                }
            });

            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    cacheSynchronizer.waitForEmptyCaches(configuration.getShutdownTimeout(), TimeUnit.MILLISECONDS);
                }
            });

            executorService.shutdown();
            executorService.awaitTermination(configuration.getShutdownTimeout(), TimeUnit.MILLISECONDS);
        } else {
            LOG.warn("Elasticsearch is unavailable. Not waiting to clear buffers and caches, as we have no healthy cluster.");
        }
        LOG.debug("Stopped BufferSynchronizerService");
    }
View Full Code Here

            public void terminated(State from) {
                LOG.debug("Shutting down ES client after buffer synchronizer has terminated.");
                // Properly close ElasticSearch node.
                IndexerSetupService.this.node.close();
            }
        }, new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), metricRegistry));
    }
View Full Code Here

        bufferSynchronizerService.addListener(new Listener() {
            @Override
            public void terminated(State from) {
                OutputSetupService.this.shutDownRunningOutputs();
            }
        }, new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), metricRegistry));
    }
View Full Code Here

            SOURCE_NODE_ATTR_NAME = "gl2_source_node";
        }
    }

    private ExecutorService executorService(MetricRegistry metricRegistry) {
        return new InstrumentedExecutorService(
                Executors.newCachedThreadPool(threadFactory(metricRegistry)), metricRegistry);
    }
View Full Code Here

TOP

Related Classes of com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.