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

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


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


            }

            try
            {
                taskQueueExecutor.stop();
                ExecutorService service = getExecutorServiceForTTQE( taskQueueExecutor );
                if ( service != null )
                {
                    service.shutdown();
                }
            }
            catch ( StoppingException e )
            {
                log.error( "Unable to stop task queue executor.", e );
View Full Code Here

        }
    }

    private ExecutorService getExecutorServiceForTTQE( ThreadedTaskQueueExecutor ttqe )
    {
        ExecutorService service = null;
        try
        {
            Field executorServiceField = ttqe.getClass().getDeclaredField( "executorService" );
            executorServiceField.setAccessible( true );
            service = (ExecutorService) executorServiceField.get( ttqe );
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

            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

                topicConnection.setClientID(durableSubscriptionName);
            }
            catch (Exception e)
            {
                // Try to set the clientID in a seperate thread.
                ExecutorService clientIdSetter = Executors.newSingleThreadExecutor();
                ClientIdSetterCallable cisc = new ClientIdSetterCallable(topicFactory, durableSubscriptionName);
                Future future = clientIdSetter.submit(cisc);
                try
                {
                    topicConnection = (TopicConnection)future.get();
                }
                catch (InterruptedException ie)
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

                    "to 'either' variable)");
        }

        final long ms = this.pollMS;
        final int thrNum = this.pollMaxThreads;
        final ExecutorService execService = null;
        final StubConfigurator conf = this.stubConf;

        final PollingSubscriptionMaster master;

        if (thrNum < 1) {
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.