|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2014 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -81,7 +81,7 @@ public void setConfigLocation(Resource configLocation) {
|
81 | 81 |
|
82 | 82 | /**
|
83 | 83 | * Set the name of the EhCache CacheManager (if a specific name is desired).
|
84 |
| - * @see net.sf.ehcache.CacheManager#setName(String) |
| 84 | + * @see net.sf.ehcache.config.Configuration#setName(String) |
85 | 85 | */
|
86 | 86 | public void setCacheManagerName(String cacheManagerName) {
|
87 | 87 | this.cacheManagerName = cacheManagerName;
|
@@ -126,12 +126,17 @@ public void setShared(boolean shared) {
|
126 | 126 |
|
127 | 127 | @Override
|
128 | 128 | public void afterPropertiesSet() throws CacheException {
|
129 |
| - logger.info("Initializing EhCache CacheManager"); |
| 129 | + if (logger.isInfoEnabled()) { |
| 130 | + logger.info("Initializing EhCache CacheManager" + |
| 131 | + (this.cacheManagerName != null ? " '" + this.cacheManagerName + "'" : "")); |
| 132 | + } |
| 133 | + |
130 | 134 | Configuration configuration = (this.configLocation != null ?
|
131 | 135 | EhCacheManagerUtils.parseConfiguration(this.configLocation) : ConfigurationFactory.parseConfiguration());
|
132 | 136 | if (this.cacheManagerName != null) {
|
133 | 137 | configuration.setName(this.cacheManagerName);
|
134 | 138 | }
|
| 139 | + |
135 | 140 | if (this.shared) {
|
136 | 141 | // Old-school EhCache singleton sharing...
|
137 | 142 | // No way to find out whether we actually created a new CacheManager
|
@@ -178,7 +183,10 @@ public boolean isSingleton() {
|
178 | 183 | @Override
|
179 | 184 | public void destroy() {
|
180 | 185 | if (this.locallyManaged) {
|
181 |
| - logger.info("Shutting down EhCache CacheManager"); |
| 186 | + if (logger.isInfoEnabled()) { |
| 187 | + logger.info("Shutting down EhCache CacheManager" + |
| 188 | + (this.cacheManagerName != null ? " '" + this.cacheManagerName + "'" : "")); |
| 189 | + } |
182 | 190 | this.cacheManager.shutdown();
|
183 | 191 | }
|
184 | 192 | }
|
|
0 commit comments