[jboss-cvs] JBossAS SVN: r108285 - projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 22 14:35:57 EDT 2010


Author: pferraro
Date: 2010-09-22 14:35:57 -0400 (Wed, 22 Sep 2010)
New Revision: 108285

Added:
   projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapCache.java
Removed:
   projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java
   projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java
Log:
Replace AtomicMapCacheFactory with AtomicMapCache. 

Added: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapCache.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapCache.java	                        (rev 0)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapCache.java	2010-09-22 18:35:57 UTC (rev 108285)
@@ -0,0 +1,211 @@
+package org.jboss.ha.ispn.atomic;
+
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.infinispan.AbstractDelegatingAdvancedCache;
+import org.infinispan.Cache;
+import org.infinispan.atomic.AtomicMapLookup;
+import org.infinispan.stats.Stats;
+import org.infinispan.util.concurrent.NotifyingFuture;
+
+public class AtomicMapCache<K, MK, MV> extends AbstractDelegatingAdvancedCache<K, Map<MK, MV>>
+{
+   public AtomicMapCache(Cache<K, Map<MK, MV>> cache)
+   {
+      super(cache.getAdvancedCache());
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public Map<MK, MV> get(Object key)
+   {
+      return AtomicMapLookup.getAtomicMap(this.getAdvancedCache(), (K) key, false);
+   }
+
+   @Override
+   public Map<MK, MV> putIfAbsent(K key, Map<MK, MV> value)
+   {
+      return AtomicMapLookup.getAtomicMap(this.getAdvancedCache(), key, true);
+   }
+
+   @Override
+   public void putForExternalRead(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> put(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> putIfAbsent(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public void putAll(Map<? extends K, ? extends Map<MK, MV>> map, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> replace(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public boolean replace(K key, Map<MK, MV> oldValue, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> put(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> putIfAbsent(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public void putAll(Map<? extends K, ? extends Map<MK, MV>> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> replace(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public boolean replace(K key, Map<MK, MV> oldValue, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putAsync(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Void> putAllAsync(Map<? extends K, ? extends Map<MK, MV>> data)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Void> putAllAsync(Map<? extends K, ? extends Map<MK, MV>> data, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Void> putAllAsync(Map<? extends K, ? extends Map<MK, MV>> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putIfAbsentAsync(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putIfAbsentAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> putIfAbsentAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> replaceAsync(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> replaceAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Map<MK, MV>> replaceAsync(K key, Map<MK, MV> value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Boolean> replaceAsync(K key, Map<MK, MV> oldValue, Map<MK, MV> newValue)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Boolean> replaceAsync(K key, Map<MK, MV> oldValue, Map<MK, MV> newValue, long lifespan, TimeUnit unit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public NotifyingFuture<Boolean> replaceAsync(K key, Map<MK, MV> oldValue, Map<MK, MV> newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public boolean replace(K key, Map<MK, MV> oldValue, Map<MK, MV> newValue)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> replace(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Map<MK, MV> put(K key, Map<MK, MV> value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public Stats getStats()
+   {
+      return this.getAdvancedCache().getStats();
+   }
+}

Deleted: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java	2010-09-22 18:24:11 UTC (rev 108284)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java	2010-09-22 18:35:57 UTC (rev 108285)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.ispn.atomic;
-
-import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
-
-/**
- * Mockable facade to {@link org.infinispan.atomic.AtomicMapLookup}.
- * Used to create {@link AtomicMap} proxies.
- * @author Paul Ferraro
- */
-public interface AtomicMapFactory
-{
-   /**
-    * Returns a proxy to an atomic map from the cache entry associated with the specified key.
-    * If no such entry exists, a new entry will be created if indicated.
-    * @param <K> the cache key type
-    * @param <AMK> the atomic map key type
-    * @param <AMV> the atomic map value type
-    * @param cache an infinispan cache
-    * @param key a cache key
-    * @param create indicates whether or not to create a cache entry if none exists.
-    * @return a proxy to the atomic map associated with the given key, or null, if no entry exists,
-    *         and we did not indicate that a new entry should be created
-    */
-   <K, AMK, AMV> AtomicMap<AMK, AMV> getAtomicMap(Cache<K, AtomicMap<AMK, AMV>> cache, K key, boolean create);
-}

Deleted: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java	2010-09-22 18:24:11 UTC (rev 108284)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java	2010-09-22 18:35:57 UTC (rev 108285)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.ispn.atomic;
-
-import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
-import org.infinispan.atomic.AtomicMapLookup;
-
-/**
- * Default atomic map factory that delegates to {@link AtomicMapLookup}.
- * @author Paul Ferraro
- */
-public class DefaultAtomicMapFactory implements AtomicMapFactory
-{
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.ha.ispn.atomic.AtomicMapFactory#getAtomicMap(org.infinispan.Cache, java.lang.Object, boolean)
-    */
-   @Override
-   public <K, AMK, AMV> AtomicMap<AMK, AMV> getAtomicMap(Cache<K, AtomicMap<AMK, AMV>> cache, K key, boolean create)
-   {
-      return AtomicMapLookup.getAtomicMap(cache, key, create);
-   }
-}



More information about the jboss-cvs-commits mailing list