Commit 9850a2b1 authored by Pete Matern's avatar Pete Matern Committed by pete

Added null checks for taskService in CoherenceClusteredCacheFactory for when...

Added null checks for taskService in CoherenceClusteredCacheFactory for when clustering has been stopped (or failed to start). Changed CacheFactory to use enterprise classloader. Pulled default wildcard cache definitions out of tangosol jar so only caches in our config file will successfully initialize.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8188 b35dd754-fafc-0310-a699-88a17e54d16e
parent ed35b02a
...@@ -13,6 +13,9 @@ import org.jivesoftware.util.InitializationException; ...@@ -13,6 +13,9 @@ import org.jivesoftware.util.InitializationException;
import org.jivesoftware.util.JiveProperties; import org.jivesoftware.util.JiveProperties;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.XMPPServerListener; import org.jivesoftware.openfire.XMPPServerListener;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.container.PluginClassLoader;
import org.jivesoftware.openfire.pubsub.Node; import org.jivesoftware.openfire.pubsub.Node;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Presence; import org.xmpp.packet.Presence;
...@@ -343,10 +346,24 @@ public class CacheFactory { ...@@ -343,10 +346,24 @@ public class CacheFactory {
t.start(); t.start();
} }
private static ClassLoader getClusteredCacheStrategyClassLoader(String pluginName) {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
Plugin enterprisePlugin = pluginManager.getPlugin(pluginName);
PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(enterprisePlugin);
if (pluginLoader != null) {
return pluginLoader.getClassLoader();
}
else {
Log.warn("Unable to find PluginClassloader for plugin: " + pluginName + " in CacheFactory.");
return Thread.currentThread().getContextClassLoader();
}
}
private static void startClustering() { private static void startClustering() {
clusteringEnabled = false; clusteringEnabled = false;
try { try {
cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass) cacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader("enterprise"))
.newInstance(); .newInstance();
boolean clusterStarted = cacheFactoryStrategy.startCluster(); boolean clusterStarted = cacheFactoryStrategy.startCluster();
if (clusterStarted) { if (clusterStarted) {
......
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