Commit 75ca8d1c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

More testing work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8645 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3b5df0f1
...@@ -47,10 +47,6 @@ public class ClusterManager { ...@@ -47,10 +47,6 @@ public class ClusterManager {
// Replace standalone caches with clustered caches. Local cached data is not moved. // Replace standalone caches with clustered caches. Local cached data is not moved.
CacheFactory.joinedCluster(); CacheFactory.joinedCluster();
} }
else if (eventType == EventType.left_cluster && event.getNodeID() == null) {
// Replace clustered caches with standalone caches. Cached data is not moved to new cache.
CacheFactory.leftCluster();
}
// Now notify rest of the listeners // Now notify rest of the listeners
for (ClusterEventListener listener : listeners) { for (ClusterEventListener listener : listeners) {
try { try {
......
...@@ -18,7 +18,10 @@ import org.jivesoftware.util.JiveGlobals; ...@@ -18,7 +18,10 @@ import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.JiveProperties; import org.jivesoftware.util.JiveProperties;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
...@@ -174,15 +177,6 @@ public class CacheFactory { ...@@ -174,15 +177,6 @@ public class CacheFactory {
* @param task the task to be invoked on all other cluster members. * @param task the task to be invoked on all other cluster members.
*/ */
public static void doClusterTask(final ClusterTask task) { public static void doClusterTask(final ClusterTask task) {
if (!clusteringStarted) {
return;
}
synchronized(CacheFactory.class) {
if (!clusteringStarted) {
return;
}
}
cacheFactoryStrategy.doClusterTask(task); cacheFactoryStrategy.doClusterTask(task);
} }
...@@ -195,15 +189,6 @@ public class CacheFactory { ...@@ -195,15 +189,6 @@ public class CacheFactory {
* @throws IllegalStateException if requested node was not found or not running in a cluster. * @throws IllegalStateException if requested node was not found or not running in a cluster.
*/ */
public static void doClusterTask(final ClusterTask task, byte[] nodeID) { public static void doClusterTask(final ClusterTask task, byte[] nodeID) {
if (!clusteringStarted) {
throw new IllegalStateException("Cluster service is not available");
}
synchronized(CacheFactory.class) {
if (!clusteringStarted) {
throw new IllegalStateException("Cluster service is not available");
}
}
cacheFactoryStrategy.doClusterTask(task, nodeID); cacheFactoryStrategy.doClusterTask(task, nodeID);
} }
...@@ -218,12 +203,6 @@ public class CacheFactory { ...@@ -218,12 +203,6 @@ public class CacheFactory {
* @return collection with the result of the execution. * @return collection with the result of the execution.
*/ */
public static Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) { public static Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) {
synchronized(CacheFactory.class) {
if (!clusteringStarted) {
return Collections.emptyList();
}
}
return cacheFactoryStrategy.doSynchronousClusterTask(task, includeLocalMember); return cacheFactoryStrategy.doSynchronousClusterTask(task, includeLocalMember);
} }
...@@ -237,12 +216,6 @@ public class CacheFactory { ...@@ -237,12 +216,6 @@ public class CacheFactory {
* @throws IllegalStateException if requested node was not found or not running in a cluster. * @throws IllegalStateException if requested node was not found or not running in a cluster.
*/ */
public static Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID) { public static Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID) {
synchronized(CacheFactory.class) {
if (!clusteringStarted) {
throw new IllegalStateException("Cluster service is not available");
}
}
return cacheFactoryStrategy.doSynchronousClusterTask(task, nodeID); return cacheFactoryStrategy.doSynchronousClusterTask(task, nodeID);
} }
...@@ -410,11 +383,11 @@ public class CacheFactory { ...@@ -410,11 +383,11 @@ public class CacheFactory {
public static void leftCluster() { public static void leftCluster() {
// Loop through clustered caches and change them to local caches (migrate content) // Loop through clustered caches and change them to local caches (migrate content)
try { try {
CacheFactoryStrategy localStrategy = (CacheFactoryStrategy) Class.forName(localCacheFactoryClass).newInstance(); cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(localCacheFactoryClass).newInstance();
for (Cache cache : getAllCaches()) { for (Cache cache : getAllCaches()) {
CacheWrapper cacheWrapper = ((CacheWrapper) cache); CacheWrapper cacheWrapper = ((CacheWrapper) cache);
Cache standaloneCache = localStrategy.createCache(cacheWrapper.getName()); Cache standaloneCache = cacheFactoryStrategy.createCache(cacheWrapper.getName());
cacheWrapper.setWrappedCache(standaloneCache); cacheWrapper.setWrappedCache(standaloneCache);
} }
} catch (Exception e) { } catch (Exception e) {
......
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