[jboss-cvs] JBossAS SVN: r65975 - in projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache: impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 9 11:49:23 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-10-09 11:49:23 -0400 (Tue, 09 Oct 2007)
New Revision: 65975

Modified:
   projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/IntegratedObjectStore.java
   projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimpleIntegratedObjectStore.java
Log:
Always update the store; let it check whether the entry is dirty and do what it wants

Modified: projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/IntegratedObjectStore.java
===================================================================
--- projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/IntegratedObjectStore.java	2007-10-09 15:49:04 UTC (rev 65974)
+++ projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/IntegratedObjectStore.java	2007-10-09 15:49:23 UTC (rev 65975)
@@ -23,7 +23,7 @@
 package org.jboss.ejb3.cache;
 
 /**
- * A in-memory store for identifiable objects that integrates a persistent store. 
+ * An in-memory store for identifiable objects that integrates a persistent store. 
  * Note that this class does NOT call any callbacks.
  * 
  * @author Brian Stansberry
@@ -57,16 +57,9 @@
    T get(Object key);
    
    /**
-    * Update an already cached item. Only valid for 
-    * {@link #isClustered() clustered} stores, as the purpose of this
-    * method is to advise the store that the state of it's locally cached copy 
-    * of an entry has changed and that any other caches in the cluster should
-    * be made aware of the new state.
+    * Update an already cached item.
     * 
-    * @param  entry the entry to replicate
-    *           
-    * @throws UnsupportedOperationException if {@link #isClustered()} returns
-    *                                       <code>false</code>
+    * @param  entry the entry to update
     * 
     * @throws IllegalStateException if the store isn't already managing an entry
     *                               with the same {@link Identifiable#getId() id}.

Modified: projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimpleIntegratedObjectStore.java
===================================================================
--- projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimpleIntegratedObjectStore.java	2007-10-09 15:49:04 UTC (rev 65974)
+++ projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/impl/SimpleIntegratedObjectStore.java	2007-10-09 15:49:23 UTC (rev 65975)
@@ -112,8 +112,16 @@
    
    public void update(T entry)
    {
-      throw new UnsupportedOperationException("Clustering is not supported by " + 
-                                              getClass().getName());      
+      Object key = entry.getId();
+      synchronized (cache)
+      {
+         if (!cache.containsKey(key) && !passivatedEntries.containsKey(key))
+         {
+            throw new IllegalStateException(key + " is not managed by this store");
+         }
+         
+         // Otherwise we do nothing; we already have a ref to the entry
+      }
    }
 
    public void passivate(T entry)




More information about the jboss-cvs-commits mailing list