Package edu.emory.mathcs.backport.java.util.concurrent

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


            int th = 30;
            if (args.length > 1) {
                th = Integer.parseInt(args[1]);
            }
            latch = new CountDownLatch(nb);
            ExecutorService threadPool = Executors.newFixedThreadPool(th);
            for (int i = 0; i < nb; i++) {
                threadPool.submit(new JMSClient());
            }
            latch.await();
        }
        System.out.println("Closing.");
        requestor.close();
View Full Code Here


            int th = 30;
            if (args.length > 1) {
                th = Integer.parseInt(args[1]);
            }
            latch = new CountDownLatch(nb);
            ExecutorService threadPool = Executors.newFixedThreadPool(th);
            for (int i = 0; i < nb; i++) {
                threadPool.submit(new JMSClient());
            }
            latch.await();
        }
        System.out.println("Closing.");
        requestor.close();
View Full Code Here

        }
        else
        {
            ThreadFactory _threadFactory = new DefaultThreadFactory(name);

            final ExecutorService _executor;
           
            if (mayDie)
            {
                _executor = Executors.newCachedThreadPool(_threadFactory);
            }
View Full Code Here

   * assign a packer listener. This packet listener will trigger when a
   * message arrives.
   */
  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"),
View Full Code Here

      container1 = createDefaultMessageListenerContainer(acf,  new TestMessageListener1(500), QUEUE1_NAME);
      container1.afterPropertiesSet();

      Thread.sleep(2000);

      final ExecutorService executor = Executors.newCachedThreadPool();
      for (int i = 0; i < MAX_PRODUCERS; i++) {
        executor.submit(new PooledProducerTask(pcf, QUEUE2_NAME));
        Thread.sleep(1000);
        executor.submit(new PooledProducerTask(pcf, QUEUE1_NAME));
      }
     
      // Wait for all message to arrive.
      assertTrue(doneLatch.await(20, TimeUnit.SECONDS));     
      executor.shutdownNow();

      Assert.assertEquals(NUM_MESSAGE_TO_SEND, messageCount.get());

    } finally {
View Full Code Here

      doneLatch = new CountDownLatch(MAX_PRODUCERS * NUM_MESSAGE_TO_SEND);
      container1 = createDefaultMessageListenerContainer(acf2, new TestMessageListener1(500), QUEUE1_NAME);
      container1.afterPropertiesSet();

      final ExecutorService executor = Executors.newCachedThreadPool();
      for (int i = 0; i < MAX_PRODUCERS; i++) {
        executor.submit(new PooledProducerTask(pcf, QUEUE2_NAME));
        Thread.sleep(1000);
        executor.submit(new PooledProducerTask(pcf, QUEUE1_NAME));
      }

      assertTrue(doneLatch.await(20, TimeUnit.SECONDS));     
      executor.shutdownNow();

      Assert.assertEquals(MAX_PRODUCERS * NUM_MESSAGE_TO_SEND,
          messageCount.get());
    } finally {

View Full Code Here

      container1 = createDefaultMessageListenerContainer(acf2, new TestMessageListener1(500), QUEUE1_NAME);
      container1.afterPropertiesSet();
      container2 = createDefaultMessageListenerContainer(acf2, new TestMessageListener1(30000), QUEUE2_NAME);
      container2.afterPropertiesSet();

      final ExecutorService executor = Executors.newCachedThreadPool();
      for (int i = 0; i < MAX_PRODUCERS; i++) {
        executor.submit(new NonPooledProducerTask(acf1, QUEUE2_NAME));
        Thread.sleep(1000);
        executor.submit(new NonPooledProducerTask(acf1, QUEUE1_NAME));
      }

      assertTrue(doneLatch.await(20, TimeUnit.SECONDS));     
      executor.shutdownNow();

      Assert.assertEquals(MAX_PRODUCERS * NUM_MESSAGE_TO_SEND, messageCount.get());
    } finally {

      container1.stop();
View Full Code Here

            int th = 30;
            if (args.length > 1) {
                th = Integer.parseInt(args[1]);
            }
            latch = new CountDownLatch(nb);
            ExecutorService threadPool = Executors.newFixedThreadPool(th);
            for (int i = 0; i < nb; i++) {
                threadPool.submit(new JMSClient());
            }
            latch.await();
        }
        System.out.println("Closing.");
        requestor.close();
View Full Code Here

     *
     * @throws AxisFault
     */
    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("JMS Worker thread group"),
View Full Code Here

                intervalProducer,
                numBlocks,
                mPipe);
       
        // Start the writing thread
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.submit(dataCacheWriterCallable);
       
        // Read the values
        Thread.sleep(initialDelayConsumer);
        for (int i=0; i<numBlocks; ++i)
        {
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.backport.java.util.concurrent.ExecutorService

Copyright © 2018 www.massapicom. 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.