Exemplo n.º 1
0
 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);
     }
   }
 }
Exemplo n.º 2
0
 private void shutdownService(final ManagedService service, final boolean terminate) {
   try {
     if (logger.isFinestEnabled()) {
       logger.finest("Shutting down service -> " + service);
     }
     service.shutdown(terminate);
   } catch (Throwable t) {
     logger.severe("Error while shutting down service[" + service + "]: " + t.getMessage(), t);
   }
 }