Commit 64d9865a authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Improved recovery logic when failed to join cluster.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8222 b35dd754-fafc-0310-a699-88a17e54d16e
parent bd8c12d4
......@@ -358,11 +358,12 @@ public class CacheFactory {
private static void startClustering() {
clusteringEnabled = false;
boolean clusterStarted = false;
try {
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise"))
.newInstance();
boolean clusterStarted = cacheFactoryStrategy.startCluster();
clusterStarted = cacheFactoryStrategy.startCluster();
if (clusterStarted) {
// Loop through local caches and switch them to clustered cache.
for (String cacheName : caches.keySet()) {
......@@ -373,14 +374,18 @@ public class CacheFactory {
clusteringEnabled = true;
fireClusteringStarted();
}
else {
// Revert to local cache factory if cluster fails to start
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(localCacheFactoryClass).newInstance();
}
}
catch (Exception e) {
Log.error("Unable to start clustering - continuing in local mode", e);
}
if (!clusterStarted) {
// Revert to local cache factory if cluster fails to start
try {
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(localCacheFactoryClass).newInstance();
} catch (Exception e) {
Log.error("Fatal error - Failed to join the cluster and failed to use local cache", e);
}
}
}
private static void stopClustering() {
......
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