jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r124016 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
Date Mon, 03 Jan 2005 17:22:32 GMT
Author: stefan
Date: Mon Jan  3 09:22:29 2005
New Revision: 124016

URL: http://svn.apache.org/viewcvs?view=rev&rev=124016
Log:
fixing timing issue which could cause that invalid ItemImpl instances were served from the
ItemManager cache.
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java?view=diff&rev=124016&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r1=124015&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r2=124016
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	Mon Jan 
3 09:22:29 2005
@@ -909,8 +909,10 @@
             state.removeListener(this);
             state = null;
         }
-        // notify the listeners that this instance has been
-        // permanently invalidated
+        /**
+         * notify the listeners that this instance has been
+         * permanently invalidated
+         */
         notifyDestroyed();
     }
 
@@ -925,29 +927,33 @@
      * @see ItemStateListener#stateDiscarded
      */
     public void stateDiscarded(ItemState discarded) {
-        // the state of this item has been discarded, probably as a result
-        // of calling Node.revert() or ItemImpl.setRemoved()
+        /**
+         * the state of this item has been discarded, probably as a result
+         * of calling Node.revert() or ItemImpl.setRemoved()
+         */
         if (isTransient()) {
             switch (state.getStatus()) {
                 /**
                  * persistent item that has been transiently removed
                  */
                 case ItemState.STATUS_EXISTING_REMOVED:
-                    /**
-                     * persistent item that has been transiently modified
-                     */
+                /**
+                 * persistent item that has been transiently modified
+                 */
                 case ItemState.STATUS_EXISTING_MODIFIED:
-                    /**
-                     * persistent item that has been transiently modified or removed
-                     * and the underlying persistent state has been externally
-                     * modified since the transient modification/removal.
-                     */
+                /**
+                 * persistent item that has been transiently modified or removed
+                 * and the underlying persistent state has been externally
+                 * modified since the transient modification/removal.
+                 */
                 case ItemState.STATUS_STALE_MODIFIED:
                     ItemState persistentState = state.getOverlayedState();
-                    // the state is a transient wrapper for the underlying
-                    // persistent state, therefor restore the
-                    // persistent state and resurrect this item instance
-                    // if necessary
+                    /**
+                     * the state is a transient wrapper for the underlying
+                     * persistent state, therefore restore the
+                     * persistent state and resurrect this item instance
+                     * if necessary
+                     */
                     state.removeListener(this);
                     state = persistentState;
                     state.addListener(this);
@@ -960,42 +966,49 @@
                     }
                     return;
 
+                /**
+                 * persistent item that has been transiently modified or removed
+                 * and the underlying persistent state has been externally
+                 * destroyed since the transient modification/removal.
+                 */
+                case ItemState.STATUS_STALE_DESTROYED:
                     /**
-                     * persistent item that has been transiently modified or removed
-                     * and the underlying persistent state has been externally
-                     * destroyed since the transient modification/removal.
+                     * first notify the listeners that this instance has been
+                     * permanently invalidated
                      */
-                case ItemState.STATUS_STALE_DESTROYED:
-                    // set state of this instance to 'destroyed'
+                    notifyDestroyed();
+                    // now set state of this instance to 'destroyed'
                     status = STATUS_DESTROYED;
-                    // dispose state
+                    // finally dispose state
                     state.removeListener(this);
                     state = null;
-                    // notify the listeners that this instance has been
-                    // permanently invalidated
-                    notifyDestroyed();
                     return;
 
+                /**
+                 * new item that has been transiently added
+                 */
+                case ItemState.STATUS_NEW:
                     /**
-                     * new item that has been transiently added
+                     * first notify the listeners that this instance has been
+                     * permanently invalidated
                      */
-                case ItemState.STATUS_NEW:
-                    // set state of this instance to 'destroyed'
+                    notifyDestroyed();
+                    // now set state of this instance to 'destroyed'
                     status = STATUS_DESTROYED;
-                    // dispose state
+                    // finally dispose state
                     state.removeListener(this);
                     state = null;
-                    // notify the listeners that this instance has been
-                    // permanently invalidated
-                    notifyDestroyed();
                     return;
             }
         }
 
-        // render this instance 'invalid'
-        status = STATUS_INVALIDATED;
-        // notify the listeners
+        /**
+         * first notify the listeners that this instance has been
+         * invalidated
+         */
         notifyInvalidated();
+        // now render this instance 'invalid'
+        status = STATUS_INVALIDATED;
     }
 
     //-----------------------------------------------------------------< Item >

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java?view=diff&rev=124016&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java&r1=124015&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java&r2=124016
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	Mon Jan  3 09:22:29
2005
@@ -58,6 +58,7 @@
         // set up the environment for creating the initial context
         Hashtable env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
+        env.put(Context.PROVIDER_URL, "localhost");
         InitialContext ctx = new InitialContext(env);
 
         RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
@@ -144,7 +145,7 @@
             root.save();
         }
 
-        //root.setProperty("blob", new FileInputStream(new File("d:/temp/jckrabbit.zip")));
+        //root.setProperty("blob", new FileInputStream(new File("d:/temp/jackrabbit.zip")));
 
         if (root.hasProperty("blah")) {
             root.getProperty("blah").remove();

Mime
View raw message