You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2015/08/17 15:19:06 UTC
svn commit: r1696269 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java util/LeaseCheckDocumentStoreWrapper.java
Author: reschke
Date: Mon Aug 17 13:19:06 2015
New Revision: 1696269
URL: http://svn.apache.org/r1696269
Log:
OAK-2739: code format (WSP)
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java?rev=1696269&r1=1696268&r2=1696269&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java Mon Aug 17 13:19:06 2015
@@ -207,13 +207,13 @@ public class ClusterNodeInfo {
* oak.documentMK.disableLeaseCheck
*/
private final boolean leaseCheckDisabled;
-
+
/**
* Tracks the fact whether the lease has *ever* been renewed by this instance
* or has just be read from the document store at initialization time.
*/
private boolean renewed;
-
+
/**
* The revLock value of the cluster;
*/
@@ -387,7 +387,7 @@ public class ClusterNodeInfo {
public void performLeaseCheck() {
if (leaseCheckDisabled || !renewed) {
// if leaseCheckDisabled is set we never do the check, so return fast
-
+
// the 'renewed' flag indicates if this instance *ever* renewed the lease after startup
// until that is not set, we cannot do the lease check (otherwise startup wouldn't work)
return;
@@ -397,14 +397,14 @@ public class ClusterNodeInfo {
// then all is good
return;
}
-
+
// OAK-2739 : when the lease is not current, we must stop
// the instance immediately to avoid any cluster inconsistency
final String errorMsg = "performLeaseCheck: this instance failed to update the lease in time "
+ "(leaseEndTime: "+leaseEndTime+", now: "+now+", leaseTime: "+leaseTime+") "
+ "and is thus no longer eligible for taking part in the cluster. Shutting down NOW!";
LOG.error(errorMsg);
-
+
// now here comes the thing: we should a) call System.exit in a separate thread
// to avoid any deadlock when calling from eg within the shutdown hook
// AND b) we should not call system.exit hundred times.
@@ -420,7 +420,6 @@ public class ClusterNodeInfo {
public void run() {
System.exit(-1);
}
-
};
final Thread th = new Thread(r, "FailedLeaseCheckShutdown-Thread");
th.setDaemon(true);
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java?rev=1696269&r1=1696268&r2=1696269&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java Mon Aug 17 13:19:06 2015
@@ -38,26 +38,25 @@ import org.apache.jackrabbit.oak.plugins
* @see https://issues.apache.org/jira/browse/OAK-2739 for more details
*/
public final class LeaseCheckDocumentStoreWrapper implements DocumentStore {
-
+
private final DocumentStore delegate;
private final ClusterNodeInfo clusterNodeInfo;
- public LeaseCheckDocumentStoreWrapper(final DocumentStore delegate,
- final ClusterNodeInfo clusterNodeInfo) {
- if (delegate==null) {
+ public LeaseCheckDocumentStoreWrapper(final DocumentStore delegate, final ClusterNodeInfo clusterNodeInfo) {
+ if (delegate == null) {
throw new IllegalArgumentException("delegate must not be null");
}
this.delegate = delegate;
// clusterNodeInfo is allowed to be null - eg for testing
this.clusterNodeInfo = clusterNodeInfo;
}
-
+
private final void performLeaseCheck() {
- if (clusterNodeInfo!=null) {
+ if (clusterNodeInfo != null) {
clusterNodeInfo.performLeaseCheck();
}
}
-
+
@Override
public final <T extends Document> T find(Collection<T> collection, String key) {
performLeaseCheck();