BigMemory 4.3.10 | FAQ | Operations Questions
 
Operations Questions
How do you get an element without affecting statistics?
Use the Cache.getQuiet() method. It returns an element without updating statistics. For details, see the getQuiet() method in the Ehcache Javadoc at http://ehcache.org/apidocs/2.10.1/net/sf/ehcache/Cache.html#getQuiet%28java.io.Serializable%29.
Is there a simple way to disable BigMemory Go when testing?
Set the system property net.sf.ehcache.disabled=true to disable BigMemory Go. This can easily be done using -Dnet.sf.ehcache.disabled=true on the command line. If BigMemory Go is disabled, no elements will be added to the stores.
How do I dynamically change cache attributes at runtime?
This is not possible. However, you can achieve the same result as follows:
1. Create a new cache:
Cache cache = new Cache("test2", 1, true, true, 0, 0, true, 120, ...);
cacheManager.addCache(cache);
For all the parameters, see the Ehcache Javadoc at http://ehcache.org/apidocs/2.10.1/.
2. Get a list of keys using cache.getKeys, then get each element and put it in the new cache.
None of this will use much memory because the new cache elements have values that reference the same data as the original cache.
3. Use cacheManager.removeCache("oldcachename") to remove the original cache.
Do you need to explicitly shut down the CacheManager when you finish with BigMemory Go?
There is a shutdown hook that calls the shutdown on JVM exit. If the JVM keeps running after you stop using BigMemory Go, you should call CacheManager.getInstance().shutdown() so that the threads are stopped and cache memory is released back to the JVM.
For details, see Shutting Down Ehcache in the BigMemory Go Operations Guide.
Can you use BigMemory Go after a CacheManager.shutdown()?
When you call CacheManager.shutdown() it sets the singleton in CacheManager to null. Using a cache after this generates a CacheException.
However, if you call CacheManager.create() to instantiate a new CacheManager, then you can still use BigMemory Go. Internally the CacheManager singleton gets set to the new one, allowing you to create and shut down any number of times.
Why are statistics counters showing 0 for active caches?
Statistics gathering is disabled by default in order to optimize performance. You can enable statistics gathering in caches in one of the following ways:
*In cache configuration by adding statistics="true" to the <cache> element.
*Programmatically when setting a cache's configuration.
*In the Terracotta Management Console. For details, see the Terracotta Management Console User Guide.
To function, certain features in the Terracotta Management Console require statistics to be enabled.
How do I detect deadlocks in BigMemory Go?
BigMemory Go does not experience deadlocks. However, deadlocks in your application code can be detected with certain tools, such as the JDK tool JConsole.