Commit 1377c51c authored by Tom Evans's avatar Tom Evans

Merge pull request #387 from tevans/OF-974

OF-974: Migrate cache content
parents e5e67a1b 18af4f0b
......@@ -732,12 +732,13 @@ public class CacheFactory {
@SuppressWarnings("unchecked")
public static synchronized void joinedCluster() {
cacheFactoryStrategy = clusteredCacheFactoryStrategy;
// Loop through local caches and switch them to clustered cache (purge content)
// Loop through local caches and switch them to clustered cache (copy content)
for (Cache cache : getAllCaches()) {
// skip local-only caches
if (localOnly.contains(cache.getName())) continue;
CacheWrapper cacheWrapper = ((CacheWrapper) cache);
Cache clusteredCache = cacheFactoryStrategy.createCache(cacheWrapper.getName());
clusteredCache.putAll(cache);
cacheWrapper.setWrappedCache(clusteredCache);
}
clusteringStarting = false;
......@@ -753,12 +754,13 @@ public class CacheFactory {
clusteringStarted = false;
cacheFactoryStrategy = localCacheFactoryStrategy;
// Loop through clustered caches and change them to local caches (purge content)
// Loop through clustered caches and change them to local caches (copy content)
for (Cache cache : getAllCaches()) {
// skip local-only caches
if (localOnly.contains(cache.getName())) continue;
CacheWrapper cacheWrapper = ((CacheWrapper) cache);
Cache standaloneCache = cacheFactoryStrategy.createCache(cacheWrapper.getName());
standaloneCache.putAll(cache);
cacheWrapper.setWrappedCache(standaloneCache);
}
log.info("Clustering stopped; cache migration complete");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment