Package com.codahale.metrics

Examples of com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable


        this.processBuffer = processBuffer;
        this.executor = executorService(metricRegistry);
    }

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


        this.executor = executorService(metricRegistry);
        this.jobs = new ConcurrentHashMap<>();
    }

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

        rejectedMessages = metricRegistry.meter(name(OutputBuffer.class, "rejectedMessages"));
        cachedMessages = metricRegistry.meter(name(OutputBuffer.class, "cachedMessages"));
    }

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

        cc = Consumer.createJavaConsumerConnector(consumerConfig);

        final TopicFilter filter = new Whitelist(configuration.getString(CK_TOPIC_FILTER));

        final List<KafkaStream<byte[], byte[]>> streams = cc.createMessageStreamsByFilter(filter, numThreads);
        final ExecutorService executor = new InstrumentedExecutorService(Executors.newFixedThreadPool(numThreads), metricRegistry);

        // this is being used during shutdown to first stop all submitted jobs before committing the offsets back to zookeeper
        // and then shutting down the connection.
        // this is to avoid yanking away the connection from the consumer runnables
        stopLatch = new CountDownLatch(streams.size());

        for (final KafkaStream<byte[], byte[]> stream : streams) {
            executor.submit(new Runnable() {
                public void run() {
                    final ConsumerIterator<byte[], byte[]> consumerIterator = stream.iterator();

                    // we have to use hasNext() here instead foreach, because next() marks the message as processed immediately
                    //noinspection WhileLoopReplaceableByForEach
View Full Code Here

TOP

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

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.