Commit 066c8623 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Consider clustering plugin as another source of clustering implementation....

Consider clustering plugin as another source of clustering implementation. This should not be the final implementation. Otherwise people implementing their own clustering solution will need to hack their plugin in the list. :(

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/openfire_3_5_1@10246 b35dd754-fafc-0310-a699-88a17e54d16e
parent 80ff1df7
......@@ -457,7 +457,7 @@ public class CacheFactory {
try {
CacheFactoryStrategy cacheFactory = (CacheFactoryStrategy) Class.forName(
clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise")).newInstance();
getClusteredCacheStrategyClassLoader()).newInstance();
return cacheFactory.getMaxClusterNodes();
} catch (ClassNotFoundException e) {
// Do nothing
......@@ -532,15 +532,18 @@ public class CacheFactory {
}
}
private static ClassLoader getClusteredCacheStrategyClassLoader(String pluginName) {
private static ClassLoader getClusteredCacheStrategyClassLoader() {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
Plugin enterprisePlugin = pluginManager.getPlugin(pluginName);
PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(enterprisePlugin);
Plugin plugin = pluginManager.getPlugin("clustering");
if (plugin == null) {
plugin = pluginManager.getPlugin("enterprise");
}
PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(plugin);
if (pluginLoader != null) {
return pluginLoader;
}
else {
Log.debug("Unable to find PluginClassloader for plugin: " + pluginName + " in CacheFactory.");
Log.debug("CacheFactory - Unable to find a Plugin that provides clustering support.");
return Thread.currentThread().getContextClassLoader();
}
}
......@@ -550,7 +553,7 @@ public class CacheFactory {
clusteringStarting = true;
try {
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise"))
getClusteredCacheStrategyClassLoader())
.newInstance();
clusteringStarted = cacheFactoryStrategy.startCluster();
}
......
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