Package java.util.concurrent

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


                public void run() {
                    bufferSynchronizer.waitForEmptyBuffers(configuration.getShutdownTimeout(), TimeUnit.MILLISECONDS);
                }
            });

            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    cacheSynchronizer.waitForEmptyCaches(configuration.getShutdownTimeout(), TimeUnit.MILLISECONDS);
                }
            });
View Full Code Here


        failureDetector.addFailureDetectorListener(listener);

        ExecutorService threadPool = Executors.newFixedThreadPool(11);

        for(int i = 0; i < 10; i++)
            threadPool.submit(new NodeAccessorRunnable(failureDetector,
                                                       node,
                                                       countDownLatch,
                                                       null,
                                                       null,
                                                       null,
View Full Code Here

                                                       null,
                                                       null,
                                                       0,
                                                       10));

        threadPool.submit(new TimedUnavailability(failureDetector, node, countDownLatch));

        threadPool.shutdown();

        // If we get stuck, we should give the user the opportunity to get a
        // thread dump.
View Full Code Here

            List<Future<Object>> results = new ArrayList<Future<Object>>(increment);
            long startTime = System.currentTimeMillis();
            final int fi = i;
            for(int j = 0; j < increment; j++) {
                final int fj = j;
                results.add(service.submit(new Callable<Object>() {

                    public Object call() throws Exception {
                        db.put(null,
                               new DatabaseEntry(Integer.toString(fi * increment + fj).getBytes()),
                               new DatabaseEntry(Integer.toString(fi * increment + fj).getBytes()));
View Full Code Here

            System.out.println("write: " + (writeTimes[i] / (double) increment));
            results.clear();

            startTime = System.currentTimeMillis();
            for(int j = 0; j < increment; j++) {
                results.add(service.submit(new Callable<Object>() {

                    public Object call() throws Exception {
                        int value = rand.nextInt((fi + 1) * increment);
                        return db.get(null,
                                      new DatabaseEntry(Integer.toString(value).getBytes()),
View Full Code Here

                logger.debug("Command to execute: " + commandLine);

            List<String> commandArgs = commandLineParser.parse(commandLine);
            UnixCommand command = new UnixCommand(hostName, commandArgs);
            Callable<?> callable = getCallable(command);
            Future<?> future = threadPool.submit(callable);
            futures.add(future);
        }

        // Build up a list of all the results and/or capture the errors as they
        // occur.
View Full Code Here

        AtomicInteger failureCounter = new AtomicInteger();

        ExecutorService threadPool = Executors.newFixedThreadPool(threads + 1);

        for(int i = 0; i < threads; i++)
            threadPool.submit(new NodeAccessorRunnable(failureDetector,
                                                       node,
                                                       countDownLatch,
                                                       successCounter,
                                                       failureCounter,
                                                       null,
View Full Code Here

                                                       failureCounter,
                                                       null,
                                                       0,
                                                       10));

        threadPool.submit(new NodeAvailability(failureDetector, node, countDownLatch));

        threadPool.shutdown();

        // If we get stuck, we should give the user the opportunity to get a
        // thread dump.
View Full Code Here

    long time = System.nanoTime();
    Deque<byte[]> allocs = new ArrayDeque<>();
    Deque<Future<T>> tasks = new ArrayDeque<>();
    byte val = 0;
    for (int i=0; i<IN_FLIGHT; ++i) {
      tasks.push(e.submit(tester.createDecompressionTask(this)));
      ++count;
    }
    Future<T> task = tasks.poll();
    while (task != null) {
        while (!task.isDone()) {
View Full Code Here

          allocs.push(v);
          if (allocs.size() > (gcChurn ? 1<<16 : 1)) allocs.poll();
        }
      task.get();
      if (count < TOTAL) {
        tasks.push(e.submit(tester.createDecompressionTask(this)));
        ++count;
      }
      task = tasks.poll();
    }
    time = System.nanoTime() - time;
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.