use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class BatchInvalidator method checkBackgroundTaskIsRunning.
private void checkBackgroundTaskIsRunning() {
if (runningBackgroundTask.get()) {
// return if already started
return;
}
if (runningBackgroundTask.compareAndSet(false, true)) {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.scheduleWithRepetition(invalidationExecutorName, new BatchInvalidationEventSender(), batchFrequencySeconds, batchFrequencySeconds, SECONDS);
}
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class BatchInvalidator method shutdown.
@Override
public void shutdown() {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.shutdownExecutor(invalidationExecutorName);
HazelcastInstance node = nodeEngine.getHazelcastInstance();
LifecycleService lifecycleService = node.getLifecycleService();
lifecycleService.removeLifecycleListener(nodeShutdownListenerId);
invalidationQueues.clear();
super.shutdown();
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class JobCoordinationService method scanJobs.
// runs periodically to restart jobs on coordinator failure and perform GC
private void scanJobs() {
long scanStart = System.currentTimeMillis();
long nextScanDelay = maxJobScanPeriodInMillis;
try {
// it will be checked again in shouldStartJobs()
if (isMaster()) {
if (shouldStartJobs()) {
doScanJobs();
} else {
// use a smaller delay when cluster is not in ready state
nextScanDelay = MIN_JOB_SCAN_PERIOD_MILLIS;
}
}
} catch (HazelcastInstanceNotActiveException ignored) {
// ignore this exception
} catch (Throwable e) {
logger.severe("Scanning jobs failed", e);
}
// Adjust the delay by the time taken by the scan to avoid accumulating more and more job results with each scan
long scanTime = System.currentTimeMillis() - scanStart;
nextScanDelay = Math.max(0, nextScanDelay - scanTime);
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.schedule(this::scanJobs, nextScanDelay, MILLISECONDS);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class JobCoordinationService method scheduleSnapshot.
void scheduleSnapshot(MasterContext mc, long executionId) {
long snapshotInterval = mc.jobConfig().getSnapshotIntervalMillis();
ExecutionService executionService = nodeEngine.getExecutionService();
if (logger.isFineEnabled()) {
logger.fine(mc.jobIdString() + " snapshot is scheduled in " + snapshotInterval + "ms");
}
executionService.schedule(COORDINATOR_EXECUTOR_NAME, () -> mc.snapshotContext().startScheduledSnapshot(executionId), snapshotInterval, MILLISECONDS);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class MapNearCacheManager method createRepairingInvalidationTask.
private RepairingTask createRepairingInvalidationTask() {
ExecutionService executionService = nodeEngine.getExecutionService();
ClusterService clusterService = nodeEngine.getClusterService();
OperationService operationService = nodeEngine.getOperationService();
HazelcastProperties properties = nodeEngine.getProperties();
ILogger metadataFetcherLogger = nodeEngine.getLogger(MemberMapInvalidationMetaDataFetcher.class);
InvalidationMetaDataFetcher invalidationMetaDataFetcher = new MemberMapInvalidationMetaDataFetcher(clusterService, operationService, metadataFetcherLogger);
ILogger repairingTaskLogger = nodeEngine.getLogger(RepairingTask.class);
UUID localUuid = nodeEngine.getLocalMember().getUuid();
return new RepairingTask(properties, invalidationMetaDataFetcher, executionService.getGlobalTaskScheduler(), serializationService, partitionService, localUuid, repairingTaskLogger);
}
Aggregations