| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 01/29/2008 16:22:22
|
dpope
master
Joined: 12/11/2007 10:16:33
Messages: 74
Location: Wesley Chapel, NC
Offline
|
The following configuration works:
Code:
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="/WEB-INF/classes/ehcache.xml" />
<property name="shared" value="true"/>
</bean>
Everything works great until one of the instances shuts down. Once that happens, the EhCacheManagerFactoryBean's destroy method calls shutdown:
Code:
public void destroy() {
logger.info("Shutting down EHCache CacheManager");
this.cacheManager.shutdown();
}
I'm creating our own version of EhCacheManagerFactoryBean by using the existing EhCacheManagerFactoryBean source from Spring 2.0.4 but removing the contents of the destroy method so shutdown is never called.
Is this the proper/advisable solution? If this is ok, is there ever a case that the shutdown method should be called? I tried to figure out a way to call shutdown if I knew that I was the last instance using the CacheManager, but even then, I'm not sure that I want to do that.
Thanks,
Darin
Spring 2.0.4
EHCache 1.2.4
Terracotta 2.5.0, as of 20071210-171202 (Revision 6472 by cruise@WXPMO0 from 2.5)
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 01/30/2008 09:23:23
|
njain
jedi
Joined: 01/03/2007 06:41:59
Messages: 107
Offline
|
With terracotta enabled distributed cache there is no real need of calling shutdown on CacheManager. It just cleans up entries from EhCache along with some other stuff, which with last node does not make a difference. In fact most of the hibernate + Ehcache application does not call shutdown at all.
You might still want to call it in situation where you run terracotta server in persistent mode and want entries to be cleaned up from Cache so that when your application comes up next time, it loads the Cache from DB again. We do not recommend that unless you expect stale entries inside cache after restart.
|
Regards,
Nitin Jain
Terracotta, Inc.
Join the Terracotta Community
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 01/31/2008 15:00:29
|
foshea
journeyman
Joined: 10/15/2007 17:08:10
Messages: 15
Offline
|
FYI: I've created https://jira.terracotta.org/jira/browse/CDV-605 to track this issue
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/21/2008 02:08:38
|
koholma
journeyman
Joined: 03/05/2008 05:54:15
Messages: 17
Offline
|
I run a terracotta enabled distributed cache and want to make sure that there is no stale data in the cache when all instances in the cluster are restarted. Is there a recommended way of doing this?
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/21/2008 02:22:36
|
njain
jedi
Joined: 01/03/2007 06:41:59
Messages: 107
Offline
|
You need to worry about stale data only if you are running terracotta server in persistence mode. There are few possibilities
1) Delete the contents of data directory on terracotta server whenever you restart the cluster
2) Once first client connects to terracotta server, clean up the content of EHCache. This link http://www.terracotta.org/confluence/display/docs1/JMX+Guide has more details.
|
Regards,
Nitin Jain
Terracotta, Inc.
Join the Terracotta Community
|
|
|
 |
|
|