Commit 7a18f0f0 authored by Tom Evans's avatar Tom Evans Committed by tevans

OF-205: Updated clustering plugin to support Coherence 3.7.1

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/pubsub_clustering@13277 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6d17d5aa
After you have licensed and downloaded Coherence EE from Oracle, place
the following jar files in this folder:
coherence.jar
coherence-work.jar
To build the clustering plugin, issue the following command from
the Openfire (source) /build/ folder:
$OPENFIRE_SRC/build> ant -Dplugin=clustering plugin
Also note that due to classpath loading order, it may be necessary to
either remove the coherence-cache-config.xml file from the Coherence
runtime JAR, or rename the plugin-clustering.jar file to force it to
load before coherence.jar (e.g. "clustering-plugin.jar" or similar).
In order to run Oracle Coherence in production mode, you will need to
secure licensing for the Enterprise Edition (EE) of Coherence. While
clustered caching for Openfire is available in the Standard Edition (SE),
per the Oracle Fusion licensing docs the InvocationService (which is
used by Openfire to distribute tasks among the cluster members) is only
available in EE or Grid Edition (GE).
Note that Coherence is configured to run GE in development mode by default.
You can change this setting by overriding the following Java system properties
via /etc/sysconfig/openfire (RPM) or openfired.vmoptions (Windows):
-Dtangosol.coherence.edition=EE
-Dtangosol.coherence.mode=prod
The current Coherence release is version 3.7.1.
\ No newline at end of file
...@@ -783,7 +783,7 @@ http://www.tangosol.com/UserGuide-Reference-CacheConfig.jsp ...@@ -783,7 +783,7 @@ http://www.tangosol.com/UserGuide-Reference-CacheConfig.jsp
</init-param> </init-param>
<init-param> <init-param>
<param-name>back-size-low</param-name> <param-name>back-size-low</param-name>
<param-value>943718</param-value> <param-value>9437180</param-value>
</init-param> </init-param>
</init-params> </init-params>
</cache-mapping> </cache-mapping>
...@@ -802,7 +802,7 @@ http://www.tangosol.com/UserGuide-Reference-CacheConfig.jsp ...@@ -802,7 +802,7 @@ http://www.tangosol.com/UserGuide-Reference-CacheConfig.jsp
</init-param> </init-param>
<init-param> <init-param>
<param-name>back-size-low</param-name> <param-name>back-size-low</param-name>
<param-value>943718</param-value> <param-value>9437180</param-value>
</init-param> </init-param>
</init-params> </init-params>
</cache-mapping> </cache-mapping>
......
...@@ -23,6 +23,8 @@ package com.jivesoftware.openfire; ...@@ -23,6 +23,8 @@ package com.jivesoftware.openfire;
import com.jivesoftware.openfire.session.RemoteSessionLocator; import com.jivesoftware.openfire.session.RemoteSessionLocator;
import com.jivesoftware.util.cache.CoherenceExternalizableUtil; import com.jivesoftware.util.cache.CoherenceExternalizableUtil;
import com.jivesoftware.util.cluster.CoherencePacketRouter; import com.jivesoftware.util.cluster.CoherencePacketRouter;
import com.tangosol.net.CacheFactory;
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;
...@@ -143,6 +145,8 @@ public class ClusteringPlugin implements Plugin, PropertyEventListener { ...@@ -143,6 +145,8 @@ public class ClusteringPlugin implements Plugin, PropertyEventListener {
XMPPServer.getInstance().setRemoteSessionLocator(new RemoteSessionLocator()); XMPPServer.getInstance().setRemoteSessionLocator(new RemoteSessionLocator());
// Set packet router to use to deliver packets to remote cluster nodes // Set packet router to use to deliver packets to remote cluster nodes
XMPPServer.getInstance().getRoutingTable().setRemotePacketRouter(new CoherencePacketRouter()); XMPPServer.getInstance().getRoutingTable().setRemotePacketRouter(new CoherencePacketRouter());
// Initialize the Coherence cluster configuration
CacheFactory.getClusterConfig();
} }
/** /**
......
...@@ -190,7 +190,7 @@ public class ClusteredCache implements Cache, QueryMap, InvocableMap { ...@@ -190,7 +190,7 @@ public class ClusteredCache implements Cache, QueryMap, InvocableMap {
public long getCacheHits() { public long getCacheHits() {
if (map instanceof NearCache) { if (map instanceof NearCache) {
return ((NearCache)map).getCacheHits(); return ((NearCache)map).getCacheStatistics().getCacheHits();
} }
else if (backingCache != null) { else if (backingCache != null) {
return backingCache.getCacheHits(); return backingCache.getCacheHits();
...@@ -202,7 +202,7 @@ public class ClusteredCache implements Cache, QueryMap, InvocableMap { ...@@ -202,7 +202,7 @@ public class ClusteredCache implements Cache, QueryMap, InvocableMap {
public long getCacheMisses() { public long getCacheMisses() {
if (map instanceof NearCache) { if (map instanceof NearCache) {
return ((NearCache)map).getCacheMisses(); return ((NearCache)map).getCacheStatistics().getCacheMisses();
} }
else if (backingCache != null) { else if (backingCache != null) {
return backingCache.getCacheMisses(); return backingCache.getCacheMisses();
......
...@@ -93,7 +93,7 @@ public class CoherenceClusteredCacheFactory implements CacheFactoryStrategy { ...@@ -93,7 +93,7 @@ public class CoherenceClusteredCacheFactory implements CacheFactoryStrategy {
} }
else { else {
com.tangosol.net.CacheFactory.getCache("opt-$cacheStats"); com.tangosol.net.CacheFactory.getCache("opt-$cacheStats");
taskService = com.tangosol.net.CacheFactory.getInvocationService("OpenFire Cluster Service"); taskService = (InvocationService) com.tangosol.net.CacheFactory.getService("OpenFire Cluster Service");
// Update the running state of the cluster // Update the running state of the cluster
state = cluster != null ? State.started : State.stopped; state = cluster != null ? State.started : State.stopped;
......
...@@ -286,7 +286,7 @@ public class CoherenceExternalizableUtil implements ExternalizableUtilStrategy { ...@@ -286,7 +286,7 @@ public class CoherenceExternalizableUtil implements ExternalizableUtilStrategy {
} }
public Serializable readSerializable(DataInput in) throws IOException { public Serializable readSerializable(DataInput in) throws IOException {
return ExternalizableHelper.readSerializable(in); return (Serializable) ExternalizableHelper.readSerializable(in);
} }
public void writeSafeUTF(DataOutput out, String value) throws IOException { public void writeSafeUTF(DataOutput out, String value) throws IOException {
......
...@@ -64,7 +64,7 @@ public class CoherenceInfo { ...@@ -64,7 +64,7 @@ public class CoherenceInfo {
*/ */
public static Map getNodeInfo() { public static Map getNodeInfo() {
InvocationService service = com.tangosol.net.CacheFactory.getInvocationService("OpenFire Cluster Service"); InvocationService service = (InvocationService) com.tangosol.net.CacheFactory.getService("OpenFire Cluster Service");
// Run cluster-wide stats query // Run cluster-wide stats query
Map results = service.query(new AbstractInvocable() { Map results = service.query(new AbstractInvocable() {
...@@ -107,7 +107,7 @@ public class CoherenceInfo { ...@@ -107,7 +107,7 @@ public class CoherenceInfo {
*/ */
public static void clearCacheStats() { public static void clearCacheStats() {
InvocationService service = com.tangosol.net.CacheFactory.getInvocationService("OpenFire Cluster Service"); InvocationService service = (InvocationService) com.tangosol.net.CacheFactory.getService("OpenFire Cluster Service");
service.execute(new AbstractInvocable() { service.execute(new AbstractInvocable() {
public void run() { public void run() {
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
} }
// Get the cache stats object: // Get the cache stats object:
Map cacheStats = com.tangosol.net.CacheFactory.getReplicatedCache( Map cacheStats = com.tangosol.net.CacheFactory.getCache(
"opt-$cacheStats", com.tangosol.net.CacheFactory.class.getClassLoader()); "opt-$cacheStats", com.tangosol.net.CacheFactory.class.getClassLoader());
// Decimal formatter for nubmers // Decimal formatter for nubmers
...@@ -354,8 +354,8 @@ Cache statistics for this cluster node appear below. ...@@ -354,8 +354,8 @@ Cache statistics for this cluster node appear below.
double memUsed = (double) size / (1024 * 1024); double memUsed = (double) size / (1024 * 1024);
double totalMem = (double) maxSize / (1024 * 1024); double totalMem = (double) maxSize / (1024 * 1024);
double freeMem = 100 - 100 * memUsed / totalMem; double freeMem = 100 - 100 * memUsed / Math.max(1, totalMem);
double usedMem = 100 * memUsed / totalMem; double usedMem = 100 * memUsed / Math.max(1, totalMem);
long hits = theStats[3]; long hits = theStats[3];
long misses = theStats[4]; long misses = theStats[4];
double hitPercent = 0.0; double hitPercent = 0.0;
......
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