[jboss-cvs] JBossAS SVN: r106982 - in projects/cluster/ha-server-cache-ispn/trunk/src: test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 21 11:31:04 EDT 2010
Author: pferraro
Date: 2010-07-21 11:31:04 -0400 (Wed, 21 Jul 2010)
New Revision: 106982
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/CacheInvoker.java
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvoker.java
projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java
Log:
javadocs
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/CacheInvoker.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/CacheInvoker.java 2010-07-21 14:50:57 UTC (rev 106981)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/CacheInvoker.java 2010-07-21 15:31:04 UTC (rev 106982)
@@ -23,19 +23,40 @@
import org.infinispan.Cache;
import org.infinispan.atomic.AtomicMap;
+import org.infinispan.context.Flag;
/**
+ * Encapsulates logic used to invoke an operation on a cache.
* @author Paul Ferraro
- *
*/
public interface CacheInvoker
{
+ /**
+ * Invokes the specified operation on the specified cache.
+ * @param <R> the type of the cache operation result
+ * @param cache an infinispan cache
+ * @param operation a cache operation
+ * @return the result of the cache operation
+ */
<R> R invoke(Cache<String, AtomicMap<Object, Object>> cache, Operation<R> operation);
+ /**
+ * Indicates whether or not to set the {@link Flag#FORCE_SYNCHRONOUS} flag prior to invoking the cache operation
+ * @param forceSynchronous
+ */
void setForceSynchronous(boolean forceSynchronous);
+ /**
+ * Encapsulates a cache operation.
+ * @param <R> the return type of the cache operation
+ */
interface Operation<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);
}
}
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvoker.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvoker.java 2010-07-21 14:50:57 UTC (rev 106981)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryingCacheInvoker.java 2010-07-21 15:31:04 UTC (rev 106982)
@@ -40,6 +40,10 @@
private volatile boolean forceSynchronous = false;
+ /**
+ * Creates a new RetryingCacheInvoker.
+ * @param backOffIntervals specifies the sleep intervals between retries, and implicitly, the number of retries
+ */
public RetryingCacheInvoker(int... backOffIntervals)
{
this.backOffIntervals = backOffIntervals;
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java 2010-07-21 14:50:57 UTC (rev 106981)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/RetryCacheInvokerTest.java 2010-07-21 15:31:04 UTC (rev 106982)
@@ -69,15 +69,13 @@
invoker.setForceSynchronous(true);
@SuppressWarnings("unchecked")
- Cache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(Cache.class);
+ AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
@SuppressWarnings("unchecked")
- AdvancedCache<String, AtomicMap<Object, Object>> advancedCache = EasyMock.createStrictMock(AdvancedCache.class);
- @SuppressWarnings("unchecked")
CacheInvoker.Operation<Object> operation = EasyMock.createStrictMock(CacheInvoker.Operation.class);
Object expected = new Object();
- EasyMock.expect(cache.getAdvancedCache()).andReturn(advancedCache);
- EasyMock.expect(advancedCache.withFlags(Flag.FORCE_SYNCHRONOUS)).andReturn(advancedCache);
+ EasyMock.expect(cache.getAdvancedCache()).andReturn(cache);
+ EasyMock.expect(cache.withFlags(Flag.FORCE_SYNCHRONOUS)).andReturn(cache);
EasyMock.expect(operation.invoke(cache)).andReturn(expected);
EasyMock.replay(cache, operation);
More information about the jboss-cvs-commits
mailing list