use of com.hazelcast.internal.services.ManagedService in project hazelcast by hazelcast.
the class AbstractMapServiceFactory method createMapService.
/**
* Returns a {@link MapService} object by populating it with required
* auxiliary services.
*
* @return {@link MapService} object
*/
@Override
public MapService createMapService() {
NodeEngine nodeEngine = getNodeEngine();
MapServiceContext mapServiceContext = getMapServiceContext();
ManagedService managedService = createManagedService();
CountingMigrationAwareService migrationAwareService = createMigrationAwareService();
TransactionalService transactionalService = createTransactionalService();
RemoteService remoteService = createRemoteService();
EventPublishingService eventPublishingService = createEventPublishingService();
PostJoinAwareService postJoinAwareService = createPostJoinAwareService();
SplitBrainHandlerService splitBrainHandlerService = createSplitBrainHandlerService();
WanSupportingService wanSupportingService = createReplicationSupportingService();
StatisticsAwareService statisticsAwareService = createStatisticsAwareService();
PartitionAwareService partitionAwareService = createPartitionAwareService();
MapSplitBrainProtectionAwareService splitBrainProtectionAwareService = createSplitBrainProtectionAwareService();
ClientAwareService clientAwareService = createClientAwareService();
checkNotNull(nodeEngine, "nodeEngine should not be null");
checkNotNull(mapServiceContext, "mapServiceContext should not be null");
checkNotNull(managedService, "managedService should not be null");
checkNotNull(migrationAwareService, "migrationAwareService should not be null");
checkNotNull(transactionalService, "transactionalService should not be null");
checkNotNull(remoteService, "remoteService should not be null");
checkNotNull(eventPublishingService, "eventPublishingService should not be null");
checkNotNull(postJoinAwareService, "postJoinAwareService should not be null");
checkNotNull(splitBrainHandlerService, "splitBrainHandlerService should not be null");
checkNotNull(wanSupportingService, "replicationSupportingService should not be null");
checkNotNull(statisticsAwareService, "statisticsAwareService should not be null");
checkNotNull(partitionAwareService, "partitionAwareService should not be null");
checkNotNull(splitBrainProtectionAwareService, "splitBrainProtectionAwareService should not be null");
checkNotNull(clientAwareService, "clientAwareService should not be null");
MapService mapService = new MapService();
mapService.managedService = managedService;
mapService.migrationAwareService = migrationAwareService;
mapService.transactionalService = transactionalService;
mapService.remoteService = remoteService;
mapService.eventPublishingService = eventPublishingService;
mapService.postJoinAwareService = postJoinAwareService;
mapService.splitBrainHandlerService = splitBrainHandlerService;
mapService.wanSupportingService = wanSupportingService;
mapService.statisticsAwareService = statisticsAwareService;
mapService.mapServiceContext = mapServiceContext;
mapService.partitionAwareService = partitionAwareService;
mapService.splitBrainProtectionAwareService = splitBrainProtectionAwareService;
mapService.clientAwareService = clientAwareService;
mapServiceContext.setService(mapService);
return mapService;
}
use of com.hazelcast.internal.services.ManagedService in project hazelcast by hazelcast.
the class ServiceManagerImpl method shutdown.
public synchronized void shutdown(boolean terminate) {
logger.finest("Stopping services...");
final List<ManagedService> managedServices = getServices(ManagedService.class);
// reverse order to stop CoreServices last
Collections.reverse(managedServices);
services.clear();
for (ManagedService service : managedServices) {
shutdownService(service, terminate);
}
}
use of com.hazelcast.internal.services.ManagedService in project hazelcast by hazelcast.
the class ServiceManagerImpl method initService.
private void initService(Map<String, Properties> serviceProps, Map<String, Object> serviceConfigObjects, ServiceInfo serviceInfo) {
final Object service = serviceInfo.getService();
if (serviceInfo.isConfigurableService()) {
try {
if (logger.isFinestEnabled()) {
logger.finest("Configuring service -> " + service);
}
final Object configObject = serviceConfigObjects.get(serviceInfo.getName());
((ConfigurableService) service).configure(configObject);
} catch (Throwable t) {
logger.severe("Error while configuring service: " + t.getMessage(), t);
}
}
if (serviceInfo.isManagedService()) {
try {
if (logger.isFinestEnabled()) {
logger.finest("Initializing service -> " + service);
}
final Properties props = serviceProps.get(serviceInfo.getName());
((ManagedService) service).init(nodeEngine, props != null ? props : new Properties());
} catch (Throwable t) {
logger.severe("Error while initializing service: " + t.getMessage(), t);
}
}
}
Aggregations