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 ch...@apache.org on 2016/06/21 06:18:32 UTC
svn commit: r1749428 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
Author: chetanm
Date: Tue Jun 21 06:18:31 2016
New Revision: 1749428
URL: http://svn.apache.org/viewvc?rev=1749428&view=rev
Log:
OAK-4180 - Use another NodeStore as a local cache for a remote Document store
Lazily read the properties like lastRev, readRev etc as these are not accessed that often (out of 10k reads of NodeState they are accessed only 50 times)
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java?rev=1749428&r1=1749427&r2=1749428&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java Tue Jun 21 06:18:31 2016
@@ -52,7 +52,7 @@ class DelegatingDocumentNodeState extend
private static final Predicate<PropertyState> NOT_META_PROPS = new Predicate<PropertyState>() {
@Override
- public boolean apply(@Nullable PropertyState input) {
+ public boolean apply(PropertyState input) {
return !input.getName().startsWith(":doc-");
}
};
@@ -60,9 +60,9 @@ class DelegatingDocumentNodeState extend
private final NodeState delegate;
private final RevisionVector rootRevision;
private final boolean fromExternalChange;
- private final RevisionVector lastRevision;
- private final RevisionVector readRevision;
- private final String path;
+ private RevisionVector lastRevision;
+ private RevisionVector readRevision;
+ private String path;
/**
* Wraps a given NodeState as a {@link DelegatingDocumentNodeState} if
@@ -98,9 +98,6 @@ class DelegatingDocumentNodeState extend
this.delegate = delegate;
this.rootRevision = rootRevision;
this.fromExternalChange = fromExternalChange;
- this.path = getRequiredProp(PROP_PATH);
- this.readRevision = RevisionVector.fromString(getRequiredProp(PROP_REVISION));
- this.lastRevision = RevisionVector.fromString(getRequiredProp(PROP_LAST_REV));
}
private DelegatingDocumentNodeState(DelegatingDocumentNodeState original,
@@ -118,16 +115,25 @@ class DelegatingDocumentNodeState extend
@Override
public String getPath() {
+ if (path == null){
+ this.path = getRequiredProp(PROP_PATH);
+ }
return path;
}
@Override
public RevisionVector getRevision() {
+ if (readRevision == null){
+ this.readRevision = RevisionVector.fromString(getRequiredProp(PROP_REVISION));
+ }
return readRevision;
}
@Override
public RevisionVector getLastRevision() {
+ if (lastRevision == null){
+ this.lastRevision = RevisionVector.fromString(getRequiredProp(PROP_LAST_REV));
+ }
return lastRevision;
}
@@ -186,7 +192,7 @@ class DelegatingDocumentNodeState extend
return Iterables.transform(delegate.getChildNodeEntries(), new Function<ChildNodeEntry, ChildNodeEntry>() {
@Nullable
@Override
- public ChildNodeEntry apply(@Nullable ChildNodeEntry input) {
+ public ChildNodeEntry apply(ChildNodeEntry input) {
return new MemoryChildNodeEntry(input.getName(), decorate(input.getNodeState()));
}
});