From d414429e92c6bdddf430c2e68642e0cf2a8f35c8 Mon Sep 17 00:00:00 2001 From: Nuno Santos Date: Thu, 3 Oct 2024 07:51:57 +0100 Subject: [PATCH] Cache the Path field in the NodeDocument class. --- .../jackrabbit/oak/plugins/document/NodeDocument.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java index bca44bf938c..6c44d41ea36 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java @@ -364,6 +364,8 @@ static SplitDocType valueOf(Integer type){ private final long creationTime; + private Path path = null; + NodeDocument(@NotNull DocumentStore store) { this(store, Revision.getCurrentTimestamp()); } @@ -2279,7 +2281,10 @@ private Value getLatestValue(@NotNull RevisionContext context, @NotNull public Path getPath() { - return Path.fromString(getPathString()); + if (path == null) { + path = Path.fromString(getPathString()); + } + return path; } @NotNull