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 @@
Hazelcast Clustering Plugin Changelog
</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>
<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>
......
......@@ -5,7 +5,7 @@
<name>Hazelcast plugin</name>
<description>Adds clustering support</description>
<author>Tom Evans</author>
<version>2.2.2</version>
<date>08/03/2017</date>
<version>2.2.3</version>
<date>09/05/2017</date>
<minServerVersion>4.0.0</minServerVersion>
</plugin>
......@@ -18,14 +18,13 @@ package org.jivesoftware.openfire.plugin;
import java.io.File;
import java.io.FileFilter;
import java.util.TimerTask;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.cluster.ClusterManager;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.container.PluginManagerListener;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.TaskEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -37,21 +36,23 @@ import org.slf4j.LoggerFactory;
* @author Tom Evans
* @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 final long CLUSTER_STARTUP_DELAY_TIME =
JiveGlobals.getLongProperty("hazelcast.startup.delay.seconds", 5);
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// start cluster using a separate thread after a short delay
// this will allow other plugins to initialize during startup
TaskEngine.getInstance().schedule(this, CLUSTER_STARTUP_DELAY_TIME*1000);
public void initializePlugin(final PluginManager manager, final File pluginDirectory) {
logger.info("Waiting for other plugins to initialize before initializing clustering");
manager.addPluginManagerListener(new PluginManagerListener() {
@Override
public void pluginsMonitored() {
manager.removePluginManagerListener(this);
initializeClustering();
}
});
}
@Override
public void run() {
private void initializeClustering() {
logger.info("All plugins have initialized; initializing clustering");
// Check if another cluster is installed and stop loading this plugin if found
File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
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