jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r233459 - in /incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state: ItemStateManager.java ItemStateMap.java LocalItemStateManager.java SessionItemStateManager.java UpdatableItemStateManager.java
Date Fri, 19 Aug 2005 09:52:04 GMT
Author: stefan
Date: Fri Aug 19 02:51:57 2005
New Revision: 233459

URL: http://svn.apache.org/viewcvs?rev=233459&view=rev
Log:
JCR-188: Item states cached in UpdatableItemStateManager not discarded on logout

Modified:
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateManager.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateMap.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateManager.java?rev=233459&r1=233458&r2=233459&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateManager.java
Fri Aug 19 02:51:57 2005
@@ -19,7 +19,8 @@
 import org.apache.jackrabbit.core.ItemId;
 
 /**
- * The <code>ItemStateManager</code> interface...
+ * The <code>ItemStateManager</code> interface provides methods for retrieving
+ * <code>ItemState</code> and <code>NodeReferences</code> instances
by id.
  */
 public interface ItemStateManager {
 

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateMap.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateMap.java?rev=233459&r1=233458&r2=233459&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateMap.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/ItemStateMap.java
Fri Aug 19 02:51:57 2005
@@ -32,6 +32,8 @@
  * A {@link java.util.Map} based <code>ItemStateStore</code> implementation.
  */
 public class ItemStateMap implements ItemStateStore, Dumpable {
+
+    /** Logger instance */
     private static Logger log = Logger.getLogger(ItemStateMap.class);
 
     /**

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java?rev=233459&r1=233458&r2=233459&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
Fri Aug 19 02:51:57 2005
@@ -25,6 +25,7 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
+import java.util.Iterator;
 
 /**
  * Local <code>ItemStateManager</code> that isolates changes to
@@ -83,14 +84,6 @@
     }
 
     /**
-     * Disposes this <code>LocalItemStateManager</code> and frees resources.
-     */
-    public void dispose() {
-        // clear cache
-        cache.evictAll();
-    }
-
-    /**
      * Retrieve a node state from the parent shared state manager and
      * wraps it into a intermediate object that helps us handle local
      * modifications.
@@ -349,6 +342,27 @@
 
         sharedStateMgr.store(changeLog, obsMgr);
         changeLog.persisted();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose() {
+        // this LocalItemStateManager instance is no longer needed;
+        // cached item states can now be safely discarded
+        Iterator iter = cache.values().iterator();
+        while (iter.hasNext()) {
+            ItemState state = (ItemState) iter.next();
+            // we're no longer interested in status changes of this item state
+            state.removeListener(this);
+            // discard item state; any remaining listeners will be informed
+            // about this status change
+            state.discard();
+            // let the item state know that it has been disposed
+            state.onDisposed();
+        }
+        // clear cache
+        cache.evictAll();
     }
 
     //----------------------------------------------------< ItemStateListener >

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=233459&r1=233458&r2=233459&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Fri Aug 19 02:51:57 2005
@@ -48,11 +48,6 @@
     private static Logger log = Logger.getLogger(SessionItemStateManager.class);
 
     /**
-     * Root node id
-     */
-    private final NodeId rootNodeId;
-
-    /**
      * State manager that allows updates
      */
     private final UpdatableItemStateManager persistentStateMgr;
@@ -78,7 +73,6 @@
                                    UpdatableItemStateManager persistentStateMgr,
                                    NamespaceResolver nsResolver) {
 
-        rootNodeId = new NodeId(rootNodeUUID);
         this.persistentStateMgr = persistentStateMgr;
         // create transient item state manager
         transientStateMgr = new TransientItemStateManager();
@@ -268,6 +262,16 @@
      */
     public void update() throws ItemStateException, IllegalStateException {
         persistentStateMgr.update();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose() {
+        // discard all transient changes
+        transientStateMgr.disposeAllItemStates();
+        // dispose our (i.e. 'local') state manager 
+        persistentStateMgr.dispose();
     }
 
     //< more methods for listing and retrieving transient ItemState instances >

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java?rev=233459&r1=233458&r2=233459&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
Fri Aug 19 02:51:57 2005
@@ -113,4 +113,9 @@
      * @throws IllegalStateException if the manager is not in edit mode.
      */
     void update() throws ItemStateException, IllegalStateException;
+
+    /**
+     * Disposes this <code>UpdatableItemStateManager</code> and frees resources.
+     */
+    void dispose();
 }



Mime
View raw message