Package java.util.concurrent

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


    //Schedule Nimbus inbox cleaner.����/nimbus/inbox�¹��ڵ�jar
    String dir_location=StormConfig.masterInbox(conf);
    int inbox_jar_expiration_secs=(Integer)conf.get(Config.NIMBUS_INBOX_JAR_EXPIRATION_SECS);
    CleanRunnable r2 = new CleanRunnable(dir_location,inbox_jar_expiration_secs);
    int cleanup_inbox_freq_secs = (Integer) conf.get(Config.NIMBUS_CLEANUP_INBOX_FREQ_SECS);
    scheduExec.scheduleAtFixedRate(r2, cleanup_inbox_freq_secs, cleanup_inbox_freq_secs,TimeUnit.SECONDS);

    //Thrift server���ü���������
    Integer thrift_port = (Integer) conf.get(Config.NIMBUS_THRIFT_PORT);
    TNonblockingServerSocket socket = new TNonblockingServerSocket(
        thrift_port);
View Full Code Here


    /** The default implementation of Scheduler. */
    private static class BasicScheduler implements Scheduler {
  public TaskHandle scheduleRecurringTask(Runnable task, long period) {
      final ScheduledExecutorService executor =
    Executors.newSingleThreadScheduledExecutor();
      executor.scheduleAtFixedRate(
    task, period, period, TimeUnit.MILLISECONDS);
      return new TaskHandle() {
    public synchronized void cancel() {
        if (executor.isShutdown()) {
      throw new IllegalStateException(
View Full Code Here

        final int FACTS_PER_POLL = 1000;
        final int POLL_INTERVAL = 500;

        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        executor.scheduleAtFixedRate(
                new Runnable() {

                    public void run() {
                        for ( int j = 0; j < FACTS_PER_POLL; j++ ) {
                            ksession.insert( new MyFact() );
View Full Code Here

   * Instantiates the ScheduledExecutorService which will iterate through all monitored Metrics at the specified period,
   * send the current value of the Metric, and then clear the value.
   */
  private void setMonitor() {
    ScheduledExecutorService eScheduledService = Executors.newSingleThreadScheduledExecutor();
    eScheduledService.scheduleAtFixedRate(new TimerTask() {
      public void run() {
        updateCount++;
        for (Metricable gmetric : gmetrics) {
          if (updateCount > initPeriod) {
            sendGMetricInit(gmetric);
View Full Code Here

        final int FACTS_PER_POLL = 1000;
        final int POLL_INTERVAL = 500;

        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        executor.scheduleAtFixedRate(
                new Runnable() {

                    public void run() {
                        for ( int j = 0; j < FACTS_PER_POLL; j++ ) {
                            ksession.insert( new MyFact() );
View Full Code Here

    /**
     * Due to the lack of contract in CDI guaranteeing when beans will be available, we use an executor to search for
     * the beans every 100ms until it finds them. Or, after a 25 seconds, blow up if they don't become available.
     */
    final ScheduledExecutorService startupScheduler = Executors.newScheduledThreadPool(1);
    startupScheduler.scheduleAtFixedRate(
        new StartupCallback(beanManager, bus, startupScheduler, 25), 0, 100, TimeUnit.MILLISECONDS);

    for (final Class<?> remoteInterfaceType : managedTypes.getRemoteInterfaces()) {
      createRPCScaffolding(remoteInterfaceType, bus, beanManager);
    }
View Full Code Here

        }
        if (getCompletionInterval() > 0) {
            LOG.info("Using CompletionInterval to run every " + getCompletionInterval() + " millis.");
            ScheduledExecutorService scheduler = camelContext.getExecutorServiceStrategy().newScheduledThreadPool(this, "AggregateTimeoutChecker", 1);
            // trigger completion based on interval
            scheduler.scheduleAtFixedRate(new AggregationIntervalTask(), 1000L, getCompletionInterval(), TimeUnit.MILLISECONDS);
        }

        // start timeout service if its in use
        if (getCompletionTimeout() > 0 || getCompletionTimeoutExpression() != null) {
            LOG.info("Using CompletionTimeout to trigger after " + getCompletionTimeout() + " millis of inactivity.");
View Full Code Here

     * Due to the lack of contract in CDI guaranteeing when beans will be available, we use an
     * executor to search for the beans every 100ms until it finds them. Or, after a 25 seconds,
     * blow up if they don't become available.
     */
    final ScheduledExecutorService startupScheduler = Executors.newScheduledThreadPool(1);
    startupScheduler.scheduleAtFixedRate(new StartupCallback(beanManager, bus, startupScheduler, 25), 0, 100,
            TimeUnit.MILLISECONDS);

    for (final Class<?> remoteInterfaceType : managedTypes.getRemoteInterfaces()) {
      createRPCScaffolding(remoteInterfaceType, bus, beanManager);
    }
View Full Code Here

    this.executer = Executors
        .newFixedThreadPool(NUMBER_OF_PARALLEL_REQUESTS);
    if (SHOW_DEBUG_PROCESSINGS_LIST) {
      ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
     
      scheduler.scheduleAtFixedRate(displayMap, 0, 1, TimeUnit.MINUTES);
    }
  }

  private Logger l = Logger.getLogger(this.getClass());
View Full Code Here

        final int FACTS_PER_POLL = 1000;
        final int POLL_INTERVAL = 500;

        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        executor.scheduleAtFixedRate(
                new Runnable() {

                    public void run() {
                        for ( int j = 0; j < FACTS_PER_POLL; j++ ) {
                            ksession.insert( new MyFact() );
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.