CacheJmxRegistration jmx = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheJmxRegistration.class);
cache.stop();
// After stopping the cache, clear it
if (store != null)
store.clear();
// And see if we need to remove it from JMX
if (jmx != null) {
jmx.unregisterCacheMBean();
}