Package java.util.concurrent

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


            });
         }
         else if (i % 3 == 2)
         {
            // task 3 above
            e.execute(new Runnable()
            {
               public void run()
               {
                  try
                  {
View Full Code Here


   * @throws InterruptedException if interrupted while waiting for endAllSignal.
   */
  private void doBatchWork(BatchBackend backend) throws InterruptedException {
    ExecutorService executor = Executors.newFixedThreadPool( rootEntities.length, "BatchIndexingWorkspace" );
    for ( Class<?> type : rootEntities ) {
      executor.execute(
          new BatchIndexingWorkspace(
              searchFactoryImplementor, sessionFactory, type,
              objectLoadingThreads, collectionLoadingThreads,
              cacheMode, objectLoadingBatchSize,
              endAllSignal, monitor, backend, objectsLimit
View Full Code Here

    public boolean enqueue( final Action action ) {
        boolean result = this.task.enqueue( action );
        assert result : "result must be true";
        ExecutorService service = this.pool.get();
        ifservice != null ) {
            service.execute( this.task );
        }
        return result;
    }

    /**
 
View Full Code Here

    public SendFolder(DataPacket dp) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        String[] filesPath = dp.getContent().split("\\*");

        for (int i = 0; i < filesPath.length; i++) {
            executorService.execute(sendFile(dp.getIp(), filesPath[i], i,
                    dp.getSenderName()));
        }
    }

    private Runnable sendFile(final String Ip, final String filePath,
View Full Code Here

      final PostOperationStateCheck stateCheck = new PostOperationStateCheck(caches, state, operation);
      final CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT, stateCheck);
      ExecutorService exec = Executors.newFixedThreadPool(THREAD_COUNT);
      for (int threadIndex = 0; threadIndex < THREAD_COUNT; threadIndex++) {
         Runnable validMover = new ValidMover(caches, barrier, threadIndex, state, operation);
         exec.execute(validMover);
      }
      exec.shutdown();
      try {
         exec.awaitTermination(5, TimeUnit.MINUTES);
      } catch (InterruptedException e) {
View Full Code Here

        }

        for (WorkerTask workerTask : workers) {

            /* Set them all in motion, but they will block until we call startGate.countDown(). */
            executor.execute(workerTask);
        }

        startGate.countDown();

        /* Wait for the workers to complete. */
 
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

        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedMessageCount(messageCount);

        ExecutorService executor = Executors.newFixedThreadPool(messageCount);
        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

                Thread.sleep(1, 500);
            } catch (InterruptedException e) {
                // ignore
            }

            executor.execute(new Runnable() {
                public void run() {
                    PurchaseOrder bean = new PurchaseOrder();
                    bean.setName("Beer");
                    bean.setAmount(23);
                    bean.setPrice(2.5);
View Full Code Here

        final ByteArrayInputStream[] payloads = createPayloads(testCycleCount);
        ExecutorService pool = Executors.newFixedThreadPool(20);
        long start = System.currentTimeMillis();
        for (int i = 0; i < payloads.length; i++) {
            final int finalI = i;
            pool.execute(new Runnable() {
                public void run() {
                    template.sendBody(payloads[finalI]);
                }
            });
        }
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.