Package java.util.concurrent

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


                    } catch (Exception e) {
                        log.error("TODO Auto-generated catch block", e);
                    }
                }
            };
            executor.execute(worker);
        }
        while (context.getInflightRepository().size() > 0) {
            Thread.sleep(100);
        }
        executor.shutdown();
View Full Code Here


                    } catch (Exception e) {
                        log.error("TODO Auto-generated catch block", e);
                    }
                }
            };
            executor.execute(worker);
        }
        while (context.getInflightRepository().size() > 0) {

        }
        executor.shutdown();
View Full Code Here

        byte[] buf = new byte[256];
        DatagramPacket dp = new DatagramPacket(buf, buf.length);
        this.socket.receive(dp);
        //FIXME feature : add a queue.
        Worker w = new Worker(dp);
        exec.execute(w);
      }
    } catch (SocketException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

  }
 
  protected void startScrobblingService() {
   
    ExecutorService threadExecutor = Executors.newSingleThreadExecutor();
    threadExecutor.execute(new Runnable() {
      @Override
      public void run() {
        try {
          receive();
        } catch (Throwable t) {
View Full Code Here

                    job.getJobLabel(),
                    job.getServiceLabel(),
                    resourceId);
        }
        Executing executing = new Executing(monitor, context, job, doneQueue);
        executor.execute(executing);
        return executing;
    }
}
View Full Code Here

      while (true) {
        byte[] buf = new byte[256];
        DatagramPacket dp = new DatagramPacket(buf, buf.length);
        this.socket.receive(dp);
        Worker w = new Worker(dp);
        exec.execute(w);
      }
    } catch (SocketException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

                    Worker[] workers = new Worker[clientsCount];
                    for (int i = 0; i < clientsCount; ++i)
                    {
                        workers[i] = new Worker(barrier, requestsCount, sessionCookie, urls);
                        workers[i].start();
                        executor.execute(workers[i]);
                    }
                    // Wait for all workers to be ready
                    barrier.await();
                    long start = System.nanoTime();
View Full Code Here

                    Worker[] workers = new Worker[clientsCount];
                    for (int i = 0; i < clientsCount; ++i)
                    {
                        workers[i] = new Worker(barrier, requestsCount, sessionCookie, urls);
                        workers[i].start();
                        executor.execute(workers[i]);
                    }
                    // Wait for all workers to be ready
                    barrier.await();
                    long start = System.nanoTime();
View Full Code Here

   * @throws InterruptedException if interrupted while waiting for endAllSignal.
   */
  private void doBatchWork() 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

        }

        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

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.