Source:
public <K, V> Cache<K, V> createCache(final String alias, CacheConfiguration<K, V> config) throws IllegalArgumentException { statusTransitioner.checkAvailable(); Class<K> keyType = config.getKeyType(); Class<V> valueType = config.getValueType(); LOGGER.info("Cache is getting created in EhcacheManager ."); ClassLoader cacheClassLoader = config.getClassLoader(); if (cacheClassLoader == null) { cacheClassLoader = cacheManagerClassLoader; config = new BaseCacheConfiguration<K, V>(keyType, valueType, config.getCapacityConstraint(), config.getEvictionVeto(), config.getEvictionPrioritizer(), cacheClassLoader, config.getExpiry(), config.getSerializationProvider(), config.getServiceConfigurations().toArray( new ServiceConfiguration<?>[config.getServiceConfigurations().size()])); } final CacheHolder value = new CacheHolder(keyType, valueType, null); if (caches.putIfAbsent(alias, value) != null) { throw new IllegalArgumentException("Cache '" + alias +"' already exists"); } Ehcache<K, V> cache = null; RuntimeException failure = null; try { cache = createNewEhcache(alias, config, keyType, valueType); cache.init(); } catch (RuntimeException e) { failure = e; } if(failure == null) { try { if(!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheAdded(alias, cache); } } } finally { value.setCache(cache); } } else { caches.remove(alias); value.setCache(null); LOGGER.error("Cache '" + alias + "' creation in EhcacheManager failed."); throw failure; } LOGGER.info("Cache '" + alias + "' created in EhcacheManager."); return cache; }

Target:
public <K, V> Cache<K, V> createCache(final String alias, CacheConfiguration<K, V> config) throws IllegalArgumentException { statusTransitioner.checkAvailable(); Class<K> keyType = config.getKeyType(); Class<V> valueType = config.getValueType(); LOGGER.info("Cache '{}' is getting created in EhcacheManager.", alias); ClassLoader cacheClassLoader = config.getClassLoader(); if (cacheClassLoader == null) { cacheClassLoader = cacheManagerClassLoader; config = new BaseCacheConfiguration<K, V>(keyType, valueType, config.getCapacityConstraint(), config.getEvictionVeto(), config.getEvictionPrioritizer(), cacheClassLoader, config.getExpiry(), config.getSerializationProvider(), config.getServiceConfigurations().toArray( new ServiceConfiguration<?>[config.getServiceConfigurations().size()])); } final CacheHolder value = new CacheHolder(keyType, valueType, null); if (caches.putIfAbsent(alias, value) != null) { throw new IllegalArgumentException("Cache '" + alias +"' already exists"); } Ehcache<K, V> cache = null; RuntimeException failure = null; try { cache = createNewEhcache(alias, config, keyType, valueType); cache.init(); } catch (RuntimeException e) { failure = e; } if(failure == null) { try { if(!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheAdded(alias, cache); } } } finally { value.setCache(cache); } } else { caches.remove(alias); value.setCache(null); throw new IllegalStateException("Cache '"+alias+"' creation in EhcacheManager failed.", failure); } LOGGER.info("Cache '{}' created in EhcacheManager.", alias); return cache; }