Package java.util.concurrent

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


    }

    public void stop() {
        final ScheduledExecutorService scheduler = this.scheduler.get();
        if (scheduler != null && this.scheduler.compareAndSet(scheduler, null)) {
            scheduler.shutdown();
            try {
                if (!scheduler.awaitTermination(10000, MILLISECONDS)) {
                    Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Pool scheduler termination timeout expired");
                }
            } catch (final InterruptedException e) {
View Full Code Here


        // wake up threads waiting on this instance's monitor (e.g. workspace janitor)
        notifyAll();

        // Shut down the executor service
        ScheduledExecutorService executor = context.getExecutor();
        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
View Full Code Here

        // wake up threads waiting on this instance's monitor (e.g. workspace janitor)
        notifyAll();

        // Shut down the executor service
        ScheduledExecutorService executor = context.getExecutor();
        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
View Full Code Here

        assertTrue("Should be invoked", task.await());

        manager.stop();
        manager.removeTimerListener(task);
        executor.shutdown();
    }

    private class MyTask implements TimerListener {

        private CountDownLatch latch = new CountDownLatch(1);
View Full Code Here

                mk.commit("/a/b/c/d/e", "+\"f\" : {}", mk.getHeadRevision(), null);
                Thread.sleep(30);
                mk.commit("/a/b/c/d", "-\"e\"", mk.getHeadRevision(), null);
            }
        } finally {
            gcExecutor.shutdown();
        }
    }

    /**
     * Verify garbage collection can run concurrently with branch & merge.
View Full Code Here

                }
                Thread.sleep(30);
                mk.merge(branchId, null);
            }
        } finally {
            gcExecutor.shutdown();
        }
    }

    /**
     * Parses the provided string into a {@code JSONArray}.
View Full Code Here

    // Technically this listener is added after start() was called so it is a little gross, but it
    // is called within doStart() so we know that the service cannot terminate or fail concurrently
    // with adding this listener so it is impossible to miss an event that we are interested in.
    addListener(new Listener() {
      @Override public void terminated(State from) {
        executor.shutdown();
      }
      @Override public void failed(State from, Throwable failure) {
        executor.shutdown();
      }}, MoreExecutors.sameThreadExecutor());
    return executor;
View Full Code Here

    addListener(new Listener() {
      @Override public void terminated(State from) {
        executor.shutdown();
      }
      @Override public void failed(State from, Throwable failure) {
        executor.shutdown();
      }}, MoreExecutors.sameThreadExecutor());
    return executor;
  }

  /**
 
View Full Code Here

        // wake up threads waiting on this instance's monitor (e.g. workspace janitor)
        notifyAll();

        // Shut down the executor service
        ScheduledExecutorService executor = context.getExecutor();
        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
View Full Code Here

        // wake up threads waiting on this instance's monitor (e.g. workspace janitor)
        notifyAll();

        // Shut down the executor service
        ScheduledExecutorService executor = context.getExecutor();
        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
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.