@Override
  public void init() {
    final StatusTransitioner.Transition st = statusTransitioner.init();
    try {
      serviceLocator.startAllServices();

      Deque<String> initiatedCaches = new ArrayDeque<>();
      try {
        for (Map.Entry<String, CacheConfiguration<?, ?>> cacheConfigurationEntry : configuration.getCacheConfigurations()
            .entrySet()) {
          final String alias = cacheConfigurationEntry.getKey();
          createCache(alias, cacheConfigurationEntry.getValue(), false);
          initiatedCaches.push(alias);
        }
      } catch (RuntimeException e) {
        while (!initiatedCaches.isEmpty()) {
          String toBeClosed = initiatedCaches.pop();
          try {
            removeCache(toBeClosed, false);
          } catch (Exception exceptionClosingCache) {
            LOGGER.error("Cache '{}' could not be removed after initialization failure due to ", toBeClosed, exceptionClosingCache);
          }
        }
        try {
          serviceLocator.stopAllServices();
        } catch (Exception exceptionStoppingServices) {
          LOGGER.error("Stopping services after initialization failure failed due to ", exceptionStoppingServices);
        }
        throw e;
      }
      st.succeeded();
    } catch (Exception e) {
      throw st.failed(e);
    } finally {
      st.failed(null);
    }
  }
@ Override public void init ( ) { final StatusTransitioner . Transition st = statusTransitioner . init ( ) ; try { serviceLocator . startAllServices ( ) ; Deque < String > initiatedCaches = new ArrayDeque < > ( ) ; try { for ( Map . Entry < String , CacheConfiguration < ? , ? > > cacheConfigurationEntry : configuration . getCacheConfigurations ( ) . entrySet ( ) ) { final String alias = cacheConfigurationEntry . getKey ( ) ; createCache ( alias , cacheConfigurationEntry . getValue ( ) , false ) ; initiatedCaches . push ( alias ) ; } } catch ( RuntimeException e ) { while ( ! initiatedCaches . isEmpty ( ) ) { String toBeClosed = initiatedCaches . pop ( ) ; try { removeCache ( toBeClosed , false ) ; } catch ( Exception exceptionClosingCache ) { LOGGER . error ( "Cache '{}' could not be removed after initialization failure due to " , toBeClosed , exceptionClosingCache ) ; } } try { serviceLocator . stopAllServices ( ) ; } catch ( Exception exceptionStoppingServices ) { LOGGER . error ( "Stopping services after initialization failure failed due to " , exceptionStoppingServices ) ; } throw e ; } st . succeeded ( ) ; } catch ( Exception e ) { throw st . failed ( e ) ; } finally { st . failed ( null ) ; } }
{@inheritDoc}