Commit 389894b2 authored by Tom Evans's avatar Tom Evans Committed by tevans

OF-666: Use cluster time for pubsub items; also update hazelcast/clustering dependencies

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13630 b35dd754-fafc-0310-a699-88a17e54d16e
parent 690bd1ea
......@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.dom4j.Element;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.cache.CacheFactory;
import org.xmpp.forms.DataForm;
import org.xmpp.forms.FormField;
import org.xmpp.packet.IQ;
......@@ -240,7 +241,7 @@ public class LeafNode extends Node {
}
// Create a new published item
newItem = new PublishedItem(this, publisher, itemID, new Date());
newItem = new PublishedItem(this, publisher, itemID, new Date(CacheFactory.getClusterTime()));
newItem.setPayload(payload);
// Add the new item to the list of published items
newPublishedItems.add(newItem);
......
......@@ -525,6 +525,23 @@ public class CacheFactory {
public static int getMaxClusterNodes() {
return cacheFactoryStrategy.getMaxClusterNodes();
}
/**
* Gets the pseudo-synchronized time from the cluster. While the cluster members may
* have varying system times, this method is expected to return a timestamp that is
* synchronized (or nearly so; best effort) across the cluster.
*
* @return Synchronized time for all cluster members
*/
public static long getClusterTime() {
// use try/catch here for backward compatibility with older plugin(s)
try { return cacheFactoryStrategy.getClusterTime(); }
catch (AbstractMethodError ame) {
log.warn("Cluster time not available; check for update to hazelcast/clustering plugin");
return localCacheFactoryStrategy.getClusterTime();
}
}
/**
* Invokes a task on other cluster members in an asynchronous fashion. The task will not be
* executed on the local cluster member. If clustering is not enabled, this method
......
......@@ -108,6 +108,15 @@ public interface CacheFactoryStrategy {
byte[] getClusterMemberID();
/**
* Gets the pseudo-synchronized time from the cluster. While the cluster members may
* have varying system times, this method is expected to return a timestamp that is
* synchronized (or nearly so; best effort) across the cluster.
*
* @return Synchronized time for all cluster members
*/
public long getClusterTime();
/**
* Invokes a task on other cluster members in an asynchronous fashion. The task will not be
* executed on the local cluster member. If clustering is not enabled, this method
* will do nothing.
......
......@@ -87,6 +87,10 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
return new byte[0];
}
public long getClusterTime() {
return System.currentTimeMillis();
}
public void doClusterTask(final ClusterTask task) {
}
......
......@@ -44,9 +44,13 @@
Clustering Plugin Changelog
</h1>
<p><b>1.2.3</b> -- January 8, 2013</p>
<p><b>1.2.4</b> -- May 1, 2013</p>
<p><b>NOTE</b>: This plugin has been deprecated and is not actively maintained. See the
<a href="readme.html">README</a> document for more information.</p>
<ul>
<li>Updated plugin sources to be compatible with Openfire 3.8.2 (<a href="http://issues.igniterealtime.org/browse/OF-666">cluster time</a>).</li>
</ul>
<p><b>1.2.3</b> -- January 8, 2013</p>
<ul>
<li>Updated plugin sources to be compatible with Openfire 3.7.2.</li>
</ul>
......
......@@ -5,8 +5,7 @@
<name>${plugin.name}</name>
<description>${plugin.description}</description>
<author>Jive Software</author>
<version>1.2.3</version>
<date>01/09/2013</date>
<minServerVersion>3.7.2</minServerVersion>
<version>1.2.4</version>
<date>05/01/2013</date>
<minServerVersion>3.8.2</minServerVersion>
</plugin>
......@@ -57,12 +57,12 @@ Clustering Plugin Readme
<div id="datatable">
<p class="name">&nbsp;<br />
<b>PLEASE NOTE</b> -- Clustering Plugin Users:<br /><br />
Starting with Openfire 3.7.2, this Coherence-based clustering plugin
Starting with Openfire 3.8.0, this Coherence-based clustering plugin
has been deprecated in favor of the new Hazelcast-based plugin (/plugins/hazelcast).
Refer to the Hazelcast plugin documentation or
<a href="http://community.igniterealtime.org/message/224947#224947">this community post</a>
for additional information.<br /><br />
This plugin has been updated and is expected to be compatible with Openfire 3.7.2. However,
This plugin has been updated and is expected to be compatible with Openfire 3.8.x. However,
please be advised that <b>no functional testing</b> has been performed on the latest version.
<i>This plugin is no longer actively maintained.</i><br />&nbsp;
</p>
......
......@@ -268,7 +268,11 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
}
}
public void doClusterTask(final ClusterTask task) {
public long getClusterTime() {
return (cluster == null) ? System.currentTimeMillis() : cluster.getTimeMillis();
}
public void doClusterTask(final ClusterTask task) {
if (taskService != null) {
Member current = taskService.getCluster().getLocalMember();
Set setMembers = taskService.getInfo().getServiceMembers();
......
......@@ -44,6 +44,14 @@
Hazelcast Clustering Plugin Changelog
</h1>
<p><b>1.0.6</b> -- May 1, 2013</p>
<p>Miscellaneous enhancements:</p>
<ul>
<li>Added support for cluster time (<a href="http://issues.igniterealtime.org/browse/OF-666">OF-666</a>)</li>
<li>Added <code>hazelcast-cloud.jar</code> to support AWS deployments (<a href="http://community.igniterealtime.org/blogs/ignite/2012/09/23/introducing-hazelcast-a-new-way-to-cluster-openfire#comment-8027">more info</a>).</li>
<li>Updated Hazelcast to release 2.5.1 (<a href="http://www.hazelcast.com/docs/2.5/manual/single_html/#ReleaseNotes">bug fixes</a>).</li>
</ul>
<p><b>1.0.5</b> -- March 26, 2013</p>
<p>JMX Support (<a href="http://issues.igniterealtime.org/browse/OF-655">OF-655</a>)</p>
<ul>
......
......@@ -5,7 +5,7 @@
<name>${plugin.name}</name>
<description>${plugin.description}</description>
<author>Tom Evans</author>
<version>1.0.5</version>
<date>03/26/2013</date>
<version>1.0.6</version>
<date>05/01/2013</date>
<minServerVersion>3.8.2</minServerVersion>
</plugin>
......@@ -65,7 +65,7 @@ open source <a href="http://www.hazelcast.com">Hazelcast</a> data distribution
framework in lieu of an expensive proprietary third-party product.
</p>
<p>
The current Hazelcast release is version 2.5.
The current Hazelcast release is version 2.5.1.
</p>
<h2>Installation</h2>
<p>
......
......@@ -248,6 +248,17 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
}
}
/**
* Gets the pseudo-synchronized time from the cluster. While the cluster members may
* have varying system times, this method is expected to return a timestamp that is
* synchronized (or nearly so; best effort) across the cluster.
*
* @return Synchronized time for all cluster members
*/
public long getClusterTime() {
return cluster == null ? System.currentTimeMillis() : cluster.getClusterTime();
}
/*
* Execute the given task on the other (non-local) cluster members.
* Note that this method does not provide the result set for the given
......
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