Package java.util.concurrent

Examples of java.util.concurrent.ScheduledExecutorService.schedule()


    }

    private ScheduledFuture<String> scheduleCommit(long delay, final String revisionId) {
        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        final MicroKernel mk = this.mk;
        ScheduledFuture<String> future = executorService.schedule(new Callable<String>(){
            @Override
            public String call() throws Exception {
                return mk.commit("/", "+\"b\" : {}", revisionId, null);
            }
        }, delay, TimeUnit.MILLISECONDS);
View Full Code Here


    }

    private ScheduledFuture<String> scheduleCommit(long delay, final String revisionId) {
        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        final MicroKernel mk = this.mk;
        ScheduledFuture<String> future = executorService.schedule(new Callable<String>(){
            @Override
            public String call() throws Exception {
                return mk.commit("/", "+\"b\" : {}", revisionId, null);
            }
        }, delay, TimeUnit.MILLISECONDS);
View Full Code Here

      ClusterStatus clusterStatus = groomServerManager.getClusterStatus(false);
      final int numGroomServers = clusterStatus.getGroomServers();
      final ScheduledExecutorService sched = Executors
          .newScheduledThreadPool(statuses.length + 5);
      for (GroomServerStatus status : statuses) {
        sched
            .schedule(new TaskWorker(status, numGroomServers, job), 0, SECONDS);
      }// for
    }
  }
View Full Code Here

          stat = BSStat.ERROR;
        } else {
          stat = BSStat.SUCCESS;
        }

        scheduler.schedule(new BSStatusCollector(), 0, TimeUnit.SECONDS);
        long startTime = System.currentTimeMillis();
        while (true) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Waiting for hosts status to be updated");
          }
View Full Code Here

      } catch (InterruptedException e) {
        throw new IOException(e);
      } finally {
        handle.cancel(true);
        /* schedule a last update */
        scheduler.schedule(new BSStatusCollector(), 0, TimeUnit.SECONDS);
        scheduler.shutdownNow();
        try {
          scheduler.awaitTermination(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
          LOG.info("Interruped while waiting for scheduler");
View Full Code Here

      ClusterStatus clusterStatus = groomServerManager.getClusterStatus(false);
      final int numGroomServers = clusterStatus.getGroomServers();
      final ScheduledExecutorService sched = Executors
          .newScheduledThreadPool(statuses.length + 5);
      for (GroomServerStatus status : statuses) {
        sched
            .schedule(new TaskWorker(status, numGroomServers, job), 0, SECONDS);
      }// for
    }
  }
View Full Code Here

    }

    private ScheduledFuture<String> scheduleCommit(long delay, final String revisionId) {
        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        final MicroKernel mk = this.mk;
        ScheduledFuture<String> future = executorService.schedule(new Callable<String>(){
            @Override
            public String call() throws Exception {
                return mk.commit("/", "+\"b\" : {}", revisionId, null);
            }
        }, delay, TimeUnit.MILLISECONDS);
View Full Code Here

  public ScheduledFuture schedule(Runnable task, Date startTime) {
    ScheduledExecutorService executor = getScheduledExecutor();
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
      return executor.schedule(errorHandlingTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
      throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
  }
View Full Code Here

    this.rs.close();

    System.out.println("testBug64204.main: PID is " + connectionId);
   
    ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
    es.schedule(new Callable<Boolean>() {

      public Boolean call() throws Exception {
        boolean res = false;
        Connection con2 = getConnectionWithProps(props);
        con2.setCatalog("information_schema");
View Full Code Here

      }
    }

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(12);

    ScheduledFuture<?> f1 = scheduler.schedule(new PollTask(failoverconnection[0], 1), 500, TimeUnit.MILLISECONDS);
    ScheduledFuture<?> f2 = scheduler.schedule(new PollTask(failoverconnection[1], 2), 500, TimeUnit.MILLISECONDS);
    ScheduledFuture<?> f3 = scheduler.schedule(new PollTask(failoverconnection[2], 3), 500, TimeUnit.MILLISECONDS);
    ScheduledFuture<?> f4 = scheduler.schedule(new PollTask(loadbalancedconnection[0], 4), 500, TimeUnit.MILLISECONDS);
    ScheduledFuture<?> f5 = scheduler.schedule(new PollTask(loadbalancedconnection[1], 5), 500, TimeUnit.MILLISECONDS);
    ScheduledFuture<?> f6 = scheduler.schedule(new PollTask(loadbalancedconnection[2], 6), 500, TimeUnit.MILLISECONDS);
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.