[jboss-cvs] JBossAS SVN: r108008 - in projects/cluster/ha-server-cache-ispn/trunk/src: test/java/org/jboss/web/tomcat/service/sso/ispn and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 7 10:51:35 EDT 2010
Author: pferraro
Date: 2010-09-07 10:51:34 -0400 (Tue, 07 Sep 2010)
New Revision: 108008
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManagerTest.java
Log:
SSOValve specifies cache container name, not cache name.
Change container/cache delimiter to "/".
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java 2010-09-07 13:47:41 UTC (rev 108007)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java 2010-09-07 14:51:34 UTC (rev 108008)
@@ -141,12 +141,13 @@
/**
* The new members of the last view passed to viewChange()
*/
- private final Set<Object> currentView = new HashSet<Object>();;
+ private final Set<Object> currentView = new HashSet<Object>();
/** Mutex lock to ensure only one view change at a time is being processed */
private final Object cleanupMutex = new Object();
private final AtomicMapFactory atomicMapFactory;
+ private final CacheContainerRegistry registry;
// ------------------------------------------------------------ Properties
@@ -164,15 +165,16 @@
public SSOClusterManager()
{
- this(new DefaultAtomicMapFactory());
+ this(DefaultCacheContainerRegistry.getInstance(), new DefaultAtomicMapFactory());
}
/**
* This constructor is for unit testing
* @param atomicMapFactory
*/
- public SSOClusterManager(AtomicMapFactory atomicMapFactory)
+ public SSOClusterManager(CacheContainerRegistry registry, AtomicMapFactory atomicMapFactory)
{
+ this.registry = registry;
this.atomicMapFactory = atomicMapFactory;
}
@@ -725,13 +727,13 @@
throw new IllegalStateException("SSOClusterManagerImpl already Started");
}
- String containerName = null;
- String cacheName = this.ssoValve.getCacheConfig();
+ String containerName = this.ssoValve.getCacheConfig();
+ String cacheName = null;
- if ((cacheName != null) && !cacheName.trim().isEmpty())
+ if ((containerName != null) && !containerName.isEmpty())
{
- // Parse cache container name
- String[] parts = cacheName.split(":");
+ String[] parts = containerName.split("/");
+
if (parts.length == 2)
{
containerName = parts[0];
@@ -739,9 +741,8 @@
}
}
- CacheContainerRegistry registry = DefaultCacheContainerRegistry.getInstance();
- CacheContainer container = registry.getCacheContainer(containerName);
- this.cache = container.getCache(cacheName);
+ CacheContainer container = this.registry.getCacheContainer(containerName);
+ this.cache = (cacheName == null) ? container.<SSOKey, Object>getCache() : container.<SSOKey, Object>getCache(cacheName);
if (this.cache.getStatus() != ComponentStatus.RUNNING)
{
@@ -779,6 +780,7 @@
this.cache.removeListener(this);
+ // Only stop the cache if we started it
if (this.startedCache.compareAndSet(true, false))
{
this.cache.stop();
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManagerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManagerTest.java 2010-09-07 13:47:41 UTC (rev 108007)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManagerTest.java 2010-09-07 14:51:34 UTC (rev 108008)
@@ -15,6 +15,7 @@
import org.infinispan.Cache;
import org.infinispan.atomic.AtomicMap;
import org.jboss.ha.ispn.CacheContainerFactory;
+import org.jboss.ha.ispn.CacheContainerRegistry;
import org.jboss.ha.ispn.DefaultCacheContainerFactory;
import org.jboss.ha.ispn.DefaultCacheContainerRegistry;
import org.jboss.ha.ispn.atomic.AtomicMapFactory;
@@ -30,9 +31,8 @@
public class SSOClusterManagerTest
{
-
SSOClusterManager ssoManager;
- Cache<Object, AtomicMap<Object, Object>>cache;
+ Cache<Object, AtomicMap<Object, Object>> cache;
String ssoId;
FullyQualifiedSessionId fqs;
@@ -47,8 +47,9 @@
AtomicMapFactory atomicMapFactory = EasyMock.createNiceMock(AtomicMapFactory.class);
AtomicMap atomicMap = EasyMock.createMock(AtomicMap.class);
-
- ssoManager = new SSOClusterManager(atomicMapFactory);
+ CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
+
+ ssoManager = new SSOClusterManager(registry, atomicMapFactory);
cache = EasyMock.createMock(Cache.class);
SessionKey key = new SessionKey(ssoId);
More information about the jboss-cvs-commits
mailing list