Example usage for java.util.concurrent ConcurrentLinkedQueue ConcurrentLinkedQueue

List of usage examples for java.util.concurrent ConcurrentLinkedQueue ConcurrentLinkedQueue

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentLinkedQueue ConcurrentLinkedQueue.

Prototype

public ConcurrentLinkedQueue() 

Source Link

Document

Creates a ConcurrentLinkedQueue that is initially empty.

Usage

From source file:org.apache.streams.amazon.kinesis.KinesisPersistReader.java

/**
 * KinesisPersistReader constructor - resolves KinesisReaderConfiguration from JVM 'kinesis'.
 *//* w w  w  .  j  a  v  a  2  s  . co m*/
public KinesisPersistReader() {
    Config config = StreamsConfigurator.config.getConfig("kinesis");
    this.config = new ComponentConfigurator<>(KinesisReaderConfiguration.class).detectConfiguration(config);
    this.persistQueue = new ConcurrentLinkedQueue<>();
}

From source file:com.googlecode.concurrentlinkedhashmap.MultiThreadedTest.java

@Parameters({ "iterations", "threads", "timeOut" })
public MultiThreadedTest(int iterations, int threads, int timeOut) {
    this.failures = new ConcurrentLinkedQueue<String>();
    this.iterations = iterations;
    this.timeOut = timeOut;
    this.threads = threads;
}

From source file:org.siddhiesb.transport.http.access.Access.java

/**
 * Constructor of AccessLog. AccessHandler has a static object of Access.
 *
 * @param log          - Log passed as a param. Default is Log of the same class.
 * @param accessLogger - AccessLogger Object
 *///from w  w  w.  j av a 2s.c  o  m
public Access(final Log log, AccessLogger accessLogger) {
    super();
    Access.log = log;
    Access.accessLogger = accessLogger;
    requestQueue = new ConcurrentLinkedQueue<HttpRequest>();
    responseQueue = new ConcurrentLinkedQueue<HttpResponse>();
    logElements = createLogElements();
    logAccesses();
}

From source file:org.apache.streams.hbase.HbasePersistWriter.java

/**
 * HbasePersistWriter constructor - use supplied persistQueue.
 * @param hbaseConfiguration HbaseConfiguration
 *//*from   w  w w.  j  a v a2 s  .  c o m*/
// TODO: refactor this to use HbaseConfiguration
public HbasePersistWriter(HbaseConfiguration hbaseConfiguration) {
    this.config = hbaseConfiguration;
    this.persistQueue = new ConcurrentLinkedQueue<>();
}

From source file:org.apache.juddi.replication.ReplicationNotifier.java

public synchronized static void Enqueue(org.apache.juddi.model.ChangeRecord change) {
    if (queue == null) {
        queue = new ConcurrentLinkedQueue<org.apache.juddi.model.ChangeRecord>();
    }//w  w  w  . jav  a  2 s.c o  m
    queue.add(change);
}

From source file:org.apache.spark.network.client.TransportResponseHandler.java

public TransportResponseHandler(Channel channel) {
    this.channel = channel;
    this.outstandingFetches = new ConcurrentHashMap<>();
    this.outstandingRpcs = new ConcurrentHashMap<>();
    this.streamCallbacks = new ConcurrentLinkedQueue<>();
    this.timeOfLastRequestNs = new AtomicLong(0);
}

From source file:org.apache.streams.amazon.kinesis.KinesisPersistWriter.java

/**
 * KinesisPersistWriter constructor - uses provided KinesisWriterConfiguration.
 *//*from  ww  w  .ja v  a2 s . c om*/
public KinesisPersistWriter(KinesisWriterConfiguration config) {
    this.config = config;
    this.persistQueue = new ConcurrentLinkedQueue<>();
}

From source file:org.jolokia.client.request.J4pReadIntegrationTest.java

@Test
public void error404ConnectionTest() throws Exception {
    final J4pReadRequest req = new J4pReadRequest(itSetup.getAttributeMBean(), "LongSeconds");
    try {/*w ww . j a  v  a2s  . c  o m*/
        stop();
        startWithoutAgent();
        j4pClient.execute(req);
        fail();
    } catch (J4pRemoteException exp) {
        assertEquals(404, exp.getStatus());
    }
    stop();
    start();

    final CyclicBarrier barrier = new CyclicBarrier(10);
    final Queue errors = new ConcurrentLinkedQueue();
    Runnable run = new Runnable() {
        public void run() {
            try {
                j4pClient.execute(req);
            } catch (Exception e) {
                errors.add(1);
                System.err.println(e);
            }
            try {
                barrier.await();
            } catch (InterruptedException ex) {
                return;
            } catch (BrokenBarrierException ex) {
                return;
            }
        }
    };

    for (int i = 0; i < 10; i++) {
        new Thread(run).start();
    }
    if (barrier.await() == 0) {
        //System.err.println("Finished");
        assertEquals(0, errors.size(), "Concurrent calls should work");
    }
}

From source file:org.apache.streams.amazon.kinesis.KinesisPersistReader.java

/**
 * KinesisPersistReader constructor - uses provided KinesisReaderConfiguration.
 *//*w w  w  .  j a v  a  2s  . c  o  m*/
public KinesisPersistReader(KinesisReaderConfiguration config) {
    this.config = config;
    this.persistQueue = new ConcurrentLinkedQueue<>();
}