Commit 6b2a9422 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Added support to execute an invocation service in a given node.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8343 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1b49e6fd
...@@ -206,6 +206,27 @@ public class CacheFactory { ...@@ -206,6 +206,27 @@ public class CacheFactory {
cacheFactoryStrategy.doClusterTask(task); cacheFactoryStrategy.doClusterTask(task);
} }
/**
* Invokes a task on a given cluster member in an asynchronous fashion. If clustering is not enabled,
* this method will do nothing.
*
* @param task the task to be invoked on the specified cluster member.
* @param nodeID the byte array that identifies the target cluster member.
* @return false if not in a cluster or specified cluster node was not found.
*/
public static boolean doClusterTask(final ClusterTask task, byte[] nodeID) {
if (!clusteringEnabled) {
return false;
}
synchronized(CacheFactory.class) {
if (!clusteringEnabled) {
return false;
}
}
return cacheFactoryStrategy.doClusterTask(task, nodeID);
}
/** /**
* Invokes a task on other cluster members synchronously and returns the result as a Collection * Invokes a task on other cluster members synchronously and returns the result as a Collection
* (method will not return until the task has been executed on each cluster member). * (method will not return until the task has been executed on each cluster member).
......
...@@ -69,6 +69,17 @@ public interface CacheFactoryStrategy { ...@@ -69,6 +69,17 @@ public interface CacheFactoryStrategy {
*/ */
void doClusterTask(final ClusterTask task); void doClusterTask(final ClusterTask task);
/**
* Invokes a task on other the specified cluster member in an asynchronous fashion. If clustering is not
* enabled, this method will do nothing.
*
* @param task the task to be invoked on the specified cluster member.
* @param nodeID the byte array that identifies the target cluster member.
* @return false if not in a cluster or specified cluster node was not found.
*/
boolean doClusterTask(ClusterTask task, byte[] nodeID);
/** /**
* Invokes a task on other cluster members synchronously and returns the result as a Collection * Invokes a task on other cluster members synchronously and returns the result as a Collection
* (method will not return until the task has been executed on each cluster member). * (method will not return until the task has been executed on each cluster member).
......
...@@ -27,7 +27,6 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy { ...@@ -27,7 +27,6 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
public static final int DEFAULT_MAX_CACHE_SIZE = 1024 * 256; public static final int DEFAULT_MAX_CACHE_SIZE = 1024 * 256;
public static final long DEFAULT_MAX_CACHE_LIFETIME = 6 * JiveConstants.HOUR; public static final long DEFAULT_MAX_CACHE_LIFETIME = 6 * JiveConstants.HOUR;
private static final byte[] EMPTY_ID = new byte[0];
/** /**
* This map contains property names which were used to store cache configuration data * This map contains property names which were used to store cache configuration data
...@@ -68,6 +67,7 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy { ...@@ -68,6 +67,7 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
cacheNames.put("Routing Components Cache", "routeComponent"); cacheNames.put("Routing Components Cache", "routeComponent");
cacheNames.put("Routing Users Cache", "routeUser"); cacheNames.put("Routing Users Cache", "routeUser");
cacheNames.put("Routing AnonymousUsers Cache", "routeAnonymousUser"); cacheNames.put("Routing AnonymousUsers Cache", "routeAnonymousUser");
cacheNames.put("Routing User Sessions", "routeUserSessions");
cacheProps.put("cache.fileTransfer.size", 128 * 1024l); cacheProps.put("cache.fileTransfer.size", 128 * 1024l);
cacheProps.put("cache.fileTransfer.expirationTime", 1000 * 60 * 10l); cacheProps.put("cache.fileTransfer.expirationTime", 1000 * 60 * 10l);
...@@ -105,6 +105,8 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy { ...@@ -105,6 +105,8 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
cacheProps.put("cache.routeUser.expirationTime", -1l); cacheProps.put("cache.routeUser.expirationTime", -1l);
cacheProps.put("cache.routeAnonymousUser.size", -1l); cacheProps.put("cache.routeAnonymousUser.size", -1l);
cacheProps.put("cache.routeAnonymousUser.expirationTime", -1l); cacheProps.put("cache.routeAnonymousUser.expirationTime", -1l);
cacheProps.put("cache.routeUserSessions.size", -1l);
cacheProps.put("cache.routeUserSessions.expirationTime", -1l);
} }
...@@ -134,6 +136,10 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy { ...@@ -134,6 +136,10 @@ public class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
public void doClusterTask(final ClusterTask task) { public void doClusterTask(final ClusterTask task) {
} }
public boolean doClusterTask(ClusterTask task, byte[] nodeID) {
return false;
}
public Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) { public Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) {
return Collections.emptyList(); return Collections.emptyList();
} }
......
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