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:com.sun.socialsite.business.impl.JPAListenerManagerImpl.java

/**
 * {@inheritDoc}/*from w ww.  j  a v  a2s.  c  om*/
 */
public void addListener(Class entityClass, Object listener) {
    Collection<Object> listenersForClass = listenersMap.get(entityClass);
    if (listenersForClass == null) {
        listenersMap.putIfAbsent(entityClass, new ConcurrentLinkedQueue<Object>());
        listenersForClass = listenersMap.get(entityClass);
    }
    listenersForClass.add(listener);
    log.debug(String.format("addListener(%s, %s): listenersForClass.size=%d", entityClass.getCanonicalName(),
            listener, listenersForClass.size()));
}

From source file:org.apache.synapse.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
 *///  ww w.  ja  v  a2s  . c  o  m
public Access(final Log log, AccessLogger accessLogger) {
    super();
    Access.log = log;
    Access.accessLogger = accessLogger;
    requestQueue = new ConcurrentLinkedQueue<HttpRequestWrapper>();
    responseQueue = new ConcurrentLinkedQueue<HttpResponseWrapper>();
    logElements = createLogElements();
    logAccesses();
}

From source file:org.apache.streams.filebuffer.FileBufferPersistWriter.java

@Override
public void prepare(Object configurationObject) {

    mapper = new ObjectMapper();

    File file = new File(config.getPath());

    try {//from  w  w  w.j  a  v  a  2  s .c o  m
        queueFile = new QueueFile(file);
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    Preconditions.checkArgument(file.exists());
    Preconditions.checkArgument(file.canWrite());

    Objects.requireNonNull(queueFile);

    this.persistQueue = new ConcurrentLinkedQueue<>();

}

From source file:nl.strohalm.cyclos.scheduling.SchedulingHandler.java

@Override
public void afterPropertiesSet() throws Exception {
    queue = new ConcurrentLinkedQueue<HourlyScheduledTasks>();
    settingsService.addListener(this);
}

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

public synchronized static void EnqueueRetransmit(org.uddi.repl_v3.ChangeRecord change) {
    if (queue2 == null) {
        queue2 = new ConcurrentLinkedQueue<org.uddi.repl_v3.ChangeRecord>();
    }// w  w  w  . j  ava2s.  c om
    queue2.add(change);
}

From source file:org.apache.streams.rss.provider.RssLinkProvider.java

@Override
public void prepare(Object o) {
    this.entries = new ConcurrentLinkedQueue<ObjectNode>();
    this.serializer = new SyndEntrySerializer();
    this.executor = Executors.newSingleThreadExecutor();
    this.keepRunning = new AtomicBoolean(true);
    this.doneProviding = new AtomicBoolean(false);
}

From source file:com.interacciones.mxcashmarketdata.driver.process.impl.QueueMessageProcessing.java

public QueueMessageProcessing() {
    /**/*www .  j a v a  2s.  c o m*/
     * Queue Creation Thread
     */
    MsgQueue = new ConcurrentLinkedQueue<Parser>();
    QueueReader = new QueueReader();

    queueWrite = new QueueWriteFile();
    msgQueueFile = new ConcurrentLinkedQueue<String>();
}

From source file:org.openbase.display.DisplayView.java

public DisplayView() throws InstantiationException {
    try {//from  ww  w.j  a  v  a2 s. c  o  m
        this.webTabMap = new HashMap<>();
        this.webTabUsageQueue = new ConcurrentLinkedQueue<>();
        this.htmlLoader = new HTMLLoader();
        this.cardsPane = new StackPane();

        int tmpMaxTabAmount;
        try {
            tmpMaxTabAmount = JPService.getProperty(JPTabAmount.class).getValue();
        } catch (JPServiceException ex) {
            tmpMaxTabAmount = AMOUNT_OF_TAB_FALLBACK;
        }
        this.maxTabAmount = tmpMaxTabAmount;
    } catch (CouldNotPerformException ex) {
        throw new InstantiationException(this, ex);
    }
}

From source file:com.kolich.curacao.examples.controllers.NonBlockingIOExampleController.java

@PUT("/api/nonblocking")
public final void nonblocking(final AsyncContext context, final HttpServletRequest request,
        final HttpServletResponse response, final ServletInputStream input, final ServletOutputStream output)
        throws Exception {

    final Queue<Option<String>> queue = new ConcurrentLinkedQueue<Option<String>>();

    final WriteListener writer = new StupidWriteListener(context, queue, output);

    final ReadListener reader = new StupidReadListener(queue, input, output, writer,
            request.getContentLength());

    // Producer/*from www  .j a va 2s . c o m*/
    input.setReadListener(reader);
    logger__.info("Tomcat, is input ready?: " + input.isReady());
    reader.onDataAvailable();

    // Consumer
    output.setWriteListener(writer);
    logger__.info("Tomcat, is input ready?: " + output.isReady());
    writer.onWritePossible();

}

From source file:org.peterbaldwin.vlcremote.sweep.PortSweeper.java

public PortSweeper(int port, String file, int threadCount, Callback callback, Looper looper) {
    mPort = port;//from ww w  .j av a2s .  c  om
    mPath = file;
    mWorkerCount = threadCount;
    mCallback = callback;

    mAddressQueue = new ConcurrentLinkedQueue<byte[]>();

    mWorkerManager = new MyWorkerManager();

    mWorkerCallback = new MyWorkerCallback();

    mScanThread = new HandlerThread("Scanner", Process.THREAD_PRIORITY_BACKGROUND);
    mScanThread.start();

    Handler.Callback callbackHandlerCallback = new MyCallbackHandlerCallback();
    mCallbackHandler = new Handler(looper, callbackHandlerCallback);

    Handler.Callback scanHandlerCallback = new MyScanHandlerCallback();
    mScanHandler = new Handler(mScanThread.getLooper(), scanHandlerCallback);
}