Package java.util.concurrent

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


        }
        if (getCompletionInterval() > 0) {
            LOG.info("Using CompletionInterval to run every " + getCompletionInterval() + " millis.");
            ScheduledExecutorService scheduler = camelContext.getExecutorServiceManager().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


        final String prefix = Configuration.CONFIG_PROPERTY_PREFIX + name;
        final long period = getPeriod(prefix);
        clearAfterCollect = isClearAfterCollect(prefix);

        final ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory(name + "-counter-schedule-"));
        final ScheduledFuture<?> future = ses.scheduleAtFixedRate(new BatchPushCountersTask(), period, period, TimeUnit.MILLISECONDS);
        scheduledTask = new BatchFuture(ses, future);
    }

    protected boolean isClearAfterCollect(final String prefix) {
        return Configuration.is(prefix + ".counter.clearOnCollect", false);
View Full Code Here

    public void initBatch() {
        final String name = getClass().getSimpleName().toLowerCase(Locale.ENGLISH).replace("gaugedatastore", "");
        final long period = getPeriod(name);

        final ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory(name + "-gauge-schedule-"));
        final ScheduledFuture<?> future = ses.scheduleAtFixedRate(new PushGaugesTask(), period, period, TimeUnit.MILLISECONDS);
        scheduledTask = new BatchFuture(ses, future);
    }

    protected int getPeriod(final String name) {
        return Configuration.getInteger(Configuration.CONFIG_PROPERTY_PREFIX + name + ".gauge.period",
View Full Code Here

        final ScheduledExecutorService ses =
            Executors.newSingleThreadScheduledExecutor( new DaemonThreadFactory( name + "-pathtracking-schedule-" ) );

        final ScheduledFuture<?> future =
            ses.scheduleAtFixedRate( new PushPathTrackingTask(), period, period, TimeUnit.MILLISECONDS );

        scheduledTask = new BatchFuture( ses, future );
    }

    protected int getPeriod( final String name )
View Full Code Here

    public void initAggregated() {
        final String name = getClass().getSimpleName().toLowerCase(Locale.ENGLISH).replace("gaugedatastore", "") + ".aggregated";
        final long period = getPeriod(name);

        final ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory(name + "-aggregated-gauge-schedule-"));
        final ScheduledFuture<?> future = ses.scheduleAtFixedRate(new PushGaugesTask(), period, period, TimeUnit.MILLISECONDS);
        scheduledAggregatedTask = new BatchFuture(ses, future);
    }

    @Destroying
    public void shutdown() {
View Full Code Here

    private void reload() {
        final String name = getClass().getSimpleName().toLowerCase(Locale.ENGLISH).replace("nodestatusdatastore", "");
        final long period = getPeriod(name);

        final ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory(name + "-status-schedule-"));
        final ScheduledFuture<?> future = ses.scheduleAtFixedRate(new ReportStatusTask(nodeStatusReporter), period, period, TimeUnit.MILLISECONDS);
        scheduledTask.set(new BatchFuture(ses, future));
    }

    protected int getPeriod(final String name) {
        return Configuration.getInteger(Configuration.CONFIG_PROPERTY_PREFIX + name + ".status.period",
View Full Code Here

            if (collectionFuture == null) {
                synchronized (this) {
                    if (collectionFuture == null) {
                        final ScheduledExecutorService ses =
                            Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory("collector-pull-schedule"));
                        final ScheduledFuture<?> future = ses.scheduleAtFixedRate(new CollectTask(), //
                                                                                  collectionPeriod, //
                                                                                  collectionPeriod, //
                                                                                  TimeUnit.MILLISECONDS);
                        collectionFuture = new BatchFuture(ses, future);
                    }
View Full Code Here

    ScheduledExecutorService scheduler = Executors
        .newSingleThreadScheduledExecutor();

    batchUpdater = new RecordBatchUpdater(sqliteManager);
    //update index per  second.
    scheduler.scheduleAtFixedRate(batchUpdater, 0, 1, TimeUnit.SECONDS);
  }
 
  public static FileSystemDb getInstance() {
    return instance;
  }
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

    /**
     * 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

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.