public BatchlogManager() { ScheduledThreadPoolExecutor executor = new DebuggableScheduledThreadPoolExecutor("BatchlogTasks"); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); batchlogTasks = executor; }
public static void deleteAsync(final String file) { Runnable runnable = new Runnable() { public void run() { deleteWithConfirm(new File(file)); } }; ScheduledExecutors.nonPeriodicTasks.execute(runnable); }
private void scheduleSetupTask(final Callable<Void> setupTask) { // The delay is to give the node a chance to see its peers before attempting the operation ScheduledExecutors.optionalTasks.schedule(new Runnable() { public void run() { // If not all nodes are on 2.2, we don't want to initialize the role manager as this will confuse 2.1 // nodes (see CASSANDRA-9761 for details). So we re-schedule the setup for later, hoping that the upgrade // will be finished by then. if (!MessagingService.instance().areAllNodesAtLeast22()) { logger.trace("Not all nodes are upgraded to a version that supports Roles yet, rescheduling setup task"); scheduleSetupTask(setupTask); return; } isClusterReady = true; try { setupTask.call(); } catch (Exception e) { logger.info("Setup task failed with error, rescheduling"); scheduleSetupTask(setupTask); } } }, AuthKeyspace.SUPERUSER_SETUP_DELAY, TimeUnit.MILLISECONDS); }
public void startBroadcasting() { // send the first broadcast "right away" (i.e., in 2 gossip heartbeats, when we should have someone to talk to); // after that send every BROADCAST_INTERVAL. Runnable runnable = new Runnable() { public void run() { if (logger.isTraceEnabled()) logger.trace("Disseminating load info ..."); Gossiper.instance.addLocalApplicationState(ApplicationState.LOAD, StorageService.instance.valueFactory.load(StorageMetrics.load.getCount())); } }; ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(runnable, 2 * Gossiper.intervalInMillis, BROADCAST_INTERVAL, TimeUnit.MILLISECONDS); } }
ScheduledExecutors.optionalTasks.shutdown(); Gossiper.instance.stop(); ScheduledExecutors.nonPeriodicTasks.shutdown(); if (!ScheduledExecutors.nonPeriodicTasks.awaitTermination(1, TimeUnit.MINUTES)) logger.warn("Miscellaneous task executor still busy after one minute; proceeding with shutdown");
public static void updateNow() { ScheduledExecutors.scheduledFastTasks.submit(NanoTimeToCurrentTimeMillis::updateTimestampBase); }
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); setRejectedExecutionHandler(rejectedExecutionHandler); }
private synchronized void scheduleKeepAliveTask() { if (keepAliveFuture == null) { int keepAlivePeriod = DatabaseDescriptor.getStreamingKeepAlivePeriod(); logger.debug("[Stream #{}] Scheduling keep-alive task with {}s period.", planId(), keepAlivePeriod); keepAliveFuture = keepAliveExecutor.scheduleAtFixedRate(new KeepAliveTask(), 0, keepAlivePeriod, TimeUnit.SECONDS); } }
public void startBroadcasting() { // send the first broadcast "right away" (i.e., in 2 gossip heartbeats, when we should have someone to talk to); // after that send every BROADCAST_INTERVAL. Runnable runnable = new Runnable() { public void run() { if (logger.isTraceEnabled()) logger.trace("Disseminating load info ..."); Gossiper.instance.addLocalApplicationState(ApplicationState.LOAD, StorageService.instance.valueFactory.load(StorageMetrics.load.getCount())); } }; ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(runnable, 2 * Gossiper.intervalInMillis, BROADCAST_INTERVAL, TimeUnit.MILLISECONDS); } }
ScheduledExecutors.optionalTasks.shutdown(); Gossiper.instance.stop(); ScheduledExecutors.nonPeriodicTasks.shutdown(); if (!ScheduledExecutors.nonPeriodicTasks.awaitTermination(1, TimeUnit.MINUTES)) logger.warn("Miscellaneous task executor still busy after one minute; proceeding with shutdown");
public static void updateNow() { ScheduledExecutors.scheduledFastTasks.submit(NanoTimeToCurrentTimeMillis::updateTimestampBase); }
public DebuggableScheduledThreadPoolExecutor(String threadPoolName) { this(1, threadPoolName, Thread.NORM_PRIORITY); setRejectedExecutionHandler(rejectedExecutionHandler); }
private synchronized void scheduleKeepAliveTask() { if (keepAliveFuture == null) { int keepAlivePeriod = DatabaseDescriptor.getStreamingKeepAlivePeriod(); logger.debug("[Stream #{}] Scheduling keep-alive task with {}s period.", planId(), keepAlivePeriod); keepAliveFuture = keepAliveExecutor.scheduleAtFixedRate(new KeepAliveTask(), 0, keepAlivePeriod, TimeUnit.SECONDS); } }
public void startBroadcasting() { // send the first broadcast "right away" (i.e., in 2 gossip heartbeats, when we should have someone to talk to); // after that send every BROADCAST_INTERVAL. Runnable runnable = new Runnable() { public void run() { if (logger.isTraceEnabled()) logger.trace("Disseminating load info ..."); Gossiper.instance.addLocalApplicationState(ApplicationState.LOAD, StorageService.instance.valueFactory.load(StorageMetrics.load.getCount())); } }; ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(runnable, 2 * Gossiper.intervalInMillis, BROADCAST_INTERVAL, TimeUnit.MILLISECONDS); } }
private void scheduleSetupTask(final Callable<Void> setupTask) { // The delay is to give the node a chance to see its peers before attempting the operation ScheduledExecutors.optionalTasks.schedule(new Runnable() { public void run() { // If not all nodes are on 2.2, we don't want to initialize the role manager as this will confuse 2.1 // nodes (see CASSANDRA-9761 for details). So we re-schedule the setup for later, hoping that the upgrade // will be finished by then. if (!MessagingService.instance().areAllNodesAtLeast22()) { logger.trace("Not all nodes are upgraded to a version that supports Roles yet, rescheduling setup task"); scheduleSetupTask(setupTask); return; } isClusterReady = true; try { setupTask.call(); } catch (Exception e) { logger.info("Setup task failed with error, rescheduling"); scheduleSetupTask(setupTask); } } }, AuthKeyspace.SUPERUSER_SETUP_DELAY, TimeUnit.MILLISECONDS); }
ScheduledExecutors.optionalTasks.shutdown(); Gossiper.instance.stop(); ScheduledExecutors.nonPeriodicTasks.shutdown(); if (!ScheduledExecutors.nonPeriodicTasks.awaitTermination(1, TimeUnit.MINUTES)) logger.warn("Failed to wait for non periodic tasks to shutdown");
public static void updateNow() { ScheduledExecutors.scheduledFastTasks.submit(NanoTimeToCurrentTimeMillis::updateTimestampBase); }
public DebuggableScheduledThreadPoolExecutor(String threadPoolName) { this(1, threadPoolName, Thread.NORM_PRIORITY); setRejectedExecutionHandler(rejectedExecutionHandler); }
public static void deleteAsync(final String file) { Runnable runnable = new Runnable() { public void run() { deleteWithConfirm(new File(file)); } }; ScheduledExecutors.nonPeriodicTasks.execute(runnable); }
public BatchlogManager() { ScheduledThreadPoolExecutor executor = new DebuggableScheduledThreadPoolExecutor("BatchlogTasks"); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); batchlogTasks = executor; }