jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1167099 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabb...
Date Fri, 09 Sep 2011 11:18:46 GMT
Author: mduerig
Date: Fri Sep  9 11:18:45 2011
New Revision: 1167099

URL: http://svn.apache.org/viewvc?rev=1167099&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
  (contents, props changed)
      - copied, changed from r1167084, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=1167099&r1=1167098&r2=1167099&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
Fri Sep  9 11:18:45 2011
@@ -22,7 +22,7 @@ import org.apache.jackrabbit.jcr2spi.nod
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.util.WeakIdentityCollection;
+import org.apache.jackrabbit.spi.commons.util.WeakIdentityCollection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -250,10 +250,8 @@ public abstract class ItemState {
             }
         }
         if (status == Status.MODIFIED) {
-            /*
-            change back tmp MODIFIED status, that is used as marker only
-            inform listeners about (external) changes.
-            */
+            // change back tmp MODIFIED status, that is used as marker only
+            // inform listeners about (external) changes.
             status = Status.EXISTING;
         }
     }

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
(from r1167084, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java&r1=1167084&r2=1167099&rev=1167099&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/WeakIdentityCollection.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
Fri Sep  9 11:18:45 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.util;
+package org.apache.jackrabbit.spi.commons.util;
 
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
@@ -37,7 +37,7 @@ public class WeakIdentityCollection<E> i
     /**
      * The weak references.
      */
-    private final transient ArrayList<WeakRef> elementData;
+    private final transient ArrayList<WeakReferenceWithIndex> elementData;
 
     /**
      * The reference queue to poll for references that point to unreachable
@@ -60,7 +60,7 @@ public class WeakIdentityCollection<E> i
         if (initialCapacity < 0) {
             throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
         }
-        elementData = new ArrayList<WeakRef>(initialCapacity);
+        elementData = new ArrayList<WeakReferenceWithIndex>(initialCapacity);
     }
 
     /**
@@ -105,16 +105,16 @@ public class WeakIdentityCollection<E> i
             throw new NullPointerException("Object must not be null");
         }
         // poll refQueue for a slot we can reuse
-        WeakRef ref = (WeakRef) refQueue.poll();
+        WeakReferenceWithIndex ref = (WeakReferenceWithIndex) refQueue.poll();
         if (ref != null) {
-            elementData.set(ref.index, new WeakRef(o, ref.index));
+            elementData.set(ref.index, new WeakReferenceWithIndex(o, ref.index));
             cleanQueue();
         } else if (!emptySlots.isEmpty()) {
             int idx = emptySlots.nextSetBit(0);
-            elementData.set(idx, new WeakRef(o, idx));
+            elementData.set(idx, new WeakReferenceWithIndex(o, idx));
             emptySlots.clear(idx);
         } else {
-            elementData.add(new WeakRef(o, elementData.size()));
+            elementData.add(new WeakReferenceWithIndex(o, elementData.size()));
         }
         return true;
     }
@@ -127,7 +127,7 @@ public class WeakIdentityCollection<E> i
      */
     @Override
     public boolean contains(Object o) {
-        for (WeakRef anElementData : elementData) {
+        for (WeakReferenceWithIndex anElementData : elementData) {
             if (anElementData.get() == o) {
                 return true;
             }
@@ -147,7 +147,7 @@ public class WeakIdentityCollection<E> i
             if (elementData.get(i).get() == o) {
                 emptySlots.set(i);
                 // overwrite entry with dummy ref
-                elementData.set(i, new WeakRef(null, i));
+                elementData.set(i, new WeakReferenceWithIndex(null, i));
                 return true;
             }
         }
@@ -197,7 +197,7 @@ public class WeakIdentityCollection<E> i
     @Override
     public Iterator<E> iterator() {
         return new Iterator<E>() {
-            private final Iterator<WeakRef> elementIterator = elementData.iterator();
+            private final Iterator<WeakReferenceWithIndex> elementIterator = elementData.iterator();
 
             @Override
             public boolean hasNext() {
@@ -259,8 +259,8 @@ public class WeakIdentityCollection<E> i
      * Polls the reference queue until no reference is available anymore.
      */
     private void cleanQueue() {
-        WeakRef ref;
-        while ((ref = (WeakRef) refQueue.poll()) != null) {
+        WeakReferenceWithIndex ref;
+        while ((ref = (WeakReferenceWithIndex) refQueue.poll()) != null) {
             emptySlots.set(ref.index);
         }
     }
@@ -269,7 +269,7 @@ public class WeakIdentityCollection<E> i
      * Weak reference with index value that points to the slot in {@link
      * WeakIdentityCollection#elementData}.
      */
-    private final class WeakRef extends WeakReference<E> {
+    private final class WeakReferenceWithIndex extends WeakReference<E> {
 
         /**
          * The index of this weak reference.
@@ -277,12 +277,12 @@ public class WeakIdentityCollection<E> i
         private final int index;
 
         /**
-         * Creates a new WeakRef.
+         * Creates a new WeakReferenceWithIndex.
          *
          * @param referent object the new weak reference will refer to.
          * @param index    the index of this weak reference.
          */
-        public WeakRef(E referent, int index) {
+        public WeakReferenceWithIndex(E referent, int index) {
             super(referent, refQueue);
             this.index = index;
         }

Propchange: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message