Skip to content

EhCacheFactoryBean fails when statistics are enabled [SPR-11080] #15706

@spring-projects-issues

Description

@spring-projects-issues

Vincent PERICART opened SPR-11080 and commented

A blocking cache defined like this:

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml" />
<property name="shared" value="false" />
</bean>
<bean id="abstractBlockingCacheFactory" class="org.springframework.cache.ehcache.EhCacheFactoryBean" abstract="true">
<property name="cacheManager" ref="ehcache" />
<property name="blocking" value="true" />
<property name="statisticsEnabled" value="true" />
<property name="timeToLive" value="1800" />
</bean>
<bean id="jspCacheFactory" parent="abstractBlockingCacheFactory" />

Used to work in 3.2.4.RELEASE but fails in 3.2.5.RELEASE with the message :
The jspCacheFactory Cache is not alive (STATUS_UNINITIALISED)

ehcache version is 2.6.6
The error is thrown in ehCacheFactoryBean:342 because setStatisticsEnabled requires the cache to be alive.
The solution would be to enable statistics after initialization (after doing this.cacheManager.addCache(rawCache); )


Affects: 3.2.5

Issue Links:

Referenced from: commits 6c1f62b, 6ce2eb9

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions