Package java.util.concurrent

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


        {
          e.printStackTrace();
        }
      }
    };
    scheduler.scheduleWithFixedDelay(beeper, 2, 2, TimeUnit.SECONDS);
  }
}
View Full Code Here


     */
    @Ignore
    @Test
    public void testConcurrentGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 100, 20, TimeUnit.MILLISECONDS);
View Full Code Here

     */
    @Test
    @Ignore
    public void testConcurrentMergeGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 100, 20, TimeUnit.MILLISECONDS);
View Full Code Here

        ScheduledExecutorService executor = getJcrEndpoint().getCamelContext().getExecutorServiceManager()
                .newSingleThreadScheduledExecutor(this, name);
        JcrConsumerSessionListenerChecker sessionListenerChecker = new JcrConsumerSessionListenerChecker();
        long sessionLiveCheckIntervalOnStart = JcrConsumer.this.getJcrEndpoint().getSessionLiveCheckIntervalOnStart();
        long sessionLiveCheckInterval = JcrConsumer.this.getJcrEndpoint().getSessionLiveCheckInterval();
        sessionListenerCheckerScheduledFuture = executor.scheduleWithFixedDelay(sessionListenerChecker,
                sessionLiveCheckIntervalOnStart, sessionLiveCheckInterval, TimeUnit.MILLISECONDS);
    }

    private class JcrConsumerSessionListenerChecker implements Runnable {
View Full Code Here

      Process process = Runtime.getRuntime().exec(shellCommand, env);

      // Startup a scheduled executor service to look through the logs
      ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
      BSStatusCollector statusCollector = new BSStatusCollector();
      ScheduledFuture<?> handle = scheduler.scheduleWithFixedDelay(statusCollector,
          0, 10, TimeUnit.SECONDS);
      LOG.info("Kicking off the scheduler for polling on logs in " +
          this.requestIdDir);
      try {
View Full Code Here

        ScheduledExecutorService executor = getJcrEndpoint().getCamelContext().getExecutorServiceManager()
                .newSingleThreadScheduledExecutor(this, name);
        JcrConsumerSessionListenerChecker sessionListenerChecker = new JcrConsumerSessionListenerChecker();
        long sessionLiveCheckIntervalOnStart = JcrConsumer.this.getJcrEndpoint().getSessionLiveCheckIntervalOnStart();
        long sessionLiveCheckInterval = JcrConsumer.this.getJcrEndpoint().getSessionLiveCheckInterval();
        sessionListenerCheckerScheduledFuture = executor.scheduleWithFixedDelay(sessionListenerChecker,
                sessionLiveCheckIntervalOnStart, sessionLiveCheckInterval, TimeUnit.MILLISECONDS);
    }

    private class JcrConsumerSessionListenerChecker implements Runnable {
View Full Code Here

    private void runRepeatedScheduling(String testName, boolean fixedRate) throws InterruptedException {
        SignallingRunnable runner = new SignallingRunnable(testName);
        ScheduledExecutorService executor = createScheduledThreadPoolExecutor();
        ScheduledFuture<?> future = fixedRate
                ? executor.scheduleAtFixedRate(runner, 25L, 135L, TimeUnit.MILLISECONDS)
                : executor.scheduleWithFixedDelay(runner, 25L, 135L, TimeUnit.MILLISECONDS);
        Thread thread = iterateRunner(runner);
        future.cancel(true);
        assertCurrentThreadExecution();
        assertLastExecutionOperation(thread);
    }
View Full Code Here

     * @throws Exception if an error occurs
     */
    @Test
    public void testConcurrentGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 100, 20, TimeUnit.MILLISECONDS);
View Full Code Here

     */
    @Test
    @Ignore
    public void testConcurrentMergeGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 100, 20, TimeUnit.MILLISECONDS);
View Full Code Here

            //Start periodical file checker task
        if (CartridgeAgentConfiguration.getInstance().isCommitsEnabled()) {
          log.info(" Commits enabled. Starting File listener ");
          ScheduledExecutorService scheduler = Executors
              .newScheduledThreadPool(1);
          scheduler.scheduleWithFixedDelay(new RepositoryFileListener(), 0,
              10, TimeUnit.SECONDS);
        }
        }

        String persistanceMappingsPayload = CartridgeAgentConfiguration.getInstance().getPersistenceMappings();
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.