[jboss-cvs] JBossAS SVN: r107213 - in projects/cluster/ha-server-ispn/trunk/src: test/java/org/jboss/ha/ispn/invoker and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 29 13:45:36 EDT 2010
Author: pferraro
Date: 2010-07-29 13:45:36 -0400 (Thu, 29 Jul 2010)
New Revision: 107213
Modified:
projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/CacheInvoker.java
projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/RetryingCacheInvoker.java
projects/cluster/ha-server-ispn/trunk/src/test/java/org/jboss/ha/ispn/invoker/RetryingCacheInvokerTest.java
Log:
Make CacheInvoker <key, value>s generic.
Modified: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/CacheInvoker.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/CacheInvoker.java 2010-07-29 17:34:12 UTC (rev 107212)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/CacheInvoker.java 2010-07-29 17:45:36 UTC (rev 107213)
@@ -22,7 +22,6 @@
package org.jboss.ha.ispn.invoker;
import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
import org.infinispan.context.Flag;
/**
@@ -38,7 +37,7 @@
* @param operation a cache operation
* @return the result of the cache operation
*/
- <R> R invoke(Cache<String, AtomicMap<Object, Object>> cache, Operation<R> operation);
+ <K, V, R> R invoke(Cache<K, V> cache, Operation<K, V, R> operation);
/**
* Indicates whether or not to set the {@link Flag#FORCE_SYNCHRONOUS} flag prior to invoking the cache operation
@@ -50,13 +49,13 @@
* Encapsulates a cache operation.
* @param <R> the return type of the cache operation
*/
- interface Operation<R>
+ interface Operation<K, V, R>
{
/**
* Invoke some operation on the specified cache.
* @param cache an infinispan cache
* @return the result of the cache operation
*/
- R invoke(Cache<String, AtomicMap<Object, Object>> cache);
+ R invoke(Cache<K, V> cache);
}
}
Modified: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/RetryingCacheInvoker.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/RetryingCacheInvoker.java 2010-07-29 17:34:12 UTC (rev 107212)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/invoker/RetryingCacheInvoker.java 2010-07-29 17:45:36 UTC (rev 107213)
@@ -22,7 +22,6 @@
package org.jboss.ha.ispn.invoker;
import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
import org.infinispan.context.Flag;
import org.infinispan.remoting.transport.jgroups.SuspectException;
import org.infinispan.util.concurrent.TimeoutException;
@@ -54,7 +53,7 @@
* @see org.jboss.ha.web.tomcat.service.session.distributedcache.impl.CacheInvoker#invoke(org.infinispan.Cache, org.jboss.ha.web.tomcat.service.session.distributedcache.impl.CacheInvoker.Operation)
*/
@Override
- public <R> R invoke(Cache<String, AtomicMap<Object, Object>> cache, Operation<R> operation)
+ public <K, V, R> R invoke(Cache<K, V> cache, Operation<K, V, R> operation)
{
Exception exception = null;
Modified: projects/cluster/ha-server-ispn/trunk/src/test/java/org/jboss/ha/ispn/invoker/RetryingCacheInvokerTest.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/test/java/org/jboss/ha/ispn/invoker/RetryingCacheInvokerTest.java 2010-07-29 17:34:12 UTC (rev 107212)
+++ projects/cluster/ha-server-ispn/trunk/src/test/java/org/jboss/ha/ispn/invoker/RetryingCacheInvokerTest.java 2010-07-29 17:45:36 UTC (rev 107213)
@@ -24,7 +24,6 @@
import org.easymock.EasyMock;
import org.infinispan.AdvancedCache;
import org.infinispan.Cache;
-import org.infinispan.atomic.AtomicMap;
import org.infinispan.context.Flag;
import org.infinispan.remoting.transport.jgroups.SuspectException;
import org.infinispan.util.concurrent.TimeoutException;
@@ -41,9 +40,9 @@
public void simple()
{
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
Object expected = new Object();
CacheInvoker invoker = new RetryingCacheInvoker();
@@ -69,9 +68,9 @@
invoker.setForceSynchronous(true);
@SuppressWarnings("unchecked")
- AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
+ AdvancedCache<Object, Object> cache = EasyMock.createStrictMock(AdvancedCache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
Object expected = new Object();
EasyMock.expect(cache.getAdvancedCache()).andReturn(cache);
@@ -108,9 +107,9 @@
public void retryAfterTimeout()
{
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
Object expected = new Object();
CacheInvoker invoker = new RetryingCacheInvoker(1);
@@ -133,9 +132,9 @@
public void retryAfterSuspect()
{
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
Object expected = new Object();
CacheInvoker invoker = new RetryingCacheInvoker(1);
@@ -158,9 +157,9 @@
public void timeout()
{
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
TimeoutException lastException = new TimeoutException();
CacheInvoker invoker = new RetryingCacheInvoker(1);
@@ -193,9 +192,9 @@
public void suspect()
{
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
@SuppressWarnings("unchecked")
- CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
+ CacheInvoker.Operation<Object, Object, Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
SuspectException lastException = new SuspectException();
CacheInvoker invoker = new RetryingCacheInvoker(1);
More information about the jboss-cvs-commits
mailing list