• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Not a Bug
  • drb
  • Reporter: nelrahma
  • March 17, 2010
  • 0
  • Watchers: 2
  • July 27, 2012
  • March 26, 2010


Say an ehcache.xml is not in the classpath and you wanted to create CacheManager and clustered caches programmatically Like the following:

CacheManager cacheManager = CacheManager.create(); CacheConfiguration cacheConfiguration = new CacheConfiguration(regionName,maxObjects); cacheConfiguration.setOverflowToDisk(false); cacheConfiguration.setEternal(isEternal); cacheConfiguration.setTimeToLiveSeconds(timeToLiveSeconds); cacheConfiguration.setTimeToIdleSeconds(timeToIdleSeconds); cacheConfiguration.setDiskPersistent(false); cacheConfiguration.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds); cacheConfiguration.terracotta(new TerracottaConfiguration().clustered(true).valueMode(ValueMode.IDENTITY)); cache = new Cache(cacheConfiguration); cacheManager.addCache(cache);

The cache manager is not properly initialized to the terracotta aware, since when CacheManager.create() is called there are no caches that are clustered. This is different from the cache where caches are defined through ehcache.xml since on the call CacheManager.create() the clustered caches defined in ehcache.xml are already present.


Fiona OShea 2010-03-17

Is this related to DEV-3826?

Nabib El-Rahman 2010-03-17

Might be, looks like in both cases, the CacheManager is not aware of having to be clustered.

Geert Bevin 2010-03-26

Nabib, when you say it’s not properly initialized, what in particular is your problem? DEV-3826 is known about, however your cache and cache manager functionalities itself should be totally working as soon as a TC clustered cache is added to the cache manager. The TC initialization parts are done lazily in these cases.

Nabib El-Rahman 2010-03-26

Sorry, is was a classpath issue in performance framework. Code works correctly.