[jboss-cvs] JBossAS SVN: r108229 - in projects/cluster/ha-server-cache-ispn/trunk/src: test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 20 12:58:14 EDT 2010
Author: pferraro
Date: 2010-09-20 12:58:13 -0400 (Mon, 20 Sep 2010)
New Revision: 108229
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
Log:
Override fetchInMemoryState according to overridden cache mode.
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java 2010-09-20 16:51:26 UTC (rev 108228)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java 2010-09-20 16:58:13 UTC (rev 108229)
@@ -89,8 +89,9 @@
}
else
{
+ boolean dist = (value > 0);
boolean synchronous = mode.isSynchronous();
- if (value > 0)
+ if (dist)
{
mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
}
@@ -98,6 +99,7 @@
{
mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
}
+ configuration.setFetchInMemoryState(!dist);
}
}
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java 2010-09-20 16:51:26 UTC (rev 108228)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java 2010-09-20 16:58:13 UTC (rev 108229)
@@ -64,55 +64,55 @@
config.setReplicationMode(null);
config.setBackups(null);
- this.getCache("standard-session-cache", null, "//host/context1", config, configuration, CacheMode.REPL_ASYNC);
- this.getCache("standard-session-cache", null, "//host/context2", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context1", config, configuration, CacheMode.REPL_ASYNC, null);
+ this.getCache("standard-session-cache", null, "//host/context2", config, configuration, CacheMode.REPL_ASYNC, null);
// Validate cache container qualified cache name
config.setCacheName("default/session-cache");
- this.getCache("default", "session-cache", "//host/context", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache("default", "session-cache", "//host/context", config, configuration, CacheMode.REPL_ASYNC, null);
config.setCacheName(null);
- this.getCache(null, null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache(null, null, "//host/context", config, configuration, CacheMode.REPL_ASYNC, null);
config.setCacheName("standard-session-cache");
config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC, null);
config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC, null);
config.setBackups(Integer.valueOf(-1));
config.setReplicationMode(null);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC, true);
config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC, true);
config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC, true);
config.setBackups(Integer.valueOf(0));
config.setReplicationMode(null);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL, null);
config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL, null);
config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL, null);
config.setBackups(Integer.valueOf(1));
config.setReplicationMode(null);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC, false);
config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_SYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_SYNC, false);
config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
- this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC);
+ this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC, false);
}
- private void getCache(String containerName, String templateCacheName, String cacheName, ReplicationConfig config, Configuration configuration, CacheMode mode)
+ private void getCache(String containerName, String templateCacheName, String cacheName, ReplicationConfig config, Configuration configuration, CacheMode mode, Boolean fetchInMemoryState)
{
@SuppressWarnings("unchecked")
Cache<Object, Object> cache = this.control.createMock(Cache.class);
@@ -122,7 +122,7 @@
EasyMock.expect(manager.getReplicationConfig()).andReturn(config);
- EasyMock.expect(registry.getCacheContainer(containerName)).andReturn(container);
+ EasyMock.expect(this.registry.getCacheContainer(containerName)).andReturn(container);
EasyMock.expect(manager.getName()).andReturn(cacheName);
EasyMock.expect(container.defineConfiguration(cacheName, templateCacheName, new Configuration())).andReturn(cacheConfiguration);
EasyMock.expect(container.getCache(cacheName)).andReturn(cache);
@@ -137,6 +137,10 @@
Assert.assertSame(mode, cacheConfiguration.getCacheMode());
Assert.assertEquals((config.getBackups() != null) ? config.getBackups().intValue() : 2, cacheConfiguration.getNumOwners());
+ if (fetchInMemoryState != null)
+ {
+ Assert.assertEquals(fetchInMemoryState, cacheConfiguration.isFetchInMemoryState());
+ }
this.control.reset();
}
More information about the jboss-cvs-commits
mailing list