1
1
/*
2
- * Copyright 2002-2011 the original author or authors.
2
+ * Copyright 2002-2012 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.
@@ -332,6 +332,21 @@ public void afterPropertiesSet() throws CacheException, IOException {
332
332
this .cacheManager .addCache (rawCache );
333
333
}
334
334
335
+ if (this .cacheEventListeners != null ) {
336
+ for (CacheEventListener listener : this .cacheEventListeners ) {
337
+ rawCache .getCacheEventNotificationService ().registerListener (listener );
338
+ }
339
+ }
340
+ if (this .statisticsEnabled ) {
341
+ rawCache .setStatisticsEnabled (true );
342
+ }
343
+ if (this .sampledStatisticsEnabled ) {
344
+ rawCache .setSampledStatisticsEnabled (true );
345
+ }
346
+ if (this .disabled ) {
347
+ rawCache .setDisabled (true );
348
+ }
349
+
335
350
// Decorate cache if necessary.
336
351
Ehcache decoratedCache = decorateCache (rawCache );
337
352
if (decoratedCache != rawCache ) {
@@ -345,7 +360,7 @@ public void afterPropertiesSet() throws CacheException, IOException {
345
360
*/
346
361
protected Cache createCache () {
347
362
// Only call EHCache 1.6 constructor if actually necessary (for compatibility with EHCache 1.3+)
348
- Cache cache = (!this .clearOnFlush ) ?
363
+ return (!this .clearOnFlush ) ?
349
364
new Cache (this .cacheName , this .maxElementsInMemory , this .memoryStoreEvictionPolicy ,
350
365
this .overflowToDisk , null , this .eternal , this .timeToLive , this .timeToIdle ,
351
366
this .diskPersistent , this .diskExpiryThreadIntervalSeconds , null ,
@@ -355,22 +370,6 @@ protected Cache createCache() {
355
370
this .overflowToDisk , null , this .eternal , this .timeToLive , this .timeToIdle ,
356
371
this .diskPersistent , this .diskExpiryThreadIntervalSeconds , null ,
357
372
this .bootstrapCacheLoader , this .maxElementsOnDisk , this .diskSpoolBufferSize );
358
-
359
- if (this .cacheEventListeners != null ) {
360
- for (CacheEventListener listener : this .cacheEventListeners ) {
361
- cache .getCacheEventNotificationService ().registerListener (listener );
362
- }
363
- }
364
- if (this .statisticsEnabled ) {
365
- cache .setStatisticsEnabled (true );
366
- }
367
- if (this .sampledStatisticsEnabled ) {
368
- cache .setSampledStatisticsEnabled (true );
369
- }
370
- if (this .disabled ) {
371
- cache .setDisabled (true );
372
- }
373
- return cache ;
374
373
}
375
374
376
375
/**
0 commit comments