Commit b590a0f2 authored by Greg Thomas's avatar Greg Thomas Committed by Guus der Kinderen

Use an event rather than an arbitrary delay before starting clustering

parent f26df50e
...@@ -44,6 +44,16 @@ ...@@ -44,6 +44,16 @@
Hazelcast Clustering Plugin Changelog Hazelcast Clustering Plugin Changelog
</h1> </h1>
<p><b>2.2.3</b> -- September 5, 2017</p>
<ul>
<li>Use an event rather than an arbitrary delay before starting clustering</li>
</ul>
<p><b>2.2.2</b> -- August 3, 2017</p>
<ul>
<li>Ensure that Hazelcast backed Cache objects have the correct settings</li>
</ul>
<p><b>2.2.1</b> -- November 4, 2016</p> <p><b>2.2.1</b> -- November 4, 2016</p>
<ul> <ul>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-1210'>OF-1210</a>] - correct time-to-live-seconds and MaxLifetime settings for hazelcast</li> <li>[<a href='http://www.igniterealtime.org/issues/browse/OF-1210'>OF-1210</a>] - correct time-to-live-seconds and MaxLifetime settings for hazelcast</li>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<name>Hazelcast plugin</name> <name>Hazelcast plugin</name>
<description>Adds clustering support</description> <description>Adds clustering support</description>
<author>Tom Evans</author> <author>Tom Evans</author>
<version>2.2.2</version> <version>2.2.3</version>
<date>08/03/2017</date> <date>09/05/2017</date>
<minServerVersion>4.0.0</minServerVersion> <minServerVersion>4.0.0</minServerVersion>
</plugin> </plugin>
...@@ -18,14 +18,13 @@ package org.jivesoftware.openfire.plugin; ...@@ -18,14 +18,13 @@ package org.jivesoftware.openfire.plugin;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.util.TimerTask;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.cluster.ClusterManager; import org.jivesoftware.openfire.cluster.ClusterManager;
import org.jivesoftware.openfire.container.Plugin; import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager; import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.container.PluginManagerListener;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.TaskEngine;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -37,21 +36,23 @@ import org.slf4j.LoggerFactory; ...@@ -37,21 +36,23 @@ import org.slf4j.LoggerFactory;
* @author Tom Evans * @author Tom Evans
* @author Matt Tucker * @author Matt Tucker
*/ */
public class HazelcastPlugin extends TimerTask implements Plugin { public class HazelcastPlugin implements Plugin {
private static Logger logger = LoggerFactory.getLogger(HazelcastPlugin.class); private static Logger logger = LoggerFactory.getLogger(HazelcastPlugin.class);
private static final long CLUSTER_STARTUP_DELAY_TIME = public void initializePlugin(final PluginManager manager, final File pluginDirectory) {
JiveGlobals.getLongProperty("hazelcast.startup.delay.seconds", 5); logger.info("Waiting for other plugins to initialize before initializing clustering");
manager.addPluginManagerListener(new PluginManagerListener() {
public void initializePlugin(PluginManager manager, File pluginDirectory) { @Override
// start cluster using a separate thread after a short delay public void pluginsMonitored() {
// this will allow other plugins to initialize during startup manager.removePluginManagerListener(this);
TaskEngine.getInstance().schedule(this, CLUSTER_STARTUP_DELAY_TIME*1000); initializeClustering();
}
});
} }
@Override private void initializeClustering() {
public void run() { logger.info("All plugins have initialized; initializing clustering");
// Check if another cluster is installed and stop loading this plugin if found // Check if another cluster is installed and stop loading this plugin if found
File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins"); File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
File[] jars = pluginDir.listFiles(new FileFilter() { File[] jars = pluginDir.listFiles(new FileFilter() {
......
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