[jboss-cvs] JBossAS SVN: r77705 - in trunk: cluster and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Aug 30 23:53:33 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-08-30 23:53:32 -0400 (Sat, 30 Aug 2008)
New Revision: 77705
Removed:
trunk/cluster/src/main/org/jboss/ha/cachemanager/
trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java
trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImplMBean.java
trunk/cluster/src/main/org/jboss/ha/jndi/impl/
trunk/cluster/src/main/org/jboss/ha/jndi/spi/
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/distributedcache/
trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/jbcintegration/
trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/spi/
Modified:
trunk/build/build-distr.xml
trunk/cluster/.classpath
trunk/cluster/build.xml
trunk/cluster/pom.xml
trunk/cluster/src/etc/cluster-jboss-beans.xml
trunk/cluster/src/etc/hajndi-jboss-beans.xml
trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingServiceMBean.java
trunk/component-matrix/pom.xml
trunk/testsuite/.classpath
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/CacheListenerUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml
trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml
trunk/testsuite/src/resources/naming/restart/naming-restart-jboss-beans.xml
trunk/thirdparty/pom.xml
trunk/tomcat/.classpath
trunk/tomcat/build.xml
trunk/tomcat/pom.xml
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/ClusteredSingleSignOn.java
Log:
[JBAS-5916] Remove the JBC integration SPIs and impls from the AS code base
Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/build/build-distr.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -1984,9 +1984,9 @@
</fileset>
<fileset dir="${org.jboss.cluster.lib}">
<include name="jboss-ha-client.jar"/>
- </fileset>
- <fileset dir="${org.jboss.cluster.lib}">
<include name="jboss-ha-server-api.jar"/>
+ <include name="jboss-ha-server-cache-spi.jar"/>
+ <include name="jboss-ha-server-cache-jbc.jar"/>
</fileset>
<fileset dir="${jboss.integration.lib}">
<include name="jboss-integration.jar"/>
Modified: trunk/cluster/.classpath
===================================================================
--- trunk/cluster/.classpath 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/.classpath 2008-08-31 03:53:32 UTC (rev 77705)
@@ -4,11 +4,13 @@
<classpathentry kind="src" path="src/examples"/>
<classpathentry exported="true" kind="src" path="/server"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar" sourcepath="/JGroups/src"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/apache-logging/lib/commons-logging.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/jboss-ha-client/lib/jboss-ha-client.jar" sourcepath="/thirdparty/jboss/jboss-ha-client/lib/jboss-ha-client-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/jboss-ha-server-api/lib/jboss-ha-server-api.jar" sourcepath="/thirdparty/jboss/jboss-ha-server-api/lib/jboss-ha-server-api-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-client.jar" sourcepath="/thirdparty/org/jboss/cluster/lib/jboss-ha-client-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-api.jar" sourcepath="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-api-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-spi.jar" sourcepath="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-spi-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-jbc.jar" sourcepath="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-jbc-sources.jar"/>
+ <!--<classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core.jar" sourcepath="/jbosscache-core/src/main/java"/>
+ <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo-sources.jar"/>-->
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/cluster/build.xml
===================================================================
--- trunk/cluster/build.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/build.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -77,8 +77,6 @@
<path refid="apache.log4j.classpath"/>
<path refid="junit.junit.classpath"/>
<path refid="jgroups.jgroups.classpath"/>
- <path refid="jboss.cache.jbosscache.core.classpath"/>
- <path refid="jboss.cache.jbosscache.pojo.classpath"/>
<path refid="org.jboss.cluster.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="jboss.remoting.classpath"/>
Modified: trunk/cluster/pom.xml
===================================================================
--- trunk/cluster/pom.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/pom.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -71,23 +71,23 @@
</dependency>
<dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-client</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-pojo</artifactId>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-client</artifactId>
+ <artifactId>jboss-ha-server-cache-spi</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-server-api</artifactId>
+ <artifactId>jboss-ha-server-cache-jbc</artifactId>
</dependency>
<dependency>
Modified: trunk/cluster/src/etc/cluster-jboss-beans.xml
===================================================================
--- trunk/cluster/src/etc/cluster-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/etc/cluster-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -9,7 +9,17 @@
<!-- ==================================================================== -->
<!-- Cluster Partition: defines cluster -->
<!-- ==================================================================== -->
-
+
+ <!--
+ HA services use a Cache for state management; this bean shields
+ HAPartition from having to directly use the JBoss Cache API.
+ -->
+ <bean name="HAPartitionCacheHandler"
+ class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
+ <property name="cacheManager"><inject bean="CacheManager"/></property>
+ <property name="cacheConfigName">ha-partition</property>
+ </bean>
+
<bean name="HAPartition"
class="org.jboss.ha.framework.server.ClusterPartition">
@@ -18,8 +28,7 @@
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HAPartition,partition=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">ha-partition</property>
+ <property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">${jboss.partition.name:DefaultPartition}</property>
@@ -46,7 +55,8 @@
<property name="distributedStateImpl">
<bean name="DistributedState"
class="org.jboss.ha.framework.server.DistributedStateImpl">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
+ <property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>
</bean>
</property>
Modified: trunk/cluster/src/etc/hajndi-jboss-beans.xml
===================================================================
--- trunk/cluster/src/etc/hajndi-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/etc/hajndi-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -22,7 +22,7 @@
<!-- Handler for the replicated tree -->
<property name="distributedTreeManager">
<bean class="org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager">
- <property name="clusteredCache"><inject bean="HAPartition" property="clusteredCache"/></property>
+ <property name="clusteredCache"><inject bean="HAPartitionCacheHandler" property="cache"/></property>
</bean>
</property>
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -46,8 +46,6 @@
import javax.naming.Reference;
import javax.naming.StringRefAddr;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheManager;
import org.jboss.ha.framework.interfaces.ClusterNode;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
import org.jboss.ha.framework.interfaces.DistributedState;
@@ -55,6 +53,8 @@
import org.jboss.ha.framework.interfaces.ResponseFilter;
import org.jboss.ha.framework.server.deployers.DefaultHAPartitionDependencyCreator;
import org.jboss.ha.framework.server.deployers.HAPartitionDependencyCreator;
+import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
+import org.jboss.ha.framework.server.spi.ManagedDistributedState;
import org.jboss.invocation.MarshalledValueInputStream;
import org.jboss.invocation.MarshalledValueOutputStream;
import org.jboss.kernel.spi.dependency.KernelController;
@@ -183,9 +183,8 @@
// Attributes ----------------------------------------------------
- private CacheManager cacheManager;
- private String cacheConfigName = DEFAULT_CACHE_CONFIG;
- private Cache cache;
+ private HAPartitionCacheHandler cacheHandler;
+ private String cacheConfigName;
private ChannelFactory channelFactory;
private String stackName;
private String partitionName = ServerConfigUtil.getDefaultPartitionName();
@@ -228,7 +227,7 @@
/** The cluster replicant manager */
protected DistributedReplicantManagerImpl replicantManager;
/** The DistributedState service we manage */
- protected DistributedStateImpl distributedState;
+ protected DistributedState distributedState;
/** The cluster instance log category */
protected Logger log = Logger.getLogger(HAPartition.class.getName());;
protected Logger clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle");
@@ -310,9 +309,9 @@
this.replicantManager.createService();
- if (this.distributedState != null)
+ if (this.distributedState instanceof ManagedDistributedState)
{
- this.distributedState.createService();
+ ((ManagedDistributedState) this.distributedState).createService();
}
// Create the asynchronous handler for view changes
@@ -329,9 +328,10 @@
{
this.logHistory ("Starting partition");
- this.cache = this.cacheManager.getCache(this.cacheConfigName, true);
- this.channelFactory = this.cache.getConfiguration().getRuntimeConfig().getMuxChannelFactory();
- this.stackName = this.cache.getConfiguration().getMultiplexerStack();
+ // Have the handler get the cache
+ this.cacheHandler.acquireCache();
+ this.channelFactory = this.cacheHandler.getCacheChannelFactory();
+ this.stackName = this.cacheHandler.getChannelStackName();
if (this.channel == null || !this.channel.isOpen())
{
@@ -374,7 +374,7 @@
this.threadPool.run(task);
}
- this.cache.start();
+ this.cacheHandler.startCache();
try
{
@@ -401,10 +401,9 @@
this.replicantManager.startService();
- if (this.distributedState != null)
+ if (this.distributedState instanceof ManagedDistributedState)
{
- this.distributedState.setClusteredCache(this.getClusteredCache());
- this.distributedState.startService();
+ ((ManagedDistributedState) this.distributedState).startService();
}
// Start the asynch listener handler thread
@@ -446,16 +445,16 @@
this.log.warn("Failed to stop asynchHandler", e);
}
- if (this.distributedState != null)
+ if (this.distributedState instanceof ManagedDistributedState)
{
- this.distributedState.stopService();
+ ((ManagedDistributedState) this.distributedState).stopService();
}
this.replicantManager.stopService();
try
{
- this.cacheManager.releaseCache(this.cacheConfigName);
+ this.cacheHandler.releaseCache();
}
catch (Exception e)
{
@@ -510,9 +509,9 @@
removeCanonicalAlias();
- if (this.distributedState != null)
+ if (this.distributedState instanceof ManagedDistributedState)
{
- this.distributedState.destroyService();
+ ((ManagedDistributedState) this.distributedState).destroyService();
}
this.replicantManager.destroyService();
@@ -1389,7 +1388,7 @@
// Public ------------------------------------------------------------------
- public void setDistributedStateImpl(DistributedStateImpl distributedState)
+ public void setDistributedStateImpl(DistributedState distributedState)
{
this.distributedState = distributedState;
}
@@ -1659,11 +1658,6 @@
buff.append("</events>\n");
return buff.toString();
}
-
- public Cache getClusteredCache()
- {
- return this.cache;
- }
/**
* Deprecated; always returns <code>false</code>.
@@ -1706,14 +1700,15 @@
return this.channelFactory;
}
- public CacheManager getCacheManager()
+ public HAPartitionCacheHandler getCacheHandler()
{
- return this.cacheManager;
+ return this.cacheHandler;
}
- public void setCacheManager(CacheManager cacheManager)
+ public void setCacheHandler(HAPartitionCacheHandler cacheHandler)
{
- this.cacheManager = cacheManager;
+ this.cacheHandler = cacheHandler;
+ this.cacheConfigName = cacheHandler == null ? null : cacheHandler.getCacheConfigName();
}
public String getCacheConfigName()
@@ -1721,11 +1716,6 @@
return this.cacheConfigName;
}
- public void setCacheConfigName(String cacheConfigName)
- {
- this.cacheConfigName = cacheConfigName;
- }
-
public String getChannelStackName()
{
return this.stackName;
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -26,8 +26,6 @@
import javax.management.ObjectName;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheManager;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
import org.jboss.ha.framework.interfaces.DistributedState;
import org.jboss.ha.framework.interfaces.HAPartition;
@@ -141,24 +139,12 @@
DistributedState getDistributedStateService();
/**
- * Gets the CacheManager from which we get our cache.
- *
- * @return the cache manager
- */
- CacheManager getCacheManager();
-
- /**
* Gets the configuration name under which our cache is registered
* with the cache manager.
*/
String getCacheConfigName();
/**
- * Gets the JBoss Cache used by this partition for state management.
- */
- Cache getClusteredCache();
-
- /**
* Gets the JGroups channel factory used by ClusterPartition.
*/
ChannelFactory getChannelFactory();
Deleted: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -1,518 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.framework.server;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType;
-import org.jboss.logging.Logger;
-
-/**
- * This class manages distributed state across the cluster.
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
- at CacheListener
-public class DistributedStateImpl implements DistributedStateImplMBean
-{
- // Constants -----------------------------------------------------
-
- public static final String ROOT = "__DISTRIBUTED_STATE__";
- public static final Fqn ROOTFQN = Fqn.fromElements(ROOT);
- public static final int ROOTFQNSIZE = ROOTFQN.size();
-
- protected static final String SERVICE_NAME = "DistributedState";
-
- // Attributes ----------------------------------------------------
-
- protected Map<String, List<Object>> keyListeners = new HashMap<String, List<Object>>();
- protected Logger log = Logger.getLogger(this.getClass());
- protected String name = null;
- protected Cache cache;
- protected boolean replAsync;
-
- // Public --------------------------------------------------------
-
- protected void createService()
- {
- }
-
- public void startService()
- {
- if (this.cache == null)
- {
- throw new IllegalStateException("No clustered cache available");
- }
-
- this.cache.addCacheListener(this);
- }
-
- public void stopService()
- {
- this.cache.removeCacheListener(this);
- }
-
- public void destroyService() throws Exception
- {
- }
-
- public String listContent() throws Exception
- {
- StringBuilder result = new StringBuilder();
- Collection cats = this.getAllCategories();
- if (cats == null) return result.toString();
-
- Iterator catsIter = cats.iterator();
- while (catsIter.hasNext())
- {
- String category = (String) catsIter.next();
- Iterator keysIter = this.getAllKeys(category).iterator();
-
- result.append("-----------------------------------------------\n");
- result.append("Logger : ").append(category).append("\n\n");
- result.append("KEY\t:\tVALUE\n");
-
- while (keysIter.hasNext())
- {
- Serializable key = (Serializable) keysIter.next();
- String value = this.get(category, key).toString();
- result.append("'").append(key);
- result.append("'\t:\t'");
- result.append(value);
- result.append("'\n");
- }
- result.append("\n");
- }
- return result.toString();
- }
-
- public String listXmlContent() throws Exception
- {
- StringBuilder result = new StringBuilder();
- result.append("<DistributedState>\n");
- Collection cats = this.getAllCategories();
- if (cats != null)
- {
- Iterator catsIter = cats.iterator();
- while (catsIter.hasNext())
- {
- String category = (String) catsIter.next();
- Iterator keysIter = this.getAllKeys(category).iterator();
-
- result.append("\t<Logger>\n");
- result.append("\t\t<LoggerName>").append(category).append("</LoggerName>\n");
-
- while (keysIter.hasNext())
- {
- Serializable key = (Serializable) keysIter.next();
- String value = this.get(category, key).toString();
- result.append("\t\t<Entry>\n");
- result.append("\t\t\t<Key>").append(key).append("</Key>\n");
- result.append("\t\t\t<Value>").append(value).append("</Value>\n");
- result.append("\t\t</Entry>\n");
- }
- result.append("\t</Logger>\n");
- }
- }
-
- result.append("</DistributedState>\n");
-
- return result.toString();
- }
-
- public Cache getClusteredCache()
- {
- return this.cache;
- }
-
- /**
- * Sets the cache to use.
- *
- * @param cache the cache
- *
- * @throws IllegalStateException if the cache isn't configured for replication
- */
- public void setClusteredCache(Cache<Serializable, Serializable> cache)
- {
- this.cache = cache;
- if (this.cache != null)
- {
- CacheMode cm = cache.getConfiguration().getCacheMode();
- if (CacheMode.REPL_ASYNC == cm)
- {
- this.replAsync = true;
- }
- else if (CacheMode.REPL_SYNC == cm)
- {
- this.replAsync = false;
- }
- else
- {
- throw new IllegalStateException("Cache must be configured for replication, not " + cm);
- }
- }
- }
-
- // DistributedState implementation ----------------------------------------------
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
- * java.io.Serializable, java.io.Serializable)
- */
- public void set(String category, Serializable key, Serializable value) throws Exception
- {
- this.set(category, key, value, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#set(java.lang.String,
- * java.io.Serializable, java.io.Serializable, boolean) @param
- * asynchronousCall is not supported yet. TreeCache cannot switch this
- * on the fly. Will take value from TreeCache-config instead.
- */
- public void set(String category, Serializable key, Serializable value, boolean asynchronousCall) throws Exception
- {
- if (this.replAsync != asynchronousCall)
- {
- if (asynchronousCall)
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
- }
- else
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
- }
- }
- this.cache.put(this.buildFqn(category), key, value);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
- * java.io.Serializable) @return - returns null in case of
- * CacheException
- */
- public Serializable remove(String category, Serializable key) throws Exception
- {
- return this.remove(category, key, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#remove(java.lang.String,
- * java.io.Serializable, boolean)
- */
- public Serializable remove(String category, Serializable key, boolean asynchronousCall) throws Exception
- {
- Serializable retVal = this.get(category, key);
- if (retVal != null)
- {
- if (this.replAsync != asynchronousCall)
- {
- if (asynchronousCall)
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
- }
- else
- {
- this.cache.getInvocationContext().getOptionOverrides().setForceSynchronous(true);
- }
- }
- this.cache.remove(this.buildFqn(category), key);
- }
- return retVal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#get(java.lang.String,
- * java.io.Serializable)
- */
- public Serializable get(String category, Serializable key)
- {
- try
- {
- return (Serializable) this.cache.get(this.buildFqn(category), key);
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- public Collection getAllCategories()
- {
- try
- {
- Node base = this.cache.getRoot().getChild(ROOTFQN);
- Collection keys = (base == null ? null : base.getChildrenNames());
- if (keys != null && keys.size() > 0)
- {
- keys = Collections.unmodifiableCollection(keys);
- }
- return keys;
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#getAllKeys(java.lang.String)
- * @return - returns null in case of CacheException
- */
- public Collection getAllKeys(String category)
- {
- try
- {
- Node<Serializable, Serializable> node = this.getNode(category);
- if (node == null) return null;
- return node.getKeys();
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.ha.framework.interfaces.DistributedState#getAllValues(java.lang.String)
- * @return - returns null in case of CacheException
- */
- public Collection getAllValues(String category)
- {
- try
- {
- Node categoryNode = this.getNode(category);
- if (categoryNode == null) return null;
- Set childNodes = categoryNode.getKeys();
- if (childNodes == null) return null;
- Map entries = categoryNode.getData();
- if (entries == null) return null;
- Collection retVal = new HashSet(entries.values());
- return Collections.unmodifiableCollection(retVal);
- }
- catch (CacheException ce)
- {
- return null;
- }
- }
-
- public void registerDSListenerEx(String category, DSListenerEx subscriber)
- {
- this.registerListener(category, subscriber);
- }
-
- public void unregisterDSListenerEx(String category, DSListenerEx subscriber)
- {
- this.unregisterListener(category, subscriber);
- }
-
- public void registerDSListener(String category, DSListener subscriber)
- {
- this.registerListener(category, subscriber);
- }
-
- public void unregisterDSListener(String category, DSListener subscriber)
- {
- this.unregisterListener(category, subscriber);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- protected void registerListener(String category, Object subscriber)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null)
- {
- listeners = new ArrayList<Object>();
- this.keyListeners.put(category, listeners);
- }
- listeners.add(subscriber);
- }
- }
-
- protected void unregisterListener(String category, Object subscriber)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
-
- listeners.remove(subscriber);
- if (listeners.size() == 0)
- {
- this.keyListeners.remove(category);
- }
- }
- }
-
- protected void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
- String strKey = key.toString();
-
- for (Object listener: listeners)
- {
- if (listener instanceof DSListener)
- {
- DSListener dslistener = (DSListener) listener;
- dslistener.valueHasChanged(category, strKey, value, locallyModified);
- }
- else
- {
- DSListenerEx dslistener = (DSListenerEx) listener;
- dslistener.valueHasChanged(category, key, value, locallyModified);
- }
- }
- }
- }
-
- protected void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent,
- boolean locallyModified)
- {
- synchronized (this.keyListeners)
- {
- List<Object> listeners = this.keyListeners.get(category);
- if (listeners == null) return;
- String strKey = key.toString();
-
- for (Object listener: listeners)
- {
- if (listener instanceof DSListener)
- {
- DSListener dslistener = (DSListener) listener;
- dslistener.keyHasBeenRemoved(category, strKey, oldContent, locallyModified);
- }
- else
- {
- DSListenerEx dslistener = (DSListenerEx) listener;
- dslistener.keyHasBeenRemoved(category, key, oldContent, locallyModified);
- }
- }
- }
- }
-
- protected void cleanupKeyListeners()
- {
- // NOT IMPLEMENTED YET
- }
-
- /** ExtendedTreeCacheListener methods */
-
- // Private -------------------------------------------------------
- protected Fqn buildFqn(String category)
- {
- return Fqn.fromRelativeElements(ROOTFQN, category);
- }
-
- protected Fqn buildFqn(String category, Serializable key)
- {
- return Fqn.fromElements(ROOT, category, key);
- }
-
- protected Fqn buildFqn(String category, Serializable key, Serializable value)
- {
- return Fqn.fromElements(ROOT, category, key, value);
- }
-
- protected Node getNode(String category) throws CacheException
- {
- return this.cache.getRoot().getChild(this.buildFqn(category));
- }
-
- // @CacheListener -------------------------------------------------
-
- @NodeModified
- public void nodeModified(NodeModifiedEvent event)
- {
- if (event.isPre()) return;
-
- // we're only interested in put and remove data operations
- ModificationType modType = event.getModificationType();
- if (!modType.equals(ModificationType.PUT_DATA) && !modType.equals(ModificationType.REMOVE_DATA)) return;
-
- // ignore changes for other roots in a shared cache
- Fqn fqn = event.getFqn();
- if (!fqn.isChildOf(ROOTFQN)) return;
-
- Serializable key = null;
- Serializable value = null;
-
- // there should be exactly one key/value pair in the map
- Map data = event.getData();
- if (data != null && !data.isEmpty())
- {
- key = (Serializable) data.keySet().iterator().next();
- value = (Serializable) data.get(key);
- }
-
- if (modType.equals(ModificationType.PUT_DATA))
- {
- DistributedStateImpl.this.notifyKeyListeners((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
- }
- else
- {
- DistributedStateImpl.this.notifyKeyListenersOfRemove((String) fqn.get(ROOTFQNSIZE), key, value, event.isOriginLocal());
- }
- }
-
-}
Deleted: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImplMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImplMBean.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImplMBean.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.framework.server;
-
-
-/**
- * MBean interface for the Distributed State (DS) service
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision$
- *
- * <p><b>Revisions:</b>
- *
- * <p><b>29. d�cembre 2001 Sacha Labourey:</b>
- * <ul>
- * <li> First implementation </li>
- * </ul>
- */
-public interface DistributedStateImplMBean
- extends org.jboss.ha.framework.interfaces.DistributedState
-{
- String listContent () throws Exception;
- String listXmlContent () throws Exception;
-}
Modified: trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingServiceMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingServiceMBean.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingServiceMBean.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -25,9 +25,7 @@
import java.net.UnknownHostException;
import java.util.Map;
import javax.management.ObjectName;
-import javax.naming.Binding;
-import org.jboss.cache.Cache;
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.jndi.spi.DistributedTreeManager;
import org.jboss.invocation.Invocation;
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/component-matrix/pom.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -59,6 +59,7 @@
<version.org.jboss.cache.core>2.2.0.GA</version.org.jboss.cache.core>
<version.org.jboss.cache.pojo>2.2.0.CR5</version.org.jboss.cache.pojo>
<version.org.jboss.cluster>1.1.0.GA</version.org.jboss.cluster>
+ <version.org.jboss.cluster.cache>1.0.0.CR1</version.org.jboss.cluster.cache>
<version.org.jboss.deployers>2.0.0.Beta21</version.org.jboss.deployers>
<version.org.jboss.integration>5.0.0.CR2</version.org.jboss.integration>
<version.org.jboss.jbossxb>2.0.0.CR12</version.org.jboss.jbossxb>
@@ -1267,6 +1268,58 @@
</dependency>
<dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-spi</artifactId>
+ <version>${version.org.jboss.cluster.cache}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnp-client</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-serialization</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-jbc</artifactId>
+ <version>${version.org.jboss.cluster.cache}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-pojo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnp-client</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-client</artifactId>
<version>${version.org.jboss.deployers}</version>
Modified: trunk/testsuite/.classpath
===================================================================
--- trunk/testsuite/.classpath 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/.classpath 2008-08-31 03:53:32 UTC (rev 77705)
@@ -35,7 +35,11 @@
<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-remoting-aspects.jar"/>
<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-security-aspects.jar"/>
<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-transaction-aspects.jar"/>
- <classpathentry kind="lib" path="/thirdparty/hibernate/lib/hibernate-core.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/org/jboss/cluster/lib/jboss-ha-server-cache-jbc.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/hibernate/lib/hibernate-core.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-ejb3-security/lib/jboss-ejb3-security.jar" sourcepath="/thirdparty/jboss/jboss-ejb3-security/lib/jboss-ejb3-security-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/stax-api/lib/stax-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-ejb3-proxy/lib/jboss-ejb3-proxy-client.jar"/>
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/CacheListenerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/CacheListenerUnitTestCase.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/CacheListenerUnitTestCase.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -26,14 +26,16 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.CacheListener;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.CacheListenerBase;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.FieldBasedJBossCacheService;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.JBossCacheService;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.CacheListener;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.CacheListenerBase;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.FieldBasedJBossCacheService;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.JBossCacheService;
/**
* A CacheListenerUnitTestCase.
*
+ * FIXME: Move this to the ha-server-cache-jbc project
+ *
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
* @version $Revision$
*/
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -43,7 +43,8 @@
import org.jboss.test.cluster.web.mocks.MutableObject;
import org.jboss.test.cluster.web.mocks.SetAttributesRequestHandler;
import org.jboss.web.tomcat.service.session.JBossCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.JBossCacheService;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.JBossCacheService;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
/**
* Tests of handling of ClusteredSession.maxUnreplicatedInterval. This base
@@ -238,8 +239,8 @@
jbcm1.backgroundProcess();
// Confirm they are still there
// FIXME -- avoid direct cache operations
- assertNotNull(pojoCaches[1].getCache().get(session1Fqn, JBossCacheService.VERSION_KEY));
- assertNotNull(pojoCaches[1].getCache().get(session2Fqn, JBossCacheService.VERSION_KEY));
+ assertNotNull(pojoCaches[1].getCache().get(session1Fqn, DistributedCacheManager.VERSION_KEY));
+ assertNotNull(pojoCaches[1].getCache().get(session2Fqn, DistributedCacheManager.VERSION_KEY));
// Access one to prove it gets expired once the manager can see its real timestamp
BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -27,6 +27,7 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
+import org.apache.catalina.Container;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Manager;
import org.apache.catalina.Session;
@@ -58,7 +59,7 @@
import org.jboss.test.cluster.web.mocks.MockHost;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn;
-import org.jboss.web.tomcat.service.sso.jbcintegration.TreeCacheSSOClusterManager;
+import org.jboss.web.tomcat.service.sso.jbc.JBossCacheSSOClusterManager;
import org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId;
import org.jgroups.Address;
import org.jgroups.View;
@@ -66,7 +67,7 @@
import org.jgroups.stack.IpAddress;
/**
- * Test of the TreeCacheSSOClusterManager class.
+ * Test of the JBossCacheSSOClusterManager class.
*
* @author Brian Stansberry
*/
@@ -144,10 +145,10 @@
wrapper.start();
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(CACHE_OBJECT_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(mbeanServer);
+ localValve.setCacheConfig(CACHE_OBJECT_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
localSSOManager.start();
@@ -157,11 +158,11 @@
Manager localSessMgr1 = getSessionManager("A");
Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess1));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
Manager localSessMgr2 = getSessionManager("B");
Session sess2 = new MockSession(localSessMgr2, "2");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess2));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
// Confirm that data is cached properly
assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
@@ -202,10 +203,10 @@
wrapper.start();
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(CACHE_OBJECT_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(mbeanServer);
+ localValve.setCacheConfig(CACHE_OBJECT_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
localSSOManager.start();
@@ -215,11 +216,11 @@
Manager localSessMgr1 = getSessionManager("A");
Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess1));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
Manager localSessMgr2 = getSessionManager("B");
Session sess2 = new MockSession(localSessMgr2, "2");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess2));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
// Confirm that data is cached properly
assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
@@ -258,10 +259,10 @@
cacheManager.registerPojoCache(pc, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(mbeanServer);
+ localValve.setCacheConfig(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
localSSOManager.start();
@@ -271,16 +272,18 @@
Manager localSessMgr1 = getSessionManager("A");
Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess1));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
Manager localSessMgr2 = getSessionManager("B");
Session sess2 = new MockSession(localSessMgr2, "2");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess2));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
// Confirm that data is cached properly
assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
}
+ // Disabled; buddy replication is acceptable
+ /*
public void testDisallowBuddyReplication() throws Exception
{
log.debug("+++ testDisallowBuddyReplication()");
@@ -293,6 +296,7 @@
buddyReplicationConfigTest(false);
}
+
private void buddyReplicationConfigTest(boolean enabled) throws Exception
{
CacheManager cacheManager = getCacheManager();
@@ -315,10 +319,10 @@
cacheManager.registerCache(cache, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(null);
- localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(null);
+ localValve.setCacheConfig(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
@@ -327,7 +331,7 @@
localSSOManager.start();
if (enabled)
{
- fail("TreeCacheSSOClusterManager should not start with buddy replication enabled");
+ fail("JBossCacheSSOClusterManager should not start with buddy replication enabled");
}
}
catch (LifecycleException le)
@@ -341,7 +345,8 @@
// else we shouldn't start
}
}
-
+ */
+
public void testDeadMemberCleanupWithPool() throws Exception
{
log.debug("+++ testDeadMemberCleanupWithPool()");
@@ -373,14 +378,14 @@
if (usePool)
{
BasicThreadPool pool = new BasicThreadPool();
- mbeanServer.registerMBean(pool, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_THREAD_POOL_NAME));
+ mbeanServer.registerMBean(pool, new ObjectName(JBossCacheSSOClusterManager.DEFAULT_THREAD_POOL_NAME));
}
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(mbeanServer);
+ localValve.setCacheConfig(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
localSSOManager.start();
@@ -392,10 +397,10 @@
// so it thinks it's a different address when it starts
cache.setOurAddress(REMOTE_ADDRESS);
- TreeCacheSSOClusterManager remoteSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- remoteSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+ JBossCacheSSOClusterManager remoteSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve remoteValve = new MockSSOValve();
+ MockSSOValve remoteValve = new MockSSOValve(mbeanServer);
+ remoteValve.setCacheConfig(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
remoteValve.setClusterManager(remoteSSOManager);
remoteSSOManager.setSSOLocalManager(localValve);
remoteSSOManager.start();
@@ -406,11 +411,11 @@
Manager localSessMgr1 = getSessionManager("A");
Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess1));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
Manager remoteSessMgr1 = getSessionManager("B");
Session sess2 = new MockSession(remoteSessMgr1, "2");
- remoteSSOManager.addSession("1", new FullyQualifiedSessionId(sess2));
+ remoteSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
// Create another SSO with sessions only from remote
@@ -418,11 +423,11 @@
Manager remoteSessMgr2 = getSessionManager("C");
Session sess3 = new MockSession(remoteSessMgr2, "3");
- remoteSSOManager.addSession("2", new FullyQualifiedSessionId(sess3));
+ remoteSSOManager.addSession("2", getFullyQualifiedSessionId(sess3));
Manager remoteSessMgr3 = getSessionManager("D");
Session sess4 = new MockSession(remoteSessMgr3, "4");
- remoteSSOManager.addSession("2", new FullyQualifiedSessionId(sess4));
+ remoteSSOManager.addSession("2", getFullyQualifiedSessionId(sess4));
// Create a third SSO that will have sessions from both valves
@@ -431,11 +436,11 @@
Manager localSessMgr2 = getSessionManager("E");
Session sess5 = new MockSession(localSessMgr2, "5");
- localSSOManager.addSession("3", new FullyQualifiedSessionId(sess5));
+ localSSOManager.addSession("3", getFullyQualifiedSessionId(sess5));
Manager remoteSessMgr4 = getSessionManager("E");
Session sess6 = new MockSession(remoteSessMgr4, "5");
- remoteSSOManager.addSession("3", new FullyQualifiedSessionId(sess6));
+ remoteSSOManager.addSession("3", getFullyQualifiedSessionId(sess6));
// Create a fourth SSO that will have two sessions from local valve
@@ -443,11 +448,11 @@
Manager localSessMgr3 = getSessionManager("F");
Session sess7 = new MockSession(localSessMgr3, "7");
- localSSOManager.addSession("4", new FullyQualifiedSessionId(sess7));
+ localSSOManager.addSession("4", getFullyQualifiedSessionId(sess7));
Manager localSessMgr4 = getSessionManager("G");
Session sess8 = new MockSession(localSessMgr4, "8");
- localSSOManager.addSession("4", new FullyQualifiedSessionId(sess8));
+ localSSOManager.addSession("4", getFullyQualifiedSessionId(sess8));
// Create a fifth SSO with sessions only from remote, same session id
@@ -456,11 +461,11 @@
Manager remoteSessMgr5 = getSessionManager("H");
Session sess9 = new MockSession(remoteSessMgr5, "9");
- remoteSSOManager.addSession("5", new FullyQualifiedSessionId(sess9));
+ remoteSSOManager.addSession("5", getFullyQualifiedSessionId(sess9));
Manager remoteSessMgr6 = getSessionManager("I");
Session sess10 = new MockSession(remoteSessMgr6, "9");
- remoteSSOManager.addSession("5", new FullyQualifiedSessionId(sess10));
+ remoteSSOManager.addSession("5", getFullyQualifiedSessionId(sess10));
// Confirm that data is cached properly
assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
@@ -515,10 +520,10 @@
cacheManager.registerCache(cache, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
// Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+ JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
- MockSSOValve localValve = new MockSSOValve();
+ MockSSOValve localValve = new MockSSOValve(mbeanServer);
+ localValve.setCacheConfig(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
localValve.setClusterManager(localSSOManager);
localSSOManager.setSSOLocalManager(localValve);
localSSOManager.start();
@@ -529,15 +534,15 @@
Manager localSessMgr1 = getSessionManager("A");
Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess1));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
Manager localSessMgr2 = getSessionManager("B");
Session sess2 = new MockSession(localSessMgr2, "1");
- localSSOManager.addSession("1", new FullyQualifiedSessionId(sess2));
+ localSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
assertEquals(2, localSSOManager.getSessionCount("1"));
- localSSOManager.removeSession("1", new FullyQualifiedSessionId(sess2));
+ localSSOManager.removeSession("1", getFullyQualifiedSessionId(sess2));
assertEquals(1, localSSOManager.getSessionCount("1"));
}
@@ -569,7 +574,18 @@
return mgr;
}
+ private FullyQualifiedSessionId getFullyQualifiedSessionId(Session session)
+ {
+ String id = session.getIdInternal();
+ Container context = session.getManager().getContainer();
+ String contextName = context.getName();
+ Container host = context.getParent();
+ String hostName = host.getName();
+
+ return new FullyQualifiedSessionId(id, contextName, hostName);
+ }
+
static class MockTreeCache extends DelegatingMockCache
{
private IpAddress ourAddress = LOCAL_ADDRESS;
@@ -607,7 +623,20 @@
*/
static class MockSSOValve extends ClusteredSingleSignOn
{
+ private final MBeanServer mbeanServer;
+
+ MockSSOValve(MBeanServer server)
+ {
+ this.mbeanServer = server;
+ }
+
@Override
+ public MBeanServer getMBeanServer()
+ {
+ return mbeanServer;
+ }
+
+ @Override
public void notifySSOEmpty(String ssoId)
{
// no-op
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -32,6 +32,7 @@
import junit.framework.Test;
+//import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration;
import org.jboss.ha.cachemanager.CacheManager;
import org.jboss.ha.cachemanager.DependencyInjectedConfigurationRegistry;
@@ -42,7 +43,9 @@
import org.jboss.ha.framework.server.ClusterPartition;
import org.jboss.ha.framework.server.DistributedReplicantManagerImpl;
import org.jboss.ha.framework.server.DistributedStateImpl;
+import org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl;
import org.jboss.ha.framework.server.JChannelFactory;
+import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
import org.jboss.logging.Logger;
import org.jboss.test.JBossClusteredTestCase;
import org.jboss.test.cluster.hapartition.drm.MockHAPartition;
@@ -538,14 +541,18 @@
CacheManager cacheManager1 = new CacheManager(registry1, factory1);
+ HAPartitionCacheHandlerImpl cacheHandler1 = new HAPartitionCacheHandlerImpl();
+ cacheHandler1.setCacheManager(cacheManager1);
+ cacheHandler1.setCacheConfigName("config1");
+
DistributedStateImpl ds1 = new DistributedStateImpl();
+ ds1.setCacheHandler(cacheHandler1);
DistributedReplicantManagerImpl drm1 = new DistributedReplicantManagerImpl();
partition1 = new ClusterPartition();
partition1.setPartitionName(partitionName);
- partition1.setCacheManager(cacheManager1);
- partition1.setCacheConfigName("config1");
+ partition1.setCacheHandler(cacheHandler1);
partition1.setStateTransferTimeout(30000);
partition1.setMethodCallTimeout(60000);
partition1.setDistributedReplicantManagerImpl(drm1);
@@ -578,14 +585,18 @@
CacheManager cacheManager2 = new CacheManager(registry2, factory2);
+ HAPartitionCacheHandlerImpl cacheHandler2 = new HAPartitionCacheHandlerImpl();
+ cacheHandler2.setCacheManager(cacheManager2);
+ cacheHandler2.setCacheConfigName("config2");
+
DistributedStateImpl ds2 = new DistributedStateImpl();
+ ds2.setCacheHandler(cacheHandler2);
DistributedReplicantManagerImpl drm2 = new DistributedReplicantManagerImpl();
partition2 = new ClusterPartition();
partition2.setPartitionName(partitionName);
- partition2.setCacheManager(cacheManager2);
- partition2.setCacheConfigName("config2");
+ partition2.setCacheHandler(cacheHandler2);
partition2.setStateTransferTimeout(30000);
partition2.setMethodCallTimeout(60000);
partition2.setDistributedReplicantManagerImpl(drm2);
Modified: trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -101,13 +101,15 @@
</bean>
<!-- ==================================================================== -->
- <!-- DistributedState Service, a legacy wrapper around JBoss Cache -->
- <!-- ==================================================================== -->
-
- <!-- ==================================================================== -->
<!-- Cluster Partition: defines cluster -->
<!-- ==================================================================== -->
+ <bean name="PassExpCacheHandler"
+ class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
+ <property name="cacheManager"><inject bean="CacheManager"/></property>
+ <property name="cacheConfigName">passexp-partition</property>
+ </bean>
+
<bean name="PassExpPartition"
class="org.jboss.ha.framework.server.ClusterPartition">
@@ -118,8 +120,7 @@
<demand>PassExpPartitionCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">passexp-partition</property>
+ <property name="cacheHandler"><inject bean="PassExpCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">PassExpPartition</property>
@@ -143,7 +144,8 @@
<bean name="PassExpDistributedState"
class="org.jboss.ha.framework.server.DistributedStateImpl">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=PassExpPartition", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
- </bean>
+ <property name="cacheHandler"><inject bean="PassExpCacheHandler"/></property>
+ </bean>
</property>
</bean>
@@ -184,7 +186,7 @@
<!-- Handler for the replicated tree -->
<property name="distributedTreeManager">
<bean class="org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager">
- <property name="clusteredCache"><inject bean="PassExpPartition" property="clusteredCache"/></property>
+ <property name="clusteredCache"><inject bean="PassExpCacheHandler" property="cache"/></property>
</bean>
</property>
Modified: trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -320,7 +320,13 @@
<!-- ==================================================================== -->
<!-- Partition used for testing failure to receive state -->
- <!-- ==================================================================== -->
+ <!-- ==================================================================== -->
+
+ <bean name="ElectionPolicyCacheHandler"
+ class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
+ <property name="cacheManager"><inject bean="CacheManager"/></property>
+ <property name="cacheConfigName">election-policy</property>
+ </bean>
<bean name="ElectionPolicyTestPartition"
class="org.jboss.ha.framework.server.ClusterPartition">
@@ -328,8 +334,7 @@
<demand>ElectionPolicyCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">election-policy</property>
+ <property name="cacheHandler"><inject bean="ElectionPolicyCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">ElectionPolicyTestPartition</property>
Modified: trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -71,8 +71,15 @@
<property name="exposeManagementStatistics">true</property>
- </bean>
+ </bean>
+ <bean name="HAPartitionStateTransferTestCacheHandler"
+ class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
+ <property name="cacheManager"><inject bean="CacheManager"/></property>
+ <property name="cacheConfigName">ha-partition-state-transfer</property>
+ </bean>
+
+
<!-- ==================================================================== -->
<!-- Partition used for testing failure to receive state -->
<!-- ==================================================================== -->
@@ -91,8 +98,7 @@
<demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">ha-partition-state-transfer</property>
+ <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">BadProviderPartition</property>
@@ -153,8 +159,7 @@
<demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">ha-partition-state-transfer</property>
+ <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">BadStatePartition</property>
@@ -213,8 +218,7 @@
<demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">ha-partition-state-transfer</property>
+ <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">NoStatePartition</property>
@@ -256,8 +260,7 @@
<demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">ha-partition-state-transfer</property>
+ <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">GoodStatePartition</property>
Modified: trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -90,13 +90,15 @@
</bean>
<!-- ==================================================================== -->
- <!-- DistributedState Service, a legacy wrapper around JBoss Cache -->
+ <!-- Cluster Partition: defines cluster -->
<!-- ==================================================================== -->
- <!-- ==================================================================== -->
- <!-- Cluster Partition: defines cluster -->
- <!-- ==================================================================== -->
-
+ <bean name="RestartCacheHandler"
+ class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
+ <property name="cacheManager"><inject bean="CacheManager"/></property>
+ <property name="cacheConfigName">restart-partition</property>
+ </bean>
+
<bean name="RestartPartition"
class="org.jboss.ha.framework.server.ClusterPartition">
@@ -107,8 +109,7 @@
<demand>RestartPartitionCacheConfigSupply</demand>
<!-- ClusterPartition requires a Cache for state management -->
- <property name="cacheManager"><inject bean="CacheManager"/></property>
- <property name="cacheConfigName">restart-partition</property>
+ <property name="cacheHandler"><inject bean="RestartCacheHandler"/></property>
<!-- Name of the partition being built -->
<property name="partitionName">RestartPartition</property>
@@ -131,7 +132,8 @@
<property name="distributedStateImpl">
<bean name="RestartDistributedState"
class="org.jboss.ha.framework.server.DistributedStateImpl">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=RestartPartition", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=RestartPartition", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
+ <property name="cacheHandler"><inject bean="RestartCacheHandler"/></property>
</bean>
</property>
@@ -173,7 +175,7 @@
<!-- Handler for the replicated tree -->
<property name="distributedTreeManager">
<bean class="org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager">
- <property name="clusteredCache"><inject bean="RestartPartition" property="clusteredCache"/></property>
+ <property name="clusteredCache"><inject bean="RestartCacheHandler" property="cache"/></property>
</bean>
</property>
Modified: trunk/testsuite/src/resources/naming/restart/naming-restart-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/naming/restart/naming-restart-jboss-beans.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/testsuite/src/resources/naming/restart/naming-restart-jboss-beans.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -54,7 +54,7 @@
<!-- Handler for the replicated tree -->
<property name="distributedTreeManager">
<bean class="org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager">
- <property name="clusteredCache"><inject bean="HAPartition" property="clusteredCache"/></property>
+ <property name="clusteredCache"><inject bean="HAPartitionCacheHandler" property="cache"/></property>
</bean>
</property>
Modified: trunk/thirdparty/pom.xml
===================================================================
--- trunk/thirdparty/pom.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/thirdparty/pom.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -1572,6 +1572,22 @@
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-server-manager</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-jbc</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.cluster</groupId>
Modified: trunk/tomcat/.classpath
===================================================================
--- trunk/tomcat/.classpath 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/.classpath 2008-08-31 03:53:32 UTC (rev 77705)
@@ -9,8 +9,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/sun-servlet/lib/jsp-api.jar"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/apache-logging/lib/commons-logging.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo-sources.jar"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/jboss/jboss-ha-server-api/lib/jboss-ha-server-api.jar"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar"/>
<classpathentry exported="true" kind="lib" path="/thirdparty/sun-jsf/lib/jsf-api.jar"/>
Modified: trunk/tomcat/build.xml
===================================================================
--- trunk/tomcat/build.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/build.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -98,8 +98,6 @@
<path refid="jboss.security.int.classpath"/>
<path refid="jboss.server.classpath"/>
<path refid="jboss.j2se.classpath"/>
- <path refid="jboss.cache.jbosscache.core.classpath"/>
- <path refid="jboss.cache.jbosscache.pojo.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="jboss.aspects.classpath"/>
<path refid="jboss.jca.classpath"/>
Modified: trunk/tomcat/pom.xml
===================================================================
--- trunk/tomcat/pom.xml 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/pom.xml 2008-08-31 03:53:32 UTC (rev 77705)
@@ -65,16 +65,6 @@
<artifactId>jta</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
</dependency>
@@ -97,10 +87,6 @@
<artifactId>jbosssx-client</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-pojo</artifactId>
- </dependency>
- <dependency>
<groupId>jboss.web</groupId>
<artifactId>jbossweb</artifactId>
</dependency>
@@ -198,6 +184,14 @@
<dependency>
<groupId>org.jboss.cluster</groupId>
<artifactId>jboss-ha-server-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-server-cache-jbc</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -372,7 +372,7 @@
this.metadata.setId(id);
this.metadata.setCreationTime(creationTime);
this.metadata.setMaxInactiveInterval(maxInactiveInterval);
- this.metadata.setInvalidationPolicy(invalidationPolicy);
+// this.metadata.setInvalidationPolicy(invalidationPolicy);
this.metadata.setNew(isNew);
this.metadata.setValid(isValid);
@@ -1099,7 +1099,7 @@
this.maxInactiveInterval = metadata.getMaxInactiveInterval();
this.isNew = metadata.isNew();
this.isValid = metadata.isValid();
- this.invalidationPolicy = metadata.getInvalidationPolicy();
+// this.invalidationPolicy = metadata.getInvalidationPolicy();
this.metadata = metadata;
// Get our id without any jvmRoute appended
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -231,6 +231,20 @@
}
/**
+ * Get the current Catalina MBean Server.
+ *
+ * @return the mbean server
+ */
+ public MBeanServer getMBeanServer()
+ {
+ if (mserver == null)
+ {
+ mserver = Registry.getRegistry(null, null).getMBeanServer();
+ }
+ return mserver;
+ }
+
+ /**
* Gets the name of the implementation of Manager to instantiate when
* createManager() is called.
*
@@ -842,19 +856,4 @@
}
}
- /**
- * Get the current Catalina MBean Server.
- *
- * @return
- * @throws Exception
- */
- private MBeanServer getMBeanServer() throws Exception
- {
- if (mserver == null)
- {
- mserver = Registry.getRegistry(null, null).getMBeanServer();
- }
- return mserver;
- }
-
}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -38,13 +38,11 @@
import org.apache.catalina.Session;
import org.apache.catalina.Valve;
import org.apache.catalina.core.ContainerBase;
-import org.jboss.cache.CacheException;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.jboss.ReplicationConfig;
import org.jboss.metadata.web.jboss.ReplicationGranularity;
import org.jboss.metadata.web.jboss.ReplicationTrigger;
import org.jboss.metadata.web.jboss.SnapshotMode;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.jbc2.JBossCacheService;
import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
@@ -1764,7 +1762,7 @@
* them to the unloaded sessions map, along with their lastAccessedTime
* and their maxInactiveInterval. Passivates overage or excess sessions.
*/
- private void initializeUnloadedSessions() throws CacheException
+ private void initializeUnloadedSessions()
{
Map<String, String> sessions = proxy_.getSessionIds();
if (sessions != null)
@@ -1784,8 +1782,8 @@
try
{
Map sessionData = proxy_.getSessionData(realId, owner);
- ts = (DistributableSessionTimestamp) sessionData.get(JBossCacheService.TIMESTAMP_KEY);
- md = (DistributableSessionMetadata) sessionData.get(JBossCacheService.METADATA_KEY);
+ ts = (DistributableSessionTimestamp) sessionData.get(DistributedCacheManager.TIMESTAMP_KEY);
+ md = (DistributableSessionMetadata) sessionData.get(DistributedCacheManager.METADATA_KEY);
}
catch (Exception e)
{
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/ClusteredSingleSignOn.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/ClusteredSingleSignOn.java 2008-08-31 03:27:20 UTC (rev 77704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/sso/ClusteredSingleSignOn.java 2008-08-31 03:53:32 UTC (rev 77705)
@@ -25,10 +25,12 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
+import org.apache.catalina.Container;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
@@ -41,8 +43,8 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.session.ManagerBase;
+import org.apache.tomcat.util.modeler.Registry;
import org.jboss.web.tomcat.service.session.JBossManager;
-import org.jboss.web.tomcat.service.sso.jbcintegration.TreeCacheSSOClusterManager;
import org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId;
import org.jboss.web.tomcat.service.sso.spi.SSOClusterManager;
import org.jboss.web.tomcat.service.sso.spi.SSOCredentials;
@@ -80,7 +82,8 @@
/** The default JBoss Cache to use for storing SSO entries */
public static final String DEFAULT_CACHE_NAME = "clustered-sso";
public static final String LEGACY_CACHE_NAME = "jboss.cache:service=TomcatClusteringCache";
-
+ public static final String DEFAULT_CLUSTER_MANAGER_CLASS = "org.jboss.web.tomcat.service.sso.jbc.JBossCacheSSOClusterManager";
+
// Override the superclass value
static
{
@@ -95,8 +98,7 @@
* {@link SSOClusterManager SSOClusterManager} that will be used
* to manage SSOs across a cluster.
*/
- private String clusterManagerClass =
- TreeCacheSSOClusterManager.class.getName();
+ private String clusterManagerClass = DEFAULT_CLUSTER_MANAGER_CLASS;
/**
* Object used to provide cross-cluster support for single sign on.
@@ -108,7 +110,7 @@
* Only relevant if the SSOClusterManager implementation is
* TreeCacheSSOClusterManager.
*/
- private String treeCacheName = DEFAULT_CACHE_NAME;
+ private String cacheConfigName = DEFAULT_CACHE_NAME;
/**
* Object name of the thread pool used by SSOClusterManager.
@@ -234,32 +236,45 @@
}
/**
- * Object name of the tree cache used by SSOClusterManager.
- * Only relevant if the SSOClusterManager implementation is
- * TreeCacheSSOClusterManager.
+ * Name of the cache config used by SSOClusterManager.
+ *
+ * @deprecated use {@link #getCacheConfig()}
*/
+ @Deprecated
public String getTreeCacheName()
{
- return treeCacheName;
+ return getCacheConfig();
}
/**
- * Sets the object name of the tree cache used by SSOClusterManager.
- * Only relevant if the SSOClusterManager implementation is
- * TreeCacheSSOClusterManager.
+ * Sets the name of the cache config used by SSOClusterManager.
+ *
+ * @deprecated use {@link #setCacheConfig(String)}
*/
+ @Deprecated
public void setTreeCacheName(String cacheName)
throws Exception
{
- this.treeCacheName = cacheName;
- if (ssoClusterManager != null
- && ssoClusterManager instanceof TreeCacheSSOClusterManager)
- {
- ((TreeCacheSSOClusterManager) ssoClusterManager).setCacheName(cacheName);
- }
+ setCacheConfig(cacheName);
}
/**
+ * Name of the cache config used by SSOClusterManager.
+ */
+ public String getCacheConfig()
+ {
+ return cacheConfigName;
+ }
+
+ /**
+ * Sets the name of the cache config used by SSOClusterManager.
+ */
+ public void setCacheConfig(String cacheConfig)
+ {
+ this.cacheConfigName = cacheConfig;
+ }
+
+ /**
* Object name of the thread pool used by SSOClusterManager.
* Only relevant if the SSOClusterManager implementation is
* TreeCacheSSOClusterManager.
@@ -278,11 +293,6 @@
throws Exception
{
this.threadPoolName = poolName;
- if (ssoClusterManager != null
- && ssoClusterManager instanceof TreeCacheSSOClusterManager)
- {
- ((TreeCacheSSOClusterManager) ssoClusterManager).setThreadPoolName(poolName);
- }
}
/**
@@ -770,7 +780,7 @@
}
if (ssoClusterManager != null)
- ssoClusterManager.addSession(ssoId, new FullyQualifiedSessionId(session));
+ ssoClusterManager.addSession(ssoId, getFullyQualifiedSessionId(session));
}
}
@@ -800,7 +810,7 @@
// If we changed anything, notify any cluster
if (removed && ssoClusterManager != null)
{
- ssoClusterManager.removeSession(ssoId, new FullyQualifiedSessionId(session));
+ ssoClusterManager.removeSession(ssoId, getFullyQualifiedSessionId(session));
}
// see if this was the last session on this node,
@@ -1012,7 +1022,7 @@
// If we changed anything, notify any cluster
if (removed && ssoClusterManager != null)
{
- ssoClusterManager.removeSession(ssoId, new FullyQualifiedSessionId(session));
+ ssoClusterManager.removeSession(ssoId, getFullyQualifiedSessionId(session));
}
// Remove the inactive session from the 'reverse' Map.
@@ -1215,6 +1225,20 @@
}
}
+ /**
+ * Get the current Catalina MBean Server.
+ *
+ * @return the mbean server
+ */
+ public MBeanServer getMBeanServer()
+ {
+ if (mserver == null)
+ {
+ mserver = Registry.getRegistry(null, null).getMBeanServer();
+ }
+ return mserver;
+ }
+
// ------------------------------------------------------- Private Methods
@@ -1249,11 +1273,6 @@
Class clazz = tcl.loadClass(className);
mgr = (SSOClusterManager) clazz.newInstance();
mgr.setSSOLocalManager(this);
- if (mgr instanceof TreeCacheSSOClusterManager)
- {
- ((TreeCacheSSOClusterManager) mgr).setCacheName(getTreeCacheName());
- ((TreeCacheSSOClusterManager) mgr).setThreadPoolName(getThreadPoolName());
- }
ssoClusterManager = mgr;
clusterManagerClass = className;
}
@@ -1343,5 +1362,16 @@
return valid;
}
+
+ private FullyQualifiedSessionId getFullyQualifiedSessionId(Session session)
+ {
+ String id = session.getIdInternal();
+ Container context = session.getManager().getContainer();
+ String contextName = context.getName();
+ Container host = context.getParent();
+ String hostName = host.getName();
+
+ return new FullyQualifiedSessionId(id, contextName, hostName);
+ }
}
More information about the jboss-cvs-commits
mailing list