Commit 4c4cb9b8 authored by Tom Evans's avatar Tom Evans Committed by tevans

OF-205: Prevent cyclical flushItems call across cluster members

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/pubsub_clustering@13261 b35dd754-fafc-0310-a699-88a17e54d16e
parent e008f6da
...@@ -41,6 +41,7 @@ import java.util.concurrent.LinkedBlockingQueue; ...@@ -41,6 +41,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.database.DbConnectionManager.DatabaseType; import org.jivesoftware.database.DbConnectionManager.DatabaseType;
import org.jivesoftware.openfire.cluster.ClusterManager;
import org.jivesoftware.openfire.pubsub.cluster.FlushTask; import org.jivesoftware.openfire.pubsub.cluster.FlushTask;
import org.jivesoftware.openfire.pubsub.models.AccessModel; import org.jivesoftware.openfire.pubsub.models.AccessModel;
import org.jivesoftware.openfire.pubsub.models.PublisherModel; import org.jivesoftware.openfire.pubsub.models.PublisherModel;
...@@ -1139,10 +1140,21 @@ public class PubSubPersistenceManager { ...@@ -1139,10 +1140,21 @@ public class PubSubPersistenceManager {
* Flush the cache of items to be persisted and deleted. * Flush the cache of items to be persisted and deleted.
*/ */
public static void flushItems() public static void flushItems()
{
flushItems(ClusterManager.isClusteringEnabled());
}
/**
* Flush the cache of items to be persisted and deleted.
* @param sendToCluster If true, delegate to cluster members, otherwise local only
*/
public static void flushItems(boolean sendToCluster)
{ {
log.debug("Flushing items to database"); log.debug("Flushing items to database");
if (sendToCluster) {
CacheFactory.doSynchronousClusterTask(new FlushTask(), false); CacheFactory.doSynchronousClusterTask(new FlushTask(), false);
}
boolean abortTransaction = false; boolean abortTransaction = false;
LinkedList addList = null; LinkedList addList = null;
......
...@@ -22,7 +22,7 @@ public class FlushTask implements ClusterTask ...@@ -22,7 +22,7 @@ public class FlushTask implements ClusterTask
public void run() public void run()
{ {
log.debug("[TASK] Flush pubsub"); log.debug("[TASK] Flush pubsub");
PubSubPersistenceManager.flushItems(); PubSubPersistenceManager.flushItems(false); // just this member
} }
@Override @Override
......
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