Example usage for com.google.common.collect Queues newLinkedBlockingQueue

List of usage examples for com.google.common.collect Queues newLinkedBlockingQueue

Introduction

In this page you can find the example usage for com.google.common.collect Queues newLinkedBlockingQueue.

Prototype

public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements) 

Source Link

Document

Creates a LinkedBlockingQueue with a capacity of Integer#MAX_VALUE , containing the elements of the specified iterable, in the order they are returned by the iterable's iterator.

Usage

From source file:org.graylog.collector.buffer.MessageBuffer.java

@Inject
public MessageBuffer(MessageBufferConfiguration config, MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;
    this.queue = Queues.newLinkedBlockingQueue(config.getSize());

    this.inserted = metricRegistry.meter(name(getClass(), "inserted"));
    this.removed = metricRegistry.meter(name(getClass(), "removed"));
}

From source file:com.datatorrent.contrib.hbase.HBaseScanOperator.java

@Override
public void setup(OperatorContext context) {
    super.setup(context);
    resultQueue = Queues.newLinkedBlockingQueue(queueSize);
}

From source file:org.apache.gobblin.metrics.reporter.EventReporter.java

public EventReporter(Builder builder) {
    super(builder.context, builder.name, builder.filter, builder.rateUnit, builder.durationUnit);

    this.closer = Closer.create();
    this.immediateReportExecutor = MoreExecutors
            .getExitingExecutorService(/*from  w  ww .  j a v  a2s.  c  om*/
                    (ThreadPoolExecutor) Executors.newFixedThreadPool(1,
                            ExecutorsUtils.newThreadFactory(Optional.of(LOGGER),
                                    Optional.of("EventReporter-" + builder.name + "-%d"))),
                    5, TimeUnit.MINUTES);

    this.metricContext = builder.context;
    this.notificationTargetKey = builder.context.addNotificationTarget(new Function<Notification, Void>() {
        @Nullable
        @Override
        public Void apply(Notification notification) {
            notificationCallback(notification);
            return null;
        }
    });
    this.reportingQueue = Queues.newLinkedBlockingQueue(QUEUE_CAPACITY);
}