Examples of LinkedBlockingQueue


Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

    /**
     * Create the queue used to hold incoming requests when requestCoreThreadPoolSize threads are busy.
     * Default is an unbounded queue.
     */
    public BlockingQueue newRequestBlockingQueue() {
        return new LinkedBlockingQueue();
    }
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

        log.debug("Using backport of the util.concurrent package..");
        executor = new ThreadPoolExecutor(
            core, max, keepAlive,
            TimeUnit.SECONDS,
            queueLength == -1 ?
                new LinkedBlockingQueue() :
                new LinkedBlockingQueue(queueLength),
            new BackportThreadFactory(new ThreadGroup(threadGroupName), threadGroupId));
    }
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

  public void start() throws AxisFault {
        // create thread pool of workers
       ExecutorService workerPool = new ThreadPoolExecutor(
                1,
                WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT,
                new LinkedBlockingQueue(),
                new org.apache.axis2.util.threadpool.DefaultThreadFactory(
                        new ThreadGroup("XMPP Worker thread group"),
                        "XMPPWorker"));

        Iterator iter = connectionFactories.values().iterator();
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

   * @see edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue
   * @see edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue
   */
  protected BlockingQueue createQueue(int queueCapacity) {
    if (queueCapacity > 0) {
      return new LinkedBlockingQueue(queueCapacity);
    }
    else {
      return new SynchronousQueue();
    }
  }
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

   * @see edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue
   * @see edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue
   */
  protected BlockingQueue createQueue(int queueCapacity) {
    if (queueCapacity > 0) {
      return new LinkedBlockingQueue(queueCapacity);
    }
    else {
      return new SynchronousQueue();
    }
  }
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

    public void start() throws AxisFault {
        // create thread pool of workers
        workerPool = new ThreadPoolExecutor(
                1,
                WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT,
                new LinkedBlockingQueue(),
                new org.apache.axis2.util.threadpool.DefaultThreadFactory(
                        new ThreadGroup("JMS Worker thread group"),
                        "JMSWorker"));

        Iterator iter = connectionFactories.values().iterator();
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue

     * one.
     *
     * @param maxSize Maximum size of the work executor pool.
     */
    public WorkExecutorPoolImpl(int maxSize) {
        pooledExecutor = new ThreadPoolExecutor(1, maxSize, 1, TimeUnit.MINUTES, new LinkedBlockingQueue());
        /*

        FIXME: How to do this with concurrent.util ?
        pooledExecutor.waitWhenBlocked();
        */
 
View Full Code Here

Examples of java.util.concurrent.LinkedBlockingQueue




    public static void testBlockingQueue() {
        final BlockingQueue queue=new LinkedBlockingQueue();

        Thread taker=new Thread() {

            public void run() {
                try {
                    System.out.println("taking an element from the queue");
                    queue.take();
                    System.out.println("clear");
                }
                catch(InterruptedException e) {                 
                }
            }
        };
        taker.start();

        Util.sleep(500);

        queue.clear(); // does this release the taker thread ?
        Util.interruptAndWaitToDie(taker);
        assert !(taker.isAlive()) : "taker: " + taker;
    }
View Full Code Here

Examples of java.util.concurrent.LinkedBlockingQueue

        // 1. Create a Selector
        selector=Selector.open();

        // Create a thread pool (Executor)
        executor=new ThreadPoolExecutor(MIN_THREAD_POOL_SIZE, MAX_THREAD_POOL_SIZE, 30000, TimeUnit.MILLISECONDS,
                                        new LinkedBlockingQueue(1000));

        for (Iterator it=mappings.keySet().iterator(); it.hasNext();) {
            key=(MyInetSocketAddress) it.next();
            value=(MyInetSocketAddress) mappings.get(key);
View Full Code Here

Examples of java.util.concurrent.LinkedBlockingQueue

     * @param numberOfThreads
     */
    public Jdk15ThreadPool(int numberOfThreads)
    {
        _execService = new ThreadPoolExecutor( numberOfThreads, numberOfThreads, 0L, TimeUnit.MILLISECONDS,
                                               new LinkedBlockingQueue(), new EJThreadFactory() );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.