jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1378944 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Date Thu, 30 Aug 2012 14:03:42 GMT
Author: mreutegg
Date: Thu Aug 30 14:03:41 2012
New Revision: 1378944

URL: http://svn.apache.org/viewvc?rev=1378944&view=rev
Log:
OAK-289: Remove TreeImpl.Children

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1378944&r1=1378943&r2=1378944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Thu Aug 30 14:03:41 2012
@@ -18,12 +18,8 @@
  */
 package org.apache.jackrabbit.oak.core;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
@@ -65,7 +61,8 @@ public class TreeImpl implements Tree, P
     /**
      * Cache for child trees that have been accessed before.
      */
-    private final Children children = new Children();
+    private final Map<String, TreeImpl> children =
+            CacheBuilder.newBuilder().weakValues().<String, TreeImpl>build().asMap();
 
     private TreeImpl(RootImpl root, TreeImpl parent, String name) {
         assert root != null;
@@ -499,53 +496,6 @@ public class TreeImpl implements Tree, P
         return !isDirty[0];
     }
 
-    private static class Children implements Iterable<TreeImpl> {
-
-        private final Map<String, TreeImpl> children =
-                CacheBuilder.newBuilder().weakValues().<String, TreeImpl>build().asMap();
-
-        private final Lock readLock;
-        private final Lock writeLock;
-
-        {
-            ReadWriteLock lock = new ReentrantReadWriteLock();
-            readLock = lock.readLock();
-            writeLock = lock.writeLock();
-        }
-
-        public void put(String name, TreeImpl tree) {
-            writeLock.lock();
-            try {
-                children.put(name, tree);
-            } finally {
-                writeLock.unlock();
-            }
-        }
-
-        public TreeImpl get(String name) {
-            readLock.lock();
-            try {
-                return children.get(name);
-            } finally {
-                readLock.unlock();
-            }
-        }
-
-        public void remove(String name) {
-            writeLock.lock();
-            try {
-                children.remove(name);
-            } finally {
-                writeLock.unlock();
-            }
-        }
-
-        @Override
-        public Iterator<TreeImpl> iterator() {
-            return children.values().iterator();
-        }
-    }
-
     //------------------------------------------------------------< TreeLocation >---
 
     public class NodeLocation implements TreeLocation {



Mime
View raw message