You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/27 19:13:59 UTC

svn commit: r1176475 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ jackrabbit-spi/src/main/java/org/apache/jackrabbi...

Author: mduerig
Date: Tue Sep 27 17:13:58 2011
New Revision: 1176475

URL: http://svn.apache.org/viewvc?rev=1176475&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
simplify ItemInfoCache: remove generation and evict on save/refresh completely

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfoCache.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionInfoImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=1176475&r1=1176474&r2=1176475&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Tue Sep 27 17:13:58 2011
@@ -24,7 +24,6 @@ import org.apache.jackrabbit.spi.ChildIn
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.ItemInfoCache;
-import org.apache.jackrabbit.spi.ItemInfoCache.Entry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
@@ -81,25 +80,11 @@ public class WorkspaceItemStateFactory e
      * Creates the node with information retrieved from the {@code RepositoryService}.
      */
     @Override
-    public NodeState createNodeState(NodeId nodeId, NodeEntry entry) throws
-            RepositoryException {
-
+    public NodeState createNodeState(NodeId nodeId, NodeEntry entry) throws RepositoryException {
         try {
-            Entry<NodeInfo> cached = cache.getNodeInfo(nodeId);
-            ItemInfo info;
-            if (isUpToDate(cached, entry)) {
-                info = cached.info;
-            } else {
-                // otherwise retrieve item info from service and cache the whole batch
-                Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, nodeId);
-                info = first(infos, cache, entry.getGeneration());
-                if (info == null || !info.denotesNode()) {
-                    throw new ItemNotFoundException("NodeId: " + nodeId);
-                }
-            }
-
+            NodeInfo info = getNodeInfo(nodeId);
             assertMatchingPath(info, entry);
-            return createNodeState((NodeInfo) info, entry);
+            return createNodeState(info, entry);
         }
         catch (PathNotFoundException e) {
             throw new ItemNotFoundException(e);
@@ -111,46 +96,19 @@ public class WorkspaceItemStateFactory e
      * Intermediate entries are created as needed.
      */
     @Override
-    public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent) throws
-            RepositoryException {
-
+    public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent) throws RepositoryException {
         try {
-            // Get item info from cache
-            Iterator<? extends ItemInfo> infos = null;
-            Entry<NodeInfo> cached = cache.getNodeInfo(nodeId);
-            ItemInfo info;
-            if (cached == null) {
-                // or from service if not in cache
-                infos = service.getItemInfos(sessionInfo, nodeId);
-                info = first(infos, null, 0);
-                if (info == null || !info.denotesNode()) {
-                    throw new ItemNotFoundException("NodeId: " + nodeId);
-                }
-            } else {
-                info = cached.info;
-            }
+            NodeInfo info = getNodeInfo(nodeId);
 
             // Build the hierarchy entry for the item info
             HierarchyEntry<?> entry = createHierarchyEntries(info, anyParent);
             if (entry == null || !entry.denotesNode()) {
                 throw new ItemNotFoundException(
                         "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
-            } else {
-                // Now we can check whether the item info from the cache is up to date
-                long generation = entry.getGeneration();
-                if (isOutdated(cached, entry)) {
-                    // if not, retrieve the item info from the service and put the whole batch into the cache
-                    infos = service.getItemInfos(sessionInfo, nodeId);
-                    info = first(infos, cache, generation);
-                } else if (infos != null) {
-                    // Otherwise put the whole batch retrieved from the service earlier into the cache
-                    cache.put(info, generation);
-                    first(infos, cache, generation);
-                }
-
-                assertMatchingPath(info, entry);
-                return createNodeState((NodeInfo) info, Unchecked.<NodeEntry>cast(entry));
             }
+
+            assertMatchingPath(info, entry);
+            return createNodeState(info, Unchecked.<NodeEntry>cast(entry));
         }
         catch (PathNotFoundException e) {
             throw new ItemNotFoundException(e);
@@ -161,26 +119,11 @@ public class WorkspaceItemStateFactory e
      * Creates the PropertyState with information retrieved from the {@code RepositoryService}.
      */
     @Override
-    public PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry)
-            throws RepositoryException {
-
+    public PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry) throws RepositoryException {
         try {
-            // Get item info from cache and use it if up to date
-            Entry<PropertyInfo> cached = cache.getPropertyInfo(propertyId);
-            ItemInfo info;
-            if (isUpToDate(cached, entry)) {
-                info = cached.info;
-            } else {
-                // otherwise retrieve item info from service and cache the whole batch
-                Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, propertyId);
-                info = first(infos, cache, entry.getGeneration());
-                if (info == null || info.denotesNode()) {
-                    throw new ItemNotFoundException("PropertyId: " + propertyId);
-                }
-            }
-
+            PropertyInfo info = getPropertyInfo(propertyId);
             assertMatchingPath(info, entry);
-            return createPropertyState((PropertyInfo) info, entry);
+            return createPropertyState(info, entry);
         }
         catch (PathNotFoundException e) {
             throw new ItemNotFoundException(e);
@@ -192,46 +135,20 @@ public class WorkspaceItemStateFactory e
      * Intermediate entries are created as needed.
      */
     @Override
-    public PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent)
-            throws RepositoryException {
-
+    public PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent) throws RepositoryException {
         try {
-            // Get item info from cache
-            Iterator<? extends ItemInfo> infos = null;
-            Entry<PropertyInfo> cached = cache.getPropertyInfo(propertyId);
-            ItemInfo info;
-            if (cached == null) {
-                // or from service if not in cache
-                infos = service.getItemInfos(sessionInfo, propertyId);
-                info = first(infos, null, 0);
-                if (info == null || info.denotesNode()) {
-                    throw new ItemNotFoundException("PropertyId: " + propertyId);
-                }
-            } else {
-                info = cached.info;
-            }
+            PropertyInfo info = getPropertyInfo(propertyId);
 
             // Build the hierarchy entry for the item info
             HierarchyEntry<?> entry = createHierarchyEntries(info, anyParent);
             if (entry == null || entry.denotesNode()) {
                 throw new ItemNotFoundException(
                         "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
-            } else {
-                long generation = entry.getGeneration();
-                if (isOutdated(cached, entry)) {
-                    // if not, retrieve the item info from the service and put the whole batch into the cache
-                    infos = service.getItemInfos(sessionInfo, propertyId);
-                    info = first(infos, cache, generation);
-                } else if (infos != null) {
-                    // Otherwise put the whole batch retrieved from the service earlier into the cache
-                    cache.put(info, generation);
-                    first(infos, cache, generation);
-                }
-
-                assertMatchingPath(info, entry);
-                return createPropertyState((PropertyInfo) info, Unchecked.<PropertyEntry>cast(entry));
             }
 
+            assertMatchingPath(info, entry);
+            return createPropertyState(info, Unchecked.<PropertyEntry>cast(entry));
+
         } catch (PathNotFoundException e) {
             throw new ItemNotFoundException(e);
         }
@@ -268,22 +185,68 @@ public class WorkspaceItemStateFactory e
     //------------------------------------------------------------< private >---
 
     /**
+     * Get the {@code NodeInfo} for the given {@code nodeId}. Either from the cache or
+     * from the {@code RepositoryService} if not cached. All items actually retrieved
+     * from are put into the cache
+     *
+     * @param nodeId
+     * @return
+     * @throws ItemNotFoundException 
+     */
+    private NodeInfo getNodeInfo(NodeId nodeId) throws RepositoryException {
+        // Get item info from cache
+        NodeInfo info = cache.getNodeInfo(nodeId);
+        if (info == null) {
+            // or from service if not in cache
+            Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, nodeId);
+            info = (NodeInfo) first(infos, cache);
+            if (info == null || !info.denotesNode()) {
+                throw new ItemNotFoundException("NodeId: " + nodeId);
+            }
+        }
+        return info;
+    }
+
+    /**
+     * Get the {@code PropertyInfo} for the given {@code propertyId}. Either from the cache or
+     * from the {@code RepositoryService} if not cached. All items actually retrieved
+     * from are put into the cache
+     *
+     * @param propertyId
+     * @return
+     * @throws ItemNotFoundException
+     */
+    private PropertyInfo getPropertyInfo(PropertyId propertyId) throws RepositoryException {
+        // Get item info from cache
+        PropertyInfo info = cache.getPropertyInfo(propertyId);
+        if (info == null) {
+            // or from service if not in cache
+            Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, propertyId);
+            info = (PropertyInfo) first(infos, cache);
+            if (info == null || info.denotesNode()) {
+                throw new ItemNotFoundException("PropertyId: " + propertyId);
+            }
+        }
+        return info;
+    }
+
+    /**
      * Returns the first item in the iterator if it exists. Otherwise returns {@code null}.
      * If {@code cache} is not {@code null}, caches all items by the given
      * {@code generation}.
      */
-    private static ItemInfo first(Iterator<? extends ItemInfo> infos, ItemInfoCache cache, long generation) {
+    private static ItemInfo first(Iterator<? extends ItemInfo> infos, ItemInfoCache cache) {
         ItemInfo first = null;
         if (infos.hasNext()) {
             first = infos.next();
             if (cache != null) {
-                cache.put(first, generation);
+                cache.put(first);
             }
         }
 
         if (cache != null) {
             while (infos.hasNext()) {
-                cache.put(infos.next(), generation);
+                cache.put(infos.next());
             }
         }
 
@@ -432,9 +395,9 @@ public class WorkspaceItemStateFactory e
     }
 
     private NodeEntry createNodeEntry(NodeEntry parentEntry, Name name, int index) throws RepositoryException {
-        Entry<NodeInfo> cached = cache.getNodeInfo(parentEntry.getWorkspaceId());
-        if (isUpToDate(cached, parentEntry)) {
-            Iterator<ChildInfo> childInfos = cached.info.getChildInfos();
+        NodeInfo info = cache.getNodeInfo(parentEntry.getWorkspaceId());
+        if (info != null) {
+            Iterator<ChildInfo> childInfos = info.getChildInfos();
             if (childInfos != null) {
                 parentEntry.setNodeEntries(childInfos);
             }
@@ -444,40 +407,6 @@ public class WorkspaceItemStateFactory e
     }
 
     /**
-     * Returns true if {@code cache} is not {@code null} and
-     * the cached entry is up to date.
-     * @param cacheEntry
-     * @param entry
-     * @return
-     * @throws RepositoryException
-     */
-    private static boolean isUpToDate(Entry<?> cacheEntry, HierarchyEntry<?> entry) throws RepositoryException {
-        return cacheEntry != null &&
-            cacheEntry.generation >= entry.getGeneration() &&
-            isMatchingPath(cacheEntry.info, entry);
-    }
-
-    /**
-     * Returns true if {@code cache} is not {@code null} and
-     * the cached entry is not up to date.
-     * @param cacheEntry
-     * @param entry
-     * @return
-     * @throws RepositoryException
-     */
-    private static boolean isOutdated(Entry<?> cacheEntry, HierarchyEntry<?> entry) throws RepositoryException {
-        return cacheEntry != null &&
-            (cacheEntry.generation < entry.getGeneration() ||
-            !isMatchingPath(cacheEntry.info, entry));
-    }
-
-    private static boolean isMatchingPath(ItemInfo info, HierarchyEntry<?> entry) throws RepositoryException {
-        Path infoPath = info.getPath();
-        Path wspPath = entry.getWorkspacePath();
-        return infoPath.equals(wspPath);
-    }
-
-    /**
      * Validation check: Path of the given ItemInfo must match to the Path of
      * the HierarchyEntry. This is required for Items that are identified by
      * a uniqueID that may move within the hierarchy upon restore or clone.
@@ -487,9 +416,12 @@ public class WorkspaceItemStateFactory e
      * @throws RepositoryException
      */
     private static void assertMatchingPath(ItemInfo info, HierarchyEntry<?> entry) throws RepositoryException {
-        if (!isMatchingPath(info, entry)) {
+        Path infoPath = info.getPath();
+        Path wspPath = entry.getWorkspacePath();
+        if (!infoPath.equals(wspPath)) {
             // TODO: handle external move of nodes (parents) identified by uniqueID
-            throw new ItemNotFoundException("HierarchyEntry " + entry.getWorkspacePath() + " does not match ItemInfo " + info.getPath());
+            throw new ItemNotFoundException("HierarchyEntry " + entry.getWorkspacePath() + " does not match ItemInfo " +
+                    info.getPath());
         }
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java?rev=1176475&r1=1176474&r2=1176475&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java Tue Sep 27 17:13:58 2011
@@ -50,7 +50,7 @@ public class ItemInfoCacheImpl implement
     public static final int DEFAULT_CACHE_SIZE = 5000;
 
     private final int cacheSize;
-    private final LinkedMap entries;
+    private final LinkedMap infos;
 
     /**
      * Create a new instance with the default cache size.
@@ -66,7 +66,7 @@ public class ItemInfoCacheImpl implement
      */
     public ItemInfoCacheImpl(int cacheSize) {
         this.cacheSize = cacheSize;
-        entries = new LinkedMap(cacheSize);
+        infos = new LinkedMap(cacheSize);
     }
 
     /**
@@ -76,16 +76,16 @@ public class ItemInfoCacheImpl implement
      * a second lookup is done by the path.
      */
     @Override
-    public Entry<NodeInfo> getNodeInfo(NodeId nodeId) {
-        Object entry = entries.remove(nodeId);
-        if (entry == null) {
-            entry = entries.remove(nodeId.getPath());
+    public NodeInfo getNodeInfo(NodeId nodeId) {
+        Object info = infos.remove(nodeId);
+        if (info == null) {
+            info = infos.remove(nodeId.getPath());
         } else {
-            // there might be a corresponding path-indexed entry, clear it as well
-            entries.remove(node(entry).info.getPath());
+            // there might be a corresponding path-indexed info, clear it as well
+            infos.remove(node(info).getPath());
         }
 
-        return node(entry);
+        return node(info);
     }
 
     /**
@@ -95,16 +95,16 @@ public class ItemInfoCacheImpl implement
      * a second lookup is done by the path.
      */
     @Override
-    public Entry<PropertyInfo> getPropertyInfo(PropertyId propertyId) {
-        Object entry = entries.remove(propertyId);
-        if (entry == null) {
-            entry = entries.remove(propertyId.getPath());
+    public PropertyInfo getPropertyInfo(PropertyId propertyId) {
+        Object info = infos.remove(propertyId);
+        if (info == null) {
+            info = infos.remove(propertyId.getPath());
         } else {
-            // there might be a corresponding path-indexed entry, clear it as well
-            entries.remove(property(entry).info.getPath());
+            // there might be a corresponding path-indexed info, clear it as well
+            infos.remove(property(info).getPath());
         }
 
-        return property(entry);
+        return property(info);
     }
 
     /**
@@ -112,48 +112,44 @@ public class ItemInfoCacheImpl implement
      * is uuid based but has no path, also by its path.
      */
     @Override
-    public void put(ItemInfo info, long generation) {
+    public void put(ItemInfo info) {
         ItemId id = info.getId();
-        Entry<? extends ItemInfo> entry = info.denotesNode()
-            ? new Entry<NodeInfo>((NodeInfo) info, generation)
-            : new Entry<PropertyInfo>((PropertyInfo) info, generation);
-
-        put(id, entry);
+        put(id, info);
         if (id.getUniqueID() != null && id.getPath() == null) {
-            put(info.getPath(), entry);
+            put(info.getPath(), info);
         }
     }
 
     @Override
     public void dispose() {
-        entries.clear();
+        infos.clear();
     }
 
     // -----------------------------------------------------< private >---
 
-    private void put(Object key, Entry<? extends ItemInfo> entry) {
-        entries.remove(key);
-        if (entries.size() >= cacheSize) {
-            entries.remove(entries.firstKey());  // xxx AbstractLinkedMap#firstKey() Javadoc is wrong. See COLLECTIONS-353
+    private void put(Object key, ItemInfo info) {
+        infos.remove(key);
+        if (infos.size() >= cacheSize) {
+            infos.remove(infos.firstKey());  // xxx AbstractLinkedMap#firstKey() Javadoc is wrong. See COLLECTIONS-353
         }
-        entries.put(key, entry);
+        infos.put(key, info);
     }
 
-    private static Entry<NodeInfo> node(Object entry) {
-        if (entry != null && Unchecked.<Entry<?>>cast(entry).info.denotesNode()) {
-            return cast(entry);
+    private static NodeInfo node(Object info) {
+        if (info != null && Unchecked.<ItemInfo>cast(info).denotesNode()) {
+            return cast(info);
         }
         else {
             return null;
         }
     }
 
-    private static Entry<PropertyInfo> property(Object entry) {
-        if (entry != null && !Unchecked.<Entry<?>>cast(entry).info.denotesNode()) {
-            return cast(entry);
+    private static PropertyInfo property(Object info) {
+        if (info != null && !Unchecked.<ItemInfo>cast(info).denotesNode()) {
+            return cast(info);
         }
         else {
             return null;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java?rev=1176475&r1=1176474&r2=1176475&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java Tue Sep 27 17:13:58 2011
@@ -117,10 +117,13 @@ public class SessionInfoImpl implements 
     }
 
     /**
-     * Empty implementation
+     * Dispose the {@code ItemInfoCache}
      */
     @Override
     public void refresh() {
+        if (itemInfoCache != null) {
+            itemInfoCache.dispose();
+        }
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfoCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfoCache.java?rev=1176475&r1=1176474&r2=1176475&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfoCache.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfoCache.java Tue Sep 27 17:13:58 2011
@@ -17,10 +17,9 @@
 package org.apache.jackrabbit.spi;
 
 /**
- * {@code ItemInfoCache} instances are responsible for caching
- * {@link ItemInfo}s along with an opaque generation counter. Implementations
- * are free on the particular caching policy. That is, how long (if at all) item
- * infos are cached.
+ * {@code ItemInfoCache} instances are responsible for caching {@link ItemInfo}s.
+ * Implementations are free on the particular caching policy. That is, how long (if at
+ * all) item infos are cached.
  *
  * An {@code ItemInfoCache} is supplied per session from the {@link RepositoryService}. It is used
  * to cache {@code ItemInfo}s read from the {@code RepositoryService}.
@@ -30,85 +29,31 @@ package org.apache.jackrabbit.spi;
 public interface ItemInfoCache {
 
     /**
-     * This class represents a cache entry.
-     * @param <T> Either a {@link NodeInfo} or a {@link PropertyInfo}.
-     */
-    class Entry<T extends ItemInfo> {
-
-        /**
-         * The {@link ItemInfo}
-         */
-        public final T info;
-
-        /**
-         * The generation
-         */
-        public final long generation;
-
-        /**
-         * Create a new cache entry containing {@code info} with a given {@code generation}.
-         * @param info
-         * @param generation
-         */
-        public Entry(T info, long generation) {
-            this.info = info;
-            this.generation = generation;
-        }
-
-        @Override
-        public int hashCode() {
-            return info.hashCode() + (int) generation;
-        }
-
-        @Override
-        public boolean equals(Object that) {
-            if (that == null) {
-                return false;
-            }
-
-            if (that == this) {
-                return true;
-            }
-
-            if (that instanceof ItemInfoCache.Entry<?>) {
-                ItemInfoCache.Entry<?> other = (ItemInfoCache.Entry<?>) that;
-                return generation == other.generation && info.equals(other.info);
-            }
-
-            return false;
-        }
-    }
-
-    /**
-     * Retrieve a cache entry for the given {@code nodeId} or {@code null}
-     * if no such entry is in the cache.
+     * Retrieve cached {@code NodeInfo} for the given {@code nodeId} or {@code null}
+     * if not in cache.
      *
      * @param nodeId  id of the entry to lookup.
-     * @return a {@code Entry&lt;NodeInfo&gt;} instance or {@code null}
-     * if not found.
+     * @return a {@code NodeInfo} instance or {@code null} if not found.
      */
-    ItemInfoCache.Entry<NodeInfo> getNodeInfo(NodeId nodeId);
+    NodeInfo getNodeInfo(NodeId nodeId);
 
     /**
-     * Retrieve a cache entry for the given {@code propertyId} or {@code null}
-     * if no such entry is in the cache.
+     * Retrieve a caches {@code PropertyInfo} for the given {@code propertyId} or {@code null}
+     * if not in cache.
      *
      * @param propertyId  id of the entry to lookup.
-     * @return a {@code Entry&lt;PropertyInfo&gt;} instance or
-     * {@code null} if not found.
+     * @return a {@code PropertyInfo} instance or {@code null} if not found.
      */
-    ItemInfoCache.Entry<PropertyInfo> getPropertyInfo(PropertyId propertyId);
+    PropertyInfo getPropertyInfo(PropertyId propertyId);
 
     /**
-     * Create a {@link Entry} for {@code info} and {@code generation} and put it into
-     * the cache.
+     * Put {@code info} into the cache.
      * @param info
-     * @param generation
      */
-    void put(ItemInfo info, long generation);
+    void put(ItemInfo info);
 
     /**
      * Clear the cache and dispose all entries.
      */
     void dispose();
-}
\ No newline at end of file
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionInfoImpl.java?rev=1176475&r1=1176474&r2=1176475&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionInfoImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionInfoImpl.java Tue Sep 27 17:13:58 2011
@@ -52,6 +52,7 @@ public class SessionInfoImpl extends org
         try {
             synchronized (commitLog) {
                 revision = commit.apply(microKernel);
+                refresh();
                 commitLog.add(revision);
             }
         }
@@ -97,6 +98,7 @@ public class SessionInfoImpl extends org
 
     @Override
     public void refresh() {
+        super.refresh();
         revision = microKernel.getHeadRevision();
     }