Author: mreutegg
Date: Thu May 18 14:21:25 2017
New Revision: 1795537
URL: http://svn.apache.org/viewvc?rev=1795537&view=rev
Log:
OAK-3712: Clean up uncommitted changes
Start lease update thread before initial sweep
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1795537&r1=1795536&r2=1795537&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Thu May 18 14:21:25 2017
@@ -661,6 +661,7 @@ public final class DocumentNodeStore
commitQueue = new CommitQueue(this);
String threadNamePostfix = "(" + clusterId + ")";
batchCommitQueue = new BatchCommitQueue(store);
+ // prepare background threads
backgroundReadThread = new Thread(
new BackgroundReadOperation(this, isDisposed),
"DocumentNodeStore background read thread " +
threadNamePostfix);
@@ -673,34 +674,32 @@ public final class DocumentNodeStore
new BackgroundSweepOperation(this, isDisposed),
"DocumentNodeStore background sweep thread " +
threadNamePostfix);
backgroundSweepThread.setDaemon(true);
-
+ clusterUpdateThread = new Thread(new BackgroundClusterUpdate(this,
isDisposed),
+ "DocumentNodeStore cluster update thread " +
threadNamePostfix);
+ clusterUpdateThread.setDaemon(true);
+ leaseUpdateThread = new Thread(new BackgroundLeaseUpdate(this,
isDisposed),
+ "DocumentNodeStore lease update thread " + threadNamePostfix);
+ leaseUpdateThread.setDaemon(true);
+ // now start the background threads
+ clusterUpdateThread.start();
backgroundReadThread.start();
if (!readOnlyMode) {
+ // OAK-3398 : make lease updating more robust by ensuring it
+ // has higher likelihood of succeeding than other threads
+ // on a very busy machine - so as to prevent lease timeout.
+ leaseUpdateThread.setPriority(Thread.MAX_PRIORITY);
+ leaseUpdateThread.start();
+
// perform an initial document sweep if needed
+ // this may be long running if there is no sweep revision
+ // for this clusterId (upgrade from Oak <= 1.6).
+ // it is therefore important the lease thread is running already.
backgroundSweep();
backgroundUpdateThread.start();
backgroundSweepThread.start();
}
- leaseUpdateThread = new Thread(new BackgroundLeaseUpdate(this,
isDisposed),
- "DocumentNodeStore lease update thread " + threadNamePostfix);
- leaseUpdateThread.setDaemon(true);
- // OAK-3398 : make lease updating more robust by ensuring it
- // has higher likelihood of succeeding than other threads
- // on a very busy machine - so as to prevent lease timeout.
- leaseUpdateThread.setPriority(Thread.MAX_PRIORITY);
- if (!readOnlyMode) {
- leaseUpdateThread.start();
- }
-
- clusterUpdateThread = new Thread(new BackgroundClusterUpdate(this,
isDisposed),
- "DocumentNodeStore cluster update thread " +
threadNamePostfix);
- clusterUpdateThread.setDaemon(true);
- if (!readOnlyMode) {
- clusterUpdateThread.start();
- }
-
persistentCache = builder.getPersistentCache();
if (!readOnlyMode && persistentCache != null) {
DynamicBroadcastConfig broadcastConfig = new
DocumentBroadcastConfig(this);