Search in sources :

Example 1 with ConfigurableService

use of com.hazelcast.internal.services.ConfigurableService 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);
        }
    }
}
Also used : ManagedService(com.hazelcast.internal.services.ManagedService) Properties(java.util.Properties) ConfigurableService(com.hazelcast.internal.services.ConfigurableService)

Aggregations

ConfigurableService (com.hazelcast.internal.services.ConfigurableService)1 ManagedService (com.hazelcast.internal.services.ManagedService)1 Properties (java.util.Properties)1