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:Main.java

/**
 * Given any of the known collection types, this method will return an instance of the collection.
 * @param collectionType    the type of the collection
 * @return the collection instance/*  w  w w  .  j a  va  2s.  c om*/
 */
public static Collection<?> getCollection(Class<?> collectionType) {
    if (HashSet.class.equals(collectionType)) {
        return new HashSet<Object>();
    } else if (TreeSet.class.equals(collectionType)) {
        return new TreeSet<Object>();
    } else if (CopyOnWriteArraySet.class.equals(collectionType)) {
        return new CopyOnWriteArraySet<Object>();
    } else if (LinkedHashSet.class.equals(collectionType)) {
        return new LinkedHashSet<Object>();
    } else if (ArrayList.class.equals(collectionType)) {
        return new ArrayList<Object>();
    } else if (LinkedList.class.equals(collectionType)) {
        return new LinkedList<Object>();
    } else if (Vector.class.equals(collectionType)) {
        return new Vector<Object>();
    } else if (Stack.class.equals(collectionType)) {
        return new Stack<Object>();
    } else if (PriorityQueue.class.equals(collectionType)) {
        return new PriorityQueue<Object>();
    } else if (PriorityBlockingQueue.class.equals(collectionType)) {
        return new PriorityBlockingQueue<Object>();
    } else if (ArrayDeque.class.equals(collectionType)) {
        return new ArrayDeque<Object>();
    } else if (ConcurrentLinkedQueue.class.equals(collectionType)) {
        return new ConcurrentLinkedQueue<Object>();
    } else if (LinkedBlockingQueue.class.equals(collectionType)) {
        return new LinkedBlockingQueue<Object>();
    } else if (LinkedBlockingDeque.class.equals(collectionType)) {
        return new LinkedBlockingDeque<Object>();
    } else if (List.class.equals(collectionType)) {
        return new LinkedList<Object>();
    } else if (Set.class.equals(collectionType)) {
        return new HashSet<Object>();
    } else if (Queue.class.equals(collectionType)) {
        return new PriorityQueue<Object>();
    } else if (Deque.class.equals(collectionType)) {
        return new ArrayDeque<Object>();
    } else if (Collection.class.equals(collectionType)) {
        return new LinkedList<Object>();
    }
    throw new IllegalArgumentException("Unsupported collection type: " + collectionType);
}

From source file:mcnutty.music.get.ProcessQueue.java

ProcessQueue() {
    //store items which have been queued and items which have been played this bucket
    bucket_queue = new ConcurrentLinkedQueue<>();
    bucket_played = new ConcurrentLinkedQueue<>();
    bucket_youtube = new ConcurrentLinkedQueue<>();
    alias_map = new HashMap<>();
}

From source file:name.martingeisse.stackd.client.console.Console.java

/**
 * Constructor.//ww  w .j  a  v  a 2  s  .  com
 */
public Console() {
    setCommandHandler(null);
    inputLine = new StringBuilder();
    outputLines = new ConcurrentLinkedQueue<>();
}

From source file:org.beangle.commons.collection.CollectUtils.java

public static <E> Queue<E> newConcurrentLinkedQueue() {
    return new ConcurrentLinkedQueue<E>();
}

From source file:io.stallion.dataAccess.db.postgres.PostgresTickets.java

public PostgresTickets(DB db) {
    this.db = db;
    loadedIds = new ConcurrentLinkedQueue<Long>();
    createSequence();//from  www .  j  a v a2  s. c  om
    try {
        refillQueue();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}

From source file:io.stallion.dataAccess.db.mysql.MySqlTickets.java

public MySqlTickets(DB db) {
    loadedIds = new ConcurrentLinkedQueue<Long>();
    this.db = db;
    createSequence();
    refillQueue();
}

From source file:com.clican.pluto.cluster.base.BaseMessageDispatcher.java

public synchronized void bind(String msgName, IMessageHandler handler) {
    if (StringUtils.isEmpty(msgName) || handler == null) {
        throw new IllegalArgumentException("The message name and message handler can't be null");
    }/*from w  ww.ja  va  2  s  .c  om*/
    if (messageHandlerMapping.get(msgName) == null) {
        messageHandlerMapping.put(msgName, new ConcurrentLinkedQueue<IMessageHandler>());
    }
    messageHandlerMapping.get(msgName).add(handler);
}

From source file:edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasonerTBoxListener.java

public SimpleReasonerTBoxListener(SimpleReasoner simpleReasoner) {
    this.simpleReasoner = simpleReasoner;
    this.stopRequested = false;
    this.modelUpdates = new ConcurrentLinkedQueue<ModelUpdate>();
    this.processingUpdates = false;
}

From source file:org.apache.synapse.aspects.flow.statistics.store.MessageDataStore.java

public MessageDataStore() {
    queue = new ConcurrentLinkedQueue<>();
}

From source file:org.wso2.siddhi.storm.ConsumingQueuedEventSource.java

public ConsumingQueuedEventSource(StreamDefinition streamDefinition) {
    this.streamDefinition = streamDefinition;
    this.eventQueue = new ConcurrentLinkedQueue<Object[]>();
}