Package java.util.concurrent

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


     * 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


        }

        for (int i = 0; i < plan.getNumReaders(); ++i) {
            MeasurementReader reader = new MeasurementReader(plan.getSimulationRate(), metrics, metricsServer,
                plan.getBatchSize() * i, plan.getBatchSize());
            readers.scheduleAtFixedRate(reader, 30, 30, TimeUnit.SECONDS);
        }

        try {
            Thread.sleep(Minutes.minutes(plan.getSimulationTime()).toStandardDuration().getMillis());
        } catch (InterruptedException e) {
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

        org.apache.cassandra.SchemaLoader.loadSchema();
        final AtomicLong count = new AtomicLong();
        final long start = System.currentTimeMillis();
        System.out.println(String.format(format, "seconds", "max_mb", "allocated_mb", "free_mb", "diffrence", "count"));
        scheduled.scheduleAtFixedRate(new Runnable() {
            long lastUpdate = 0;

            public void run() {
                Runtime runtime = Runtime.getRuntime();
                long maxMemory = mb(runtime.maxMemory());
View Full Code Here

                             getConnectionsCreated());
                     log.debug("Total Number of Connections Closed       : " +
                             getConnectionsClosed());
                 }
         };
         scheduler.scheduleAtFixedRate(runnable, 60, 60, TimeUnit.SECONDS);
     }
}
View Full Code Here

            //TODO: Identify Queuing mechanisms.
            digestQueues.put(s, new ConcurrentLinkedQueue<DigestEntry>());
        }
        final ScheduledExecutorService executorService =
                Executors.newSingleThreadScheduledExecutor();
        executorService.scheduleAtFixedRate(new Runnable() {
            public void run() {
                GregorianCalendar utc = new GregorianCalendar(SimpleTimeZone.getTimeZone("UTC"));
                Map<String, List<DigestEntry>> digestEntries =
                        new HashMap<String, List<DigestEntry>>();
                try {
View Full Code Here

                    log.debug("Total Number of Connections Closed       : " +
                           connectionsClosed.get());
                }
            }
        };
        scheduler.scheduleAtFixedRate(runnable, 60, 60, TimeUnit.SECONDS);
    }
}
View Full Code Here

                        statsLog.debug("Total Number of Active Transactions      : " + count +
                                sb.toString());
                    }
                }
            };
            scheduler.scheduleAtFixedRate(runnable, 60, 60, TimeUnit.SECONDS);
        }

        // This contains a list of all the managed connections.
        private static ThreadLocal<Map<String, ManagedRegistryConnection>>
                tManagedConnectionMap =
View Full Code Here

                                records.get(Filter.RESTORE));
                    }
                }
            }
        };
        scheduler.scheduleAtFixedRate(runnable, 60, 60, TimeUnit.SECONDS);
    }

    private void incrementRecord(final String operation) {
        Runnable runnable = new Runnable() {
            public void run() {
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

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.