Package java.util.concurrent

Examples of java.util.concurrent.ExecutorService.execute()


        };

        final ExecutorService executor = Executors.newFixedThreadPool(4, new DaemonThreadFactory("warmup"));

        executor.execute(new JaxbJavaeeLoad(WebApp.class));
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    TldScanner.scan(TomcatLoader.class.getClassLoader());
                } catch (Throwable throwable) {
View Full Code Here


            }
        });

        for (final String className : classes) {
            final ClassLoader loader = Warmup.class.getClassLoader();
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        Class.forName(className, true, loader);
                    } catch (Throwable throwable) {
View Full Code Here

   *             if interrupted while waiting for endAllSignal.
   */
  private void doBatchWork(BatchBackend backend) throws InterruptedException {
    ExecutorService executor = Executors.newFixedThreadPool( typesToIndexInParallel, "BatchIndexingWorkspace" );
    for ( Class<?> type : rootEntities ) {
      executor.execute( new BatchIndexingWorkspace( gridDialect, searchFactoryImplementor, sessionFactory, type,
          cacheMode, endAllSignal, monitor, backend ) );
    }
    executor.shutdown();
    endAllSignal.await(); // waits for the executor to finish
  }
View Full Code Here

            {
                PBSPredictor.instance().logReadResponse(id, timestamp);
            }
        }

        stage.execute(runnable);
    }

    public void setCallbackForTests(String messageId, CallbackInfo callback)
    {
        callbacks.put(messageId, callback);
View Full Code Here

        ExecutorService executor = Executors.newFixedThreadPool(messageCount);

        long start = System.currentTimeMillis();
        for (int i = 0; i < messageCount; i++) {
            executor.execute(new Runnable() {
                public void run() {
                    template.sendBody("direct:a", "<message>payload</message>");
                }
            });
        }
View Full Code Here

        ExecutorService executor = Executors.newFixedThreadPool(messageCount);

        long start = System.currentTimeMillis();
        for (int i = 0; i < messageCount; i++) {
            executor.execute(new Runnable() {
                public void run() {
                    template.sendBody("direct:expressionConstant", "<message>payload</message>");
                }
            });
        }
View Full Code Here

        ExecutorService executor = Executors.newFixedThreadPool(messageCount);

        long start = System.currentTimeMillis();
        for (int i = 0; i < messageCount; i++) {
            executor.execute(new Runnable() {
                public void run() {
                    template.sendBodyAndHeader("direct:expressionHeader", "<message>payload</message>", "throttleValue", 1);
                }
            });
        }
View Full Code Here

            return;

        Runnable runnable = new MessageDeliveryTask(message, id);
        ExecutorService stage = StageManager.getStage(message.getMessageType());
        assert stage != null : "No stage for message type " + message.getVerb();
        stage.execute(runnable);
    }

    public CallbackInfo removeRegisteredCallback(String messageId)
    {
        return callbacks.remove(messageId);
View Full Code Here

            return;

        Runnable runnable = new MessageDeliveryTask(message, id);
        ExecutorService stage = StageManager.getStage(message.getMessageType());
        assert stage != null : "No stage for message type " + message.getMessageType();
        stage.execute(runnable);
    }

    public CallbackInfo removeRegisteredCallback(String messageId)
    {
        return callbacks.remove(messageId);
View Full Code Here

   private void testDirectory(Directory dir, String testLabel) throws InterruptedException, IOException {
      SharedState state = fillDirectory(dir, TERMS_NUMBER);
      ExecutorService e = Executors.newFixedThreadPool(THREADS);
      for (int i = 0; i < THREADS; i++) {
         e.execute(new IndependentLuceneReaderThread(dir, state, i, 1, TERMS_NUMBER));
      }
      e.shutdown();
      state.startWaitingThreads();
      Thread.sleep(DURATION_MS);
      long searchesCount = state.incrementIndexSearchesCount(0);
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.