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 { ...@@ -457,7 +457,7 @@ public class CacheFactory {
try { try {
CacheFactoryStrategy cacheFactory = (CacheFactoryStrategy) Class.forName( CacheFactoryStrategy cacheFactory = (CacheFactoryStrategy) Class.forName(
clusteredCacheFactoryClass, true, clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise")).newInstance(); getClusteredCacheStrategyClassLoader()).newInstance();
return cacheFactory.getMaxClusterNodes(); return cacheFactory.getMaxClusterNodes();
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// Do nothing // Do nothing
...@@ -532,15 +532,18 @@ public class CacheFactory { ...@@ -532,15 +532,18 @@ public class CacheFactory {
} }
} }
private static ClassLoader getClusteredCacheStrategyClassLoader(String pluginName) { private static ClassLoader getClusteredCacheStrategyClassLoader() {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager(); PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
Plugin enterprisePlugin = pluginManager.getPlugin(pluginName); Plugin plugin = pluginManager.getPlugin("clustering");
PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(enterprisePlugin); if (plugin == null) {
plugin = pluginManager.getPlugin("enterprise");
}
PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(plugin);
if (pluginLoader != null) { if (pluginLoader != null) {
return pluginLoader; return pluginLoader;
} }
else { 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(); return Thread.currentThread().getContextClassLoader();
} }
} }
...@@ -550,7 +553,7 @@ public class CacheFactory { ...@@ -550,7 +553,7 @@ public class CacheFactory {
clusteringStarting = true; clusteringStarting = true;
try { try {
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass, true, cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise")) getClusteredCacheStrategyClassLoader())
.newInstance(); .newInstance();
clusteringStarted = cacheFactoryStrategy.startCluster(); 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