Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EhCacheFactoryBean should support CacheEventListener [SPR-5641] #10312

Closed
spring-projects-issues opened this issue Mar 31, 2009 · 2 comments
Closed
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 31, 2009

Dominique Jean-Prost opened SPR-5641 and commented

Actually, EhCacheFactoryBean doesn't allow instanciate EhCache caches with CacheEventListeners. This forbids for instance to instanciate caches that supports distribution over a cluster, because the way ehcache runs needs the cache to be fully setup before adding it to the CacheManager (see net.sf.ehcache.distribution.RMICacheManagerPeerListener.notifyCacheAdded(String)).

I wrote an extended version of EhCacheFactoryBean so that I can provide cacheEventListeners to the factory in order to have distribution works.
Now I think you can backport my class to spring-core so that evereybody can use it. As I can't find the url of spring scm, I can't provide patch, although I wish I could.

Here is what you have to setup in your bean definition :
<bean id="eventListenersFactory" class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
scope="singleton" />

<bean class="com.dexia.sofaxis.common.cache.ExtendedEhCacheFactoryBean">
<property name="diskPersistent">
<value>false</value>
</property>
<property name="cacheName">
<value>itemsReferenceData</value>
</property>
<property name="cacheManager">
<ref bean="globalCacheManager" />
</property>
<property name="eternal">
<value>true</value>
</property>
<property name="maxElementsInMemory">
<value>10000</value>
</property>
<property name="overflowToDisk">
<value>true</value>
</property>
<property name="cacheEventListeners">
<list>
<bean factory-bean="eventListenersFactory" factory-method="createCacheEventListener">
<constructor-arg>
<null />
</constructor-arg>
</bean>
</list>
</property>
</bean>


Affects: 2.5.1

Attachments:

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Dominique Jean-Prost commented

The source file that is used in my example

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 7, 2011

Costin Leau commented

See #10902

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant