[jboss-cvs] JBossAS SVN: r70925 - projects/ejb3/branches/cluster-dev/cache-jbc2/src/main/java/org/jboss/ejb3/cache/impl/backing/jbc2.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 17 16:11:40 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-03-17 16:11:40 -0400 (Mon, 17 Mar 2008)
New Revision: 70925

Modified:
   projects/ejb3/branches/cluster-dev/cache-jbc2/src/main/java/org/jboss/ejb3/cache/impl/backing/jbc2/JBCIntegratedObjectStore.java
Log:
[EJBTHREE-1026] Get rid of generics complaints; initial replication fixes 

Modified: projects/ejb3/branches/cluster-dev/cache-jbc2/src/main/java/org/jboss/ejb3/cache/impl/backing/jbc2/JBCIntegratedObjectStore.java
===================================================================
--- projects/ejb3/branches/cluster-dev/cache-jbc2/src/main/java/org/jboss/ejb3/cache/impl/backing/jbc2/JBCIntegratedObjectStore.java	2008-03-17 20:10:46 UTC (rev 70924)
+++ projects/ejb3/branches/cluster-dev/cache-jbc2/src/main/java/org/jboss/ejb3/cache/impl/backing/jbc2/JBCIntegratedObjectStore.java	2008-03-17 20:11:40 UTC (rev 70925)
@@ -41,7 +41,7 @@
 import org.jboss.cache.notifications.event.NodeVisitedEvent;
 import org.jboss.ejb3.annotation.CacheConfig;
 import org.jboss.ejb3.cache.api.CacheItem;
-import org.jboss.ejb3.cache.spi.BackingCacheEntry;
+import org.jboss.ejb3.cache.spi.PassivatingBackingCacheEntry;
 import org.jboss.ejb3.cache.spi.PassivatingIntegratedObjectStore;
 import org.jboss.ejb3.cache.spi.impl.AbstractPassivatingIntegratedObjectStore;
 import org.jboss.logging.Logger;
@@ -52,13 +52,14 @@
  * 
  * @author Brian Stansberry
  */
-public class JBCIntegratedObjectStore<C extends CacheItem, T extends BackingCacheEntry<C>>
+public class JBCIntegratedObjectStore<C extends CacheItem, T extends PassivatingBackingCacheEntry<C>>
    extends AbstractPassivatingIntegratedObjectStore<C, T>
 {
    public static final String FQN_BASE = "sfsb";
    
    private static final String KEY = "item";
    
+   @SuppressWarnings("unchecked")
    private static final ThreadLocal removedItem = new ThreadLocal();
    
    /** Depth of fqn element where we store the id. */ 
@@ -100,7 +101,7 @@
    private final ConcurrentMap<OwnedItem, Long> inMemoryItems;
    private final ConcurrentMap<OwnedItem, Long> passivatedItems;
    
-   public JBCIntegratedObjectStore(Cache jbc, 
+   public JBCIntegratedObjectStore(Cache<Object, T> jbc, 
                                    CacheConfig cacheConfig, 
                                    Object keyBase,
                                    String name,
@@ -190,6 +191,7 @@
       jbc.evict(id);
    }
 
+   @SuppressWarnings("unchecked")
    public T remove(Object key)
    {
       Fqn<Object> id = getFqn(key, false);
@@ -223,16 +225,24 @@
       }
    }
 
-   public void update(T entry)
+   public void update(T entry, boolean modified)
    {
-      try
+      if (modified)
       {
-         putInCache(entry);
+         try
+         {
+            putInCache(entry);
+         }
+         catch (CacheException e)
+         {
+            RuntimeException re = convertToRuntimeException(e);
+            throw re;
+         }
       }
-      catch (CacheException e)
+      else
       {
-         RuntimeException re = convertToRuntimeException(e);
-         throw re;
+         OwnedItem oi = new OwnedItem(null, entry.getId(), cacheNode);
+         inMemoryItems.put(oi, new Long(entry.getLastUsed()));
       }
    }
 
@@ -519,6 +529,7 @@
       
       public void nodeModified(OwnedItem oi, NodeModifiedEvent event)
       {
+         @SuppressWarnings("unchecked")
          T entry = (T) event.getData().get(KEY);
          if (entry != null)
          {
@@ -528,6 +539,7 @@
          }       
       }
       
+      @SuppressWarnings("unchecked")
       public void nodeRemoved(OwnedItem oi, NodeRemovedEvent event)
       {
          inMemoryItems.remove(oi);
@@ -540,6 +552,7 @@
       
       public void nodeActivated(OwnedItem oi, NodeActivatedEvent event)
       {
+         @SuppressWarnings("unchecked")
          T entry = (T) event.getData().get(KEY);
          if (entry != null)
          {
@@ -552,6 +565,7 @@
 
       public void nodePassivated(OwnedItem oi, NodePassivatedEvent event)
       {
+         @SuppressWarnings("unchecked")
          T entry = (T) event.getData().get(KEY);
          if (entry != null)
          {




More information about the jboss-cvs-commits mailing list