use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class PartitionContainer method createRecordStore.
private RecordStore createRecordStore(String name) {
MapServiceContext serviceContext = mapService.getMapServiceContext();
MapContainer mapContainer = serviceContext.getMapContainer(name);
MapConfig mapConfig = mapContainer.getMapConfig();
NodeEngine nodeEngine = serviceContext.getNodeEngine();
IPartitionService ps = nodeEngine.getPartitionService();
OperationService opService = nodeEngine.getOperationService();
ExecutionService execService = nodeEngine.getExecutionService();
HazelcastProperties hazelcastProperties = nodeEngine.getProperties();
MapKeyLoader keyLoader = new MapKeyLoader(name, opService, ps, nodeEngine.getClusterService(), execService, mapContainer.toData(), serviceContext.getNodeWideLoadedKeyLimiter());
keyLoader.setMaxBatch(hazelcastProperties.getInteger(ClusterProperty.MAP_LOAD_CHUNK_SIZE));
keyLoader.setMaxSize(getMaxSizePerNode(mapConfig.getEvictionConfig()));
keyLoader.setHasBackup(mapConfig.getTotalBackupCount() > 0);
keyLoader.setMapOperationProvider(serviceContext.getMapOperationProvider(name));
if (!mapContainer.isGlobalIndexEnabled()) {
Indexes indexesForMap = mapContainer.createIndexes(false);
indexes.putIfAbsent(name, indexesForMap);
}
RecordStore recordStore = serviceContext.createRecordStore(mapContainer, partitionId, keyLoader);
recordStore.init();
return recordStore;
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class SplitBrainProtectionServiceImpl method start.
public void start() {
// before starting, no splitBrainProtections are used, just SplitBrainProtectionService dependency is
// provided to services which depend on it so it's safe to initialize splitBrainProtections here (and we have
// ClusterService already constructed)
this.splitBrainProtections = Collections.unmodifiableMap(initializeSplitBrainProtections());
scanSplitBrainProtections();
initializeListeners();
if (isInactive()) {
return;
}
ExecutionService executionService = nodeEngine.getExecutionService();
// single thread split brain protection executor
executionService.register(SPLIT_BRAIN_PROTECTION_EXECUTOR, 1, Integer.MAX_VALUE, ExecutorType.CACHED);
long heartbeatInterval = nodeEngine.getProperties().getSeconds(ClusterProperty.HEARTBEAT_INTERVAL_SECONDS);
executionService.scheduleWithRepetition(SPLIT_BRAIN_PROTECTION_EXECUTOR, new UpdateSplitBrainProtections(), heartbeatInterval, heartbeatInterval, TimeUnit.SECONDS);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class ShutdownClusterMessageTask method call.
@Override
protected Object call() throws Exception {
ILogger logger = nodeEngine.getLogger(getClass());
ExecutionService executionService = nodeEngine.getExecutionService();
Future<Void> future = executionService.submit(ExecutionService.ASYNC_EXECUTOR, () -> {
nodeEngine.getClusterService().shutdown();
return null;
});
executionService.asCompletableFuture(future).whenCompleteAsync(withTryCatch(logger, (empty, error) -> sendResponse(error != null ? peel(error) : null)), CALLER_RUNS);
return null;
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class RaftGroupMembershipManager method init.
void init() {
if (raftService.getLocalCPMember() == null || !initialized.compareAndSet(false, true)) {
return;
}
ExecutionService executionService = nodeEngine.getExecutionService();
// scheduleWithRepetition skips subsequent execution if one is already running.
executionService.scheduleWithRepetition(CP_SUBSYSTEM_MANAGEMENT_EXECUTOR, new RaftGroupDestroyHandlerTask(), MANAGEMENT_TASK_PERIOD_IN_MILLIS, MANAGEMENT_TASK_PERIOD_IN_MILLIS, MILLISECONDS);
executionService.scheduleWithRepetition(CP_SUBSYSTEM_MANAGEMENT_EXECUTOR, new RaftGroupMembershipChangeHandlerTask(), MANAGEMENT_TASK_PERIOD_IN_MILLIS, MANAGEMENT_TASK_PERIOD_IN_MILLIS, MILLISECONDS);
executionService.scheduleWithRepetition(CP_SUBSYSTEM_MANAGEMENT_EXECUTOR, new CheckLocalRaftNodesTask(), CHECK_LOCAL_RAFT_NODES_TASK_PERIOD, CHECK_LOCAL_RAFT_NODES_TASK_PERIOD, SECONDS);
int leadershipRebalancePeriod = nodeEngine.getProperties().getInteger(LEADERSHIP_BALANCE_TASK_PERIOD);
executionService.scheduleWithRepetition(CP_SUBSYSTEM_MANAGEMENT_EXECUTOR, new RaftGroupLeadershipBalanceTask(), leadershipRebalancePeriod, leadershipRebalancePeriod, SECONDS);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class RaftService method init.
@Override
public void init(NodeEngine nodeEngine, Properties properties) {
if (!metadataGroupManager.init()) {
return;
}
if (config.getMissingCPMemberAutoRemovalSeconds() > 0) {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.scheduleWithRepetition(CP_SUBSYSTEM_MANAGEMENT_EXECUTOR, new AutoRemoveMissingCPMemberTask(), REMOVE_MISSING_MEMBER_TASK_PERIOD_SECONDS, REMOVE_MISSING_MEMBER_TASK_PERIOD_SECONDS, SECONDS);
}
MetricsRegistry metricsRegistry = this.nodeEngine.getMetricsRegistry();
metricsRegistry.scheduleAtFixedRate(new PublishNodeMetricsTask(), metricsPeriod, SECONDS, ProbeLevel.INFO);
}
Aggregations