You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2019/10/04 03:58:28 UTC

[sling-org-apache-sling-jcr-resource] branch master updated: SLING-8765 : Cache jackrabbit session check

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git


The following commit(s) were added to refs/heads/master by this push:
     new 196566b  SLING-8765 : Cache jackrabbit session check
196566b is described below

commit 196566bf2962adc8317003ee925c39a5fed1bd71
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Oct 4 05:58:20 2019 +0200

    SLING-8765 : Cache jackrabbit session check
---
 .../jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
index e582011..abdef92 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
@@ -47,9 +47,12 @@ public class JcrItemResourceFactory {
 
     private final HelperData helper;
 
-    public JcrItemResourceFactory(Session session, HelperData helper) {
+    private final boolean isJackrabbit;
+
+    public JcrItemResourceFactory(final Session session, final HelperData helper) {
         this.helper = helper;
         this.session = session;
+        this.isJackrabbit = session instanceof JackrabbitSession;
     }
 
     /**
@@ -180,7 +183,7 @@ public class JcrItemResourceFactory {
         Item item = null;
         try {
          // Use fast getItemOrNull if session is a JackrabbitSession
-            if (session instanceof JackrabbitSession) {
+            if (this.isJackrabbit) {
                 item = ((JackrabbitSession) session).getItemOrNull(path);
             }
             // Fallback to slower itemExists & getItem pattern