jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1521151 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/AbstractRoot.java util/LazyValue.java
Date Mon, 09 Sep 2013 15:04:08 GMT
Author: mduerig
Date: Mon Sep  9 15:04:08 2013
New Revision: 1521151

URL: http://svn.apache.org/r1521151
Log:
OAK-929: Permission changes not visible on root after refresh
Avoid refreshing the permission provider too eagerly

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/LazyValue.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java?rev=1521151&r1=1521150&r2=1521151&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
Mon Sep  9 15:04:08 2013
@@ -117,7 +117,7 @@ public abstract class AbstractRoot imple
      */
     private long modCount;
 
-    private LazyValue<PermissionProvider> permissionProvider = new LazyValue<PermissionProvider>()
{
+    private final LazyValue<PermissionProvider> permissionProvider = new LazyValue<PermissionProvider>()
{
         @Override
         protected PermissionProvider createValue() {
             return getAcConfig().getPermissionProvider(AbstractRoot.this, subject.getPrincipals());
@@ -218,7 +218,7 @@ public abstract class AbstractRoot imple
             purgePendingChanges();
             branch.rebase();
             reset();
-            if (permissionProvider != null) {
+            if (permissionProvider.hasValue()) {
                 permissionProvider.get().refresh();
             }
         }
@@ -230,7 +230,7 @@ public abstract class AbstractRoot imple
         branch = store.branch();
         reset();
         modCount = 0;
-        if (permissionProvider != null) {
+        if (permissionProvider.hasValue()) {
             permissionProvider.get().refresh();
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/LazyValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/LazyValue.java?rev=1521151&r1=1521150&r2=1521151&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/LazyValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/LazyValue.java
Mon Sep  9 15:04:08 2013
@@ -34,6 +34,13 @@ public abstract class LazyValue<T> {
     protected abstract T createValue();
 
     /**
+     * @return  {@code true} iff {@link #get()} has been called at least once.
+     */
+    public boolean hasValue() {
+        return value != null;
+    }
+
+    /**
      * Get value. Calls {@link #createValue()} if called for the first time.
      * @return  the value
      */



Mime
View raw message