Commit fc0cbdb5 authored by Robin Collier's avatar Robin Collier Committed by rcollier

Added ability to turn off batch persistence. This would enable 0 data loss in...

Added ability to turn off batch persistence.  This would enable 0 data loss in case of vm shutdown at expense of throughput.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13427 b35dd754-fafc-0310-a699-88a17e54d16e
parent c4d63641
...@@ -191,8 +191,8 @@ public class PubSubPersistenceManager { ...@@ -191,8 +191,8 @@ public class PubSubPersistenceManager {
"accessModel, language, replyPolicy, associationPolicy, maxLeafNodes) " + "accessModel, language, replyPolicy, associationPolicy, maxLeafNodes) " +
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static Timer flushTimer = new Timer("Pubsub item flush timer"); private static Timer flushTimer;
private static long flushTimerDelay = JiveGlobals.getIntProperty("xmpp.pubsub.flush.timer", 120) * 1000; private static long flushTimerDelay;
private static Timer purgeTimer = new Timer("Pubsub purge stale items timer"); private static Timer purgeTimer = new Timer("Pubsub purge stale items timer");
private static long purgeTimerDelay = JiveGlobals.getIntProperty("xmpp.pubsub.purge.timer", 300) * 1000; private static long purgeTimerDelay = JiveGlobals.getIntProperty("xmpp.pubsub.purge.timer", 300) * 1000;
...@@ -228,18 +228,24 @@ public class PubSubPersistenceManager { ...@@ -228,18 +228,24 @@ public class PubSubPersistenceManager {
private static final Cache<String, PublishedItem> itemCache = CacheFactory.createCache(ITEM_CACHE); private static final Cache<String, PublishedItem> itemCache = CacheFactory.createCache(ITEM_CACHE);
static { static {
// Enforce a min of 20s if (MAX_ITEMS_FLUSH > 0) {
if (flushTimerDelay < 20000) flushTimer = new Timer("Pubsub item flush timer");
flushTimerDelay = 20000;
flushTimerDelay = JiveGlobals.getIntProperty("xmpp.pubsub.flush.timer", 120) * 1000;
flushTimer.schedule(new TimerTask()
{ // Enforce a min of 20s
@Override if (flushTimerDelay < 20000)
public void run() flushTimerDelay = 20000;
{
flushPendingItems(false); // this member only flushTimer.schedule(new TimerTask()
} {
}, flushTimerDelay, flushTimerDelay); @Override
public void run()
{
flushPendingItems(false); // this member only
}
}, flushTimerDelay, flushTimerDelay);
}
// Enforce a min of 20s // Enforce a min of 20s
if (purgeTimerDelay < 60000) if (purgeTimerDelay < 60000)
......
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