Package java.util.concurrent

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


                if (delayStr == null) {
                    delayStr = DEFAULT_DELAY;
                }
                final ScheduledExecutorService pool = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory("boomerang-updater-" + abs(hashCode())));
                final long delay = Long.parseLong(delayStr);
                final ScheduledFuture<?> task = pool.scheduleWithFixedDelay(new CollectorUpdater(collectorCounterStore, counterStore), delay, delay, TimeUnit.MILLISECONDS);
                future = new BatchFuture(pool, task);
            }
        } catch (final SironaException se) {
            counterStore = IoCs.getInstance(CounterDataStore.class);
        }
View Full Code Here


      };

      // Run test
      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(3);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 5, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdaterNoWait, 4, 3,
          TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
View Full Code Here

      // Run test
      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(3);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 5, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdaterNoWait, 4, 3,
          TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
      cce.printStackTrace();
View Full Code Here

      // Run test
      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(3);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 5, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdaterNoWait, 4, 3,
          TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
      cce.printStackTrace();
    } catch (Exception e) {
View Full Code Here

      };

      // Run test
      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(4);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thReaderLock, 1, 2,
          TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 3, TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
View Full Code Here

      // Run test
      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(4);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thReaderLock, 1, 2,
          TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 3, TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
      cce.printStackTrace();
View Full Code Here

      ScheduledExecutorService scheduler = Executors
          .newScheduledThreadPool(4);
      scheduler.scheduleWithFixedDelay(thReader, 0, 1, TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thReaderLock, 1, 2,
          TimeUnit.SECONDS);
      scheduler.scheduleWithFixedDelay(thUpdater, 2, 3, TimeUnit.SECONDS);

    } catch (ClassCastException cce) {
      cce.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

                final Thread t = new Thread(runable, "OwbConversationCleaner-" + servletContext.getContextPath());
                t.setDaemon(true);
                return t;
            }
        });
        executorService.scheduleWithFixedDelay(new ConversationCleaner(context), delay, delay, TimeUnit.MILLISECONDS);

        final ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
        final ELResolver resolver = elAdaptor.getOwbELResolver();
        //Application is configured as JSP
        if (context.getOpenWebBeansConfiguration().isJspApplication()) {
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

      throw new FlumeException("Error instantiating spooling event parser",
          ioe);
    }

    Runnable runner = new SpoolDirectoryRunnable(reader, sourceCounter);
    executor.scheduleWithFixedDelay(
        runner, 0, POLL_DELAY_MS, TimeUnit.MILLISECONDS);

    super.start();
    logger.debug("SpoolDirectorySource source started");
    sourceCounter.start();
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.