Package java.util.concurrent

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


            public void run() {
                executor.purge();
            }
        };
       
        executor.scheduleWithFixedDelay(task,
                PURGE, PURGE, TimeUnit.MILLISECONDS);
        return executor;
    }
   
    private static class DefaultThreadFactory implements ThreadFactory {
View Full Code Here


    for (int i=0; i<runtime.getNodeInfo().getCores(); i++)
    {
      logger.info("Starting worker thread: "+i);
      WorkHunter worker = new WorkHunter(runtime);
      exe.scheduleWithFixedDelay(worker, 0, 1, TimeUnit.MILLISECONDS);
    }
  }

  @Override
  public NodeInfo getNodeInfo() throws MicrobaseClientException
View Full Code Here

    @Override
    public void init() throws FalconException {
        WorkflowEngineFactory.getWorkflowEngine().registerListener(this);
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
        executor.scheduleWithFixedDelay(new Monitor(), POLL_PERIODICITY_SECS, POLL_PERIODICITY_SECS, TimeUnit.SECONDS);
    }

    @Override
    public void destroy() throws FalconException {
    }
View Full Code Here

        };
       
        int poolSize = 1;
        int stackSize = 1024*128;
        ScheduledThreadPoolExecutor executor = ThreadUtil.getScheduledThreadPoolExecutor("TEST", handler, poolSize, stackSize);
        executor.scheduleWithFixedDelay(r, 1, 1, TimeUnit.SECONDS);
       
        boolean ret = latch.await(10, TimeUnit.SECONDS);
        assertTrue(ret);
    }
   
View Full Code Here

    @Override
    public void init() throws IvoryException {
        WorkflowEngineFactory.getWorkflowEngine().registerListener(this);
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
        executor.scheduleWithFixedDelay(new Monitor(), POLL_PERIODICITY_SECS, POLL_PERIODICITY_SECS, TimeUnit.SECONDS);
    }

    @Override
    public void destroy() throws IvoryException {
    }
View Full Code Here

    for(CrescentCollection collection : crescentCollectionList) {
     
      ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);
      execList.add(exec);
     
      exec.scheduleWithFixedDelay(new Reloader(collection.getName()), 0, Integer.parseInt(collection.getSearcherReloadScheduleMin()), TimeUnit.MINUTES);
    }
  }
 
  private void shutdown() {
    for(ScheduledThreadPoolExecutor exec : execList) {
View Full Code Here

        final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);

        // Record latencies on a "regular" basis. This will tend to record semi-reliably at
        // each interval as long as the JVM doesn't stall.
        executor.scheduleWithFixedDelay(new Recorder(), RECORDING_INTERVAL, RECORDING_INTERVAL, TimeUnit.NANOSECONDS);

        histogramLogWriter = new HistogramLogWriter(fillInPidAndDate(defaultLogFileName));
        histogramLogWriter.outputComment("[Logged with LatencyLoggingDemo]");
        histogramLogWriter.outputLogFormatVersion();
View Full Code Here

        uncorrectedHistogramLogWriter.outputStartTime(reportingStartTime);
        uncorrectedHistogramLogWriter.outputLegend();

        // Regularly report on observations into log file:
        executor.scheduleWithFixedDelay(new Reporter(), REPORTING_INTERVAL, REPORTING_INTERVAL, TimeUnit.NANOSECONDS);

        while (true);
    }
}
View Full Code Here

        final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);

        // Record latencies on a "regular" basis. This will tend to record semi-reliably at
        // each interval as long as the JVM doesn't stall.
        executor.scheduleWithFixedDelay(new Recorder(), RECORDING_INTERVAL, RECORDING_INTERVAL, TimeUnit.NANOSECONDS);

        histogramLogWriter = new HistogramLogWriter(fillInPidAndDate(defaultLogFileName));
        histogramLogWriter.outputComment("[Logged with LatencyLoggingDemo]");
        histogramLogWriter.outputLogFormatVersion();
View Full Code Here

        histogramLogWriter.outputStartTime(reportingStartTime);
        histogramLogWriter.outputLegend();

        // Regularly report on observations into log file:
        executor.scheduleWithFixedDelay(new Reporter(), REPORTING_INTERVAL, REPORTING_INTERVAL, TimeUnit.NANOSECONDS);

        while (true);
    }
}
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.