[jboss-cvs] JBossAS SVN: r76835 - in trunk: component-matrix and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 8 11:25:38 EDT 2008


Author: pferraro
Date: 2008-08-08 11:25:38 -0400 (Fri, 08 Aug 2008)
New Revision: 76835

Modified:
   trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java
   trunk/component-matrix/pom.xml
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterService.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterServiceMBean.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/MCMPHandlerConfiguration.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/ModClusterConfig.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandler.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/HASingletonAwareResetRequestSource.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/ModClusterServiceRpcHandler.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/PeerMCMPDiscoveryStatus.java
Log:
[JBAS-5660] Create HAServiceKeyProvider sub-interface of HAService to allow ModClusterService to override the key used by DRM and HAPartition RPC handler map.
This is a re-implementation of the singleton-per-domain logic of ModClusterService.

Modified: trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -103,6 +103,11 @@
       this.service.setRegisterThreadContextClassLoader(register);
    }
 
+   public String getHAServiceKey()
+   {
+      return this.service.getHAServiceKey();
+   }
+   
    // Protected ------------------------------
 
    /**
@@ -118,7 +123,7 @@
    public void setDistributedState(String key, Serializable value) throws Exception
    {
       DistributedState ds = this.getHAPartition().getDistributedStateService();
-      ds.set(this.getServiceHAName(), key, value);
+      ds.set(this.getHAServiceKey(), key, value);
    }
 
    /**
@@ -133,7 +138,7 @@
    public Serializable getDistributedState(String key)
    {
       DistributedState ds = this.getHAPartition().getDistributedStateService();
-      return ds.get(this.getServiceHAName(), key);
+      return ds.get(this.getHAServiceKey(), key);
    }
 
    /**
@@ -206,13 +211,13 @@
    @SuppressWarnings("unchecked")
    public List callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
    {
-      return this.getHAPartition().callMethodOnCluster(this.getServiceHAName(), methodName, args, types, true);
+      return this.getHAPartition().callMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
    }
 
    @SuppressWarnings("unchecked")
    protected void callAsyncMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
    {
-      this.getHAPartition().callAsynchMethodOnCluster(this.getServiceHAName(), methodName, args, types, true);
+      this.getHAPartition().callAsynchMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
    }
    
    /**

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/component-matrix/pom.xml	2008-08-08 15:25:38 UTC (rev 76835)
@@ -45,7 +45,7 @@
     <version.org.jboss.mdr>2.0.0.Beta15</version.org.jboss.mdr>
     <version.org.jboss.vfs>2.0.0.Beta20</version.org.jboss.vfs>
     <version.org.jboss.cl>2.0.0.Beta12</version.org.jboss.cl>
-    <version.org.jboss.cluster>1.1.0.CR3</version.org.jboss.cluster>
+    <version.org.jboss.cluster>1.1.0.CR4</version.org.jboss.cluster>
     <version.org.jboss.deployers>2.0.0.Beta18</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>

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterService.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterService.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterService.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -46,8 +46,8 @@
 import org.jboss.ha.framework.server.HAServiceImpl;
 import org.jboss.ha.framework.server.HAServiceRpcHandler;
 import org.jboss.ha.framework.server.HASingletonImpl;
-import org.jboss.ha.singleton.HASingletonElectionPolicySimple;
 import org.jboss.web.tomcat.service.modcluster.config.BalancerConfiguration;
+import org.jboss.web.tomcat.service.modcluster.config.MCMPHandlerConfiguration;
 import org.jboss.web.tomcat.service.modcluster.config.ModClusterConfig;
 import org.jboss.web.tomcat.service.modcluster.config.NodeConfiguration;
 import org.jboss.web.tomcat.service.modcluster.ha.ClusteredMCMPHandler;
@@ -83,7 +83,8 @@
 public class ModClusterService extends HASingletonImpl<HAServiceEvent>
    implements JBossWebEventHandler, ModClusterServiceMBean, ModClusterServiceRpcHandler<List<?>, MCMPServerState>
 {
-   private static final Class<?>[] STOP_OLD_MASTER_TYPES = new Class[] { String.class };
+   private static final Class<?>[] CLUSTER_STATUS_COMPLETE_TYPES = new Class[] { Map.class };
+   private static final Class<?>[] GET_CLUSTER_COORDINATOR_STATE_TYPES = new Class[] { Set.class };
    
    // -----------------------------------------------------------------  Fields
    
@@ -102,13 +103,13 @@
    private final RpcHandler rpcHandler;
    private final JBossWebEventHandler eventHandlerDelegate;
    private final String domain;
+   private final boolean servicePerDomain;
    
    volatile int latestLoad;
    private volatile int statusCount = 0;
    private volatile int processStatusFrequency = 1;
    private ModClusterServiceDRMEntry drmEntry;
    
-   
    /**
     * Create a new ClusterCoordinator.
     * 
@@ -145,17 +146,18 @@
       
       this.setHAPartition(partition);
       
-      this.resetRequestSource = new HASingletonAwareResetRequestSource(config, config, partition, ClusteredMCMPHandler.HA_SERVICE_NAME);
+      this.resetRequestSource = new HASingletonAwareResetRequestSource(config, config, this);
       this.localHandler = new DefaultMCMPHandler(config, this.resetRequestSource);
 //      this.localHandler.init();
-      this.clusteredHandler = new ClusteredMCMPHandlerImpl(this.localHandler, partition, ClusteredMCMPHandler.HA_SERVICE_NAME);
+      this.clusteredHandler = new ClusteredMCMPHandlerImpl(this.localHandler, this);
       this.loadManager = loadFactorProvider;
       this.eventHandlerDelegate = new DefaultJBossWebEventHandler(config, config, this.clusteredHandler, loadFactorProvider);
       this.domain = config.getDomain();
+      this.servicePerDomain = config.isServicePerDomain();
       
-      this.setElectionPolicy((electionPolicy != null) ? electionPolicy : new HASingletonElectionPolicySimple());
+      this.setElectionPolicy(electionPolicy);
       
-      this.drmEntry = new ModClusterServiceDRMEntry(partition.getClusterNode(), this.domain, null);
+      this.drmEntry = new ModClusterServiceDRMEntry(partition.getClusterNode(), null);
       
       this.rpcHandler = new RpcHandler();
    }
@@ -177,6 +179,7 @@
    protected ModClusterService(HAPartition partition,
          NodeConfiguration nodeConfig,
          BalancerConfiguration balancerConfig,
+         MCMPHandlerConfiguration mcmpHandlerConfig,
          MCMPHandler localHandler,
          HASingletonAwareResetRequestSource resetRequestSource,
          ClusteredMCMPHandler clusteredHandler,
@@ -201,10 +204,11 @@
       this.loadManager = loadManager;
       this.eventHandlerDelegate = new DefaultJBossWebEventHandler(nodeConfig, balancerConfig, clusteredHandler, loadManager);
       this.domain = nodeConfig.getDomain();
+      this.servicePerDomain = mcmpHandlerConfig.isServicePerDomain();
       
-      this.setElectionPolicy((electionPolicy != null) ? electionPolicy : new HASingletonElectionPolicySimple());
+      this.setElectionPolicy(electionPolicy);
       
-      this.drmEntry = new ModClusterServiceDRMEntry(partition.getClusterNode(), this.domain, null);
+      this.drmEntry = new ModClusterServiceDRMEntry(partition.getClusterNode(), null);
       
       this.rpcHandler = new RpcHandler();
    }
@@ -275,9 +279,11 @@
    public void config(Engine engine)
    {
       // If needed, create automagical JVM route (address + port + engineName)
-      try {
+      try
+      {
          Utils.establishJvmRouteAndConnectorAddress(engine, this.clusteredHandler);
-      } catch (Exception e) {
+      }
+      catch (Exception e) {
          this.clusteredHandler.markProxiesInError();
          this.log.info(this.sm.getString("modcluster.error.addressJvmRoute"), e);
          return;
@@ -384,9 +390,7 @@
    public void setServiceHAName(String haName)
    {
       super.setServiceHAName(haName);
-      this.clusteredHandler.setHAServiceName(this.getServiceHAName());
    }
-   
 
    // --------------------------------------------------------------  Protected
 
@@ -405,6 +409,19 @@
    /**
     * {@inheritDoc}
     * 
+    * @returns the key used by DRM and the partition rpc handler mapping.
+    */
+   @Override
+   public String getHAServiceKey()
+   {
+      String name = this.getServiceHAName();
+      
+      return ((this.domain != null) && this.servicePerDomain) ? name + ":" + this.domain : name;
+   }
+   
+   /**
+    * {@inheritDoc}
+    * 
     * @return a {@link ModClusterServiceDRMEntry}
     */
    @Override
@@ -421,7 +438,7 @@
    @SuppressWarnings("unchecked")
    protected List<ClusterNode> getElectionCandidates()
    {
-      List<ModClusterServiceDRMEntry> candidates = this.getHAPartition().getDistributedReplicantManager().lookupReplicants(this.getServiceHAName());
+      List<ModClusterServiceDRMEntry> candidates = this.getHAPartition().getDistributedReplicantManager().lookupReplicants(this.getHAServiceKey());
       
       return this.narrowCandidateList(candidates);
    }
@@ -437,21 +454,13 @@
     */
    List<ClusterNode> narrowCandidateList(Collection<ModClusterServiceDRMEntry> candidates)
    {
-      if (candidates == null)
-      {
-         return null;
-      }
+      if (candidates == null) return null;
       
       List<ClusterNode> narrowed = new ArrayList<ClusterNode>(candidates.size());
       ModClusterServiceDRMEntry champion = null;
       
       for (ModClusterServiceDRMEntry candidate : candidates)
       {
-         if (!this.domainEquals(candidate.getDomain()))
-         {
-            continue;
-         }
-         
          if (champion == null)
          {
             champion = candidate;
@@ -491,7 +500,7 @@
          latestEvents = new HashMap<ClusterNode, MCMPServerDiscoveryEvent>(this.proxyChangeDigest);
       }
       HAPartition partition = this.getHAPartition();
-      List<ModClusterServiceDRMEntry> replicants = partition.getDistributedReplicantManager().lookupReplicants(this.getServiceHAName());
+      List<ModClusterServiceDRMEntry> replicants = partition.getDistributedReplicantManager().lookupReplicants(this.getHAServiceKey());
       Map<ClusterNode, ModClusterServiceDRMEntry> nonresponsive = new HashMap<ClusterNode, ModClusterServiceDRMEntry>();
       for (ModClusterServiceDRMEntry replicant : replicants)
       {
@@ -543,7 +552,7 @@
             
             if (!resync) // don't bother if we are going to start over
             {
-               statuses.put(cn, new PeerMCMPDiscoveryStatus(cn, this.domain, mcssgrr.getStates(), latestEvent));
+               statuses.put(cn, new PeerMCMPDiscoveryStatus(cn, mcssgrr.getStates(), latestEvent));
                
                List<MCMPRequest> toAdd = mcssgrr.getResetRequests();
                if (toAdd != null)
@@ -594,7 +603,7 @@
       for (Map.Entry<ClusterNode, ModClusterServiceDRMEntry> entry : nonresponsive.entrySet())
       {
          ClusterNode cn = entry.getKey();
-         statuses.put(entry.getKey(), new PeerMCMPDiscoveryStatus(cn, this.domain, null, latestEvents.get(cn)));
+         statuses.put(entry.getKey(), new PeerMCMPDiscoveryStatus(cn, null, latestEvents.get(cn)));
          
          for (String jvmRoute : entry.getValue().getJvmRoutes())
          {
@@ -626,11 +635,11 @@
       
       // Determine who should update DRM first -- us or the rest of the nodes
       Set<ModClusterServiceDRMEntry> allStatuses = new HashSet<ModClusterServiceDRMEntry>(statuses.values());
-      ModClusterServiceDRMEntry ourCurrentStatus = (ModClusterServiceDRMEntry) partition.getDistributedReplicantManager().lookupLocalReplicant(this.getServiceHAName());
+      ModClusterServiceDRMEntry ourCurrentStatus = (ModClusterServiceDRMEntry) partition.getDistributedReplicantManager().lookupLocalReplicant(this.getHAServiceKey());
       allStatuses.add(ourCurrentStatus);
       
       boolean othersFirst = this.narrowCandidateList(allStatuses).contains(partition.getClusterNode());
-      ModClusterServiceDRMEntry ourNewStatus = new ModClusterServiceDRMEntry(partition.getClusterNode(), this.domain, masterList);
+      ModClusterServiceDRMEntry ourNewStatus = new ModClusterServiceDRMEntry(partition.getClusterNode(), masterList);
       boolean updated = (ourNewStatus.equals(ourCurrentStatus) == false);
       
       if (othersFirst)
@@ -660,7 +669,7 @@
    {
       try
       {
-         this.callMethodOnPartition("clusterStatusComplete", new Object[] { statuses }, new Class[] { Map.class });
+         this.callMethodOnPartition("clusterStatusComplete", new Object[] { statuses }, CLUSTER_STATUS_COMPLETE_TYPES);
       }
       catch (Exception e)
       {
@@ -675,7 +684,7 @@
    {
       try
       {
-         return this.callMethodOnPartition("getClusterCoordinatorState", new Object[] { masterList }, new Class[] { Set.class });
+         return this.callMethodOnPartition("getClusterCoordinatorState", new Object[] { masterList }, GET_CLUSTER_COORDINATOR_STATE_TYPES);
       }
       catch (Exception e)
       {
@@ -683,49 +692,18 @@
       }
    }
 
-
    private void updateLocalDRM(ModClusterServiceDRMEntry ourNewStatus) throws Error
    {
       try
       {
-         this.getHAPartition().getDistributedReplicantManager().add(this.getServiceHAName(), ourNewStatus);
+         this.getHAPartition().getDistributedReplicantManager().add(this.getHAServiceKey(), ourNewStatus);
       }
       catch (Exception e)
       {
          throw Utils.convertToUnchecked(e);
       }
    }
-   
-   /**
-    * Redirect to {@link #stopOldMaster(String)}
-    * @see org.jboss.ha.framework.server.HASingletonImpl#stopOldMaster()
-    */
-   @Override
-   public void stopOldMaster()
-   {
-      this.stopOldMaster(this.domain);
-   }
 
-   /**
-    * @see org.jboss.web.tomcat.service.modcluster.ha.rpc.ModClusterServiceRpcHandler#stopOldMaster(java.lang.String)
-    */
-   public void stopOldMaster(String domain)
-   {
-      try
-      {
-         this.callAsyncMethodOnPartition("stopOldMaster", new Object[] { domain }, STOP_OLD_MASTER_TYPES);
-      }
-      catch (Exception e)
-      {
-         throw Utils.convertToUnchecked(e);
-      }
-   }
-
-   boolean domainEquals(String domain)
-   {
-      return ((this.domain != null) && (domain != null)) ? this.domain.equals(domain) : (this.domain == domain);
-   }
-
    // ---------------------------------------------------------- Inner classes
    
    /**
@@ -735,18 +713,6 @@
    {
       private final ModClusterService coord = ModClusterService.this;
       private final GroupRpcResponse SUCCESS = new GroupRpcResponse(this.coord.getHAPartition().getClusterNode());
-      
-      /**
-       * @see org.jboss.web.tomcat.service.modcluster.ha.rpc.ModClusterServiceRpcHandler#stopOldMaster(java.lang.String)
-       */
-      public void stopOldMaster(String domain)
-      {
-         // Ignore rpc calls from other domains
-         if (this.coord.domainEquals(domain))
-         {
-            this.coord.stopIfMaster();
-         }
-      }
 /*
       public GroupRpcResponse getLocalAddress() throws IOException
       {
@@ -837,14 +803,13 @@
             this.coord.clusteredHandler.recordResetSuccess();
             
             DistributedReplicantManager drm = partition.getDistributedReplicantManager();
-            String haName = this.coord.getServiceHAName();
-            ModClusterServiceDRMEntry oldStatus =
-               (ModClusterServiceDRMEntry) drm.lookupLocalReplicant(haName);
+            String key = this.coord.getHAServiceKey();
+            ModClusterServiceDRMEntry oldStatus = (ModClusterServiceDRMEntry) drm.lookupLocalReplicant(key);
             if (newStatus.equals(oldStatus) == false)
             {
                try
                {
-                  drm.add(haName, new ModClusterServiceDRMEntry(cn, this.coord.getDomain(), newStatus.getMCMPServerStates()));
+                  drm.add(key, new ModClusterServiceDRMEntry(cn, newStatus.getMCMPServerStates()));
                }
                catch (Exception e)
                {

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterServiceMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterServiceMBean.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ModClusterServiceMBean.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -78,6 +78,4 @@
     * @return the configuration information from all the accessible proxies.
     */
    String getProxyConfiguration();
-   
-   String getDomain();
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/MCMPHandlerConfiguration.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/MCMPHandlerConfiguration.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/MCMPHandlerConfiguration.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -46,4 +46,5 @@
    
    String getAdvertiseSecurityKey();   
    
+   boolean isServicePerDomain();
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/ModClusterConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/ModClusterConfig.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/config/ModClusterConfig.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -45,7 +45,7 @@
     * if the proxyList is not set).
     */
    private Boolean advertise;
-   public Boolean getAdvertise() { return advertise; }
+   public Boolean getAdvertise() { return this.advertise; }
    public void setAdvertise(Boolean advertise) { this.advertise = advertise; }
 
 
@@ -53,7 +53,7 @@
     * Advertise group.
     */
    private String advertiseGroupAddress = null;
-   public String getAdvertiseGroupAddress() { return advertiseGroupAddress; }
+   public String getAdvertiseGroupAddress() { return this.advertiseGroupAddress; }
    public void setAdvertiseGroupAddress(String advertiseGroupAddress) { this.advertiseGroupAddress = advertiseGroupAddress; }
 
 
@@ -61,7 +61,7 @@
     * Advertise port.
     */
    private int advertisePort = -1;
-   public int getAdvertisePort() { return advertisePort; }
+   public int getAdvertisePort() { return this.advertisePort; }
    public void setAdvertisePort(int advertisePort) { this.advertisePort = advertisePort; }
 
 
@@ -69,7 +69,7 @@
     * Advertise security key.
     */
    private String advertiseSecurityKey = null;
-   public String getAdvertiseSecurityKey() { return advertiseSecurityKey; }
+   public String getAdvertiseSecurityKey() { return this.advertiseSecurityKey; }
    public void setAdvertiseSecurityKey(String advertiseSecurityKey) { this.advertiseSecurityKey = advertiseSecurityKey; }
 
 
@@ -77,7 +77,7 @@
     * Proxy list, format "address:port,address:port".
     */
    private String proxyList = null;
-   public String getProxyList() { return proxyList; }
+   public String getProxyList() { return this.proxyList; }
    public void setProxyList(String proxyList) { this.proxyList = proxyList; }
 
 
@@ -85,7 +85,7 @@
     * URL prefix.
     */
    private String proxyURL = null;
-   public String getProxyURL() { return proxyURL; }
+   public String getProxyURL() { return this.proxyURL; }
    public void setProxyURL(String proxyURL) { this.proxyURL = proxyURL; }
 
 
@@ -93,7 +93,7 @@
     * Connection timeout for communication with the proxy.
     */
    private int socketTimeout = 20000;
-   public int getSocketTimeout() { return socketTimeout; }
+   public int getSocketTimeout() { return this.socketTimeout; }
    public void setSocketTimeout(int socketTimeout) { this.socketTimeout = socketTimeout; }
    
    
@@ -103,7 +103,7 @@
     * SSL client cert usage to connect to the proxy.
     */
    private boolean ssl = false;
-   public boolean isSsl() { return ssl; }
+   public boolean isSsl() { return this.ssl; }
    public void setSsl(boolean ssl) { this.ssl = ssl; }
    
    
@@ -111,7 +111,7 @@
     * SSL ciphers.
     */
    private String sslCiphers = null;
-   public String getSslCiphers() { return sslCiphers; }
+   public String getSslCiphers() { return this.sslCiphers; }
    public void setSslCiphers(String sslCiphers) { this.sslCiphers = sslCiphers; }
    
    
@@ -119,7 +119,7 @@
     * SSL protocol.
     */
    private String sslProtocol = "TLS";
-   public String getSslProtocol() { return sslProtocol; }
+   public String getSslProtocol() { return this.sslProtocol; }
    public void setSslProtocol(String sslProtocol) { this.sslProtocol = sslProtocol; }
    
    
@@ -127,7 +127,7 @@
     * Certificate encoding algorithm.
     */
    private String sslCertificateEncodingAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
-   public String getSslCertificateEncodingAlgorithm() { return sslCertificateEncodingAlgorithm; }
+   public String getSslCertificateEncodingAlgorithm() { return this.sslCertificateEncodingAlgorithm; }
    public void setSslCertificateEncodingAlgorithm(String sslCertificateEncodingAlgorithm) { this.sslCertificateEncodingAlgorithm = sslCertificateEncodingAlgorithm; }
    
    
@@ -135,7 +135,7 @@
     * SSL keystore.
     */
    private String sslKeyStore = System.getProperty("user.home") + "/.keystore";
-   public String getSslKeyStore() { return sslKeyStore; }
+   public String getSslKeyStore() { return this.sslKeyStore; }
    public void setSslKeyStore(String sslKeyStore) { this.sslKeyStore = sslKeyStore; }
    
    
@@ -143,7 +143,7 @@
     * SSL keystore password.
     */
    private String sslKeyStorePass = "changeit";
-   public String getSslKeyStorePass() { return sslKeyStorePass; }
+   public String getSslKeyStorePass() { return this.sslKeyStorePass; }
    public void setSslKeyStorePass(String sslKeyStorePass) { this.sslKeyStorePass = sslKeyStorePass; }
    
    
@@ -151,7 +151,7 @@
     * Keystore type.
     */
    private String sslKeyStoreType = "JKS";
-   public String getSslKeyStoreType() { return sslKeyStoreType; }
+   public String getSslKeyStoreType() { return this.sslKeyStoreType; }
    public void setSslKeyStoreType(String sslKeyStoreType) { this.sslKeyStoreType = sslKeyStoreType; }
    
    
@@ -159,7 +159,7 @@
     * Keystore provider.
     */
    private String sslKeyStoreProvider = null;
-   public String getSslKeyStoreProvider() { return sslKeyStoreProvider; }
+   public String getSslKeyStoreProvider() { return this.sslKeyStoreProvider; }
    public void setSslKeyStoreProvider(String sslKeyStoreProvider) { this.sslKeyStoreProvider = sslKeyStoreProvider; }
    
    
@@ -167,7 +167,7 @@
     * Truststore algorithm.
     */
    private String sslTrustAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
-   public String getSslTrustAlgorithm() { return sslTrustAlgorithm; }
+   public String getSslTrustAlgorithm() { return this.sslTrustAlgorithm; }
    public void setSslTrustAlgorithm(String sslTrustAlgorithm) { this.sslTrustAlgorithm = sslTrustAlgorithm; }
    
    
@@ -175,7 +175,7 @@
     * Key alias.
     */
    private String sslKeyAlias = null;
-   public String getSslKeyAlias() { return sslKeyAlias; }
+   public String getSslKeyAlias() { return this.sslKeyAlias; }
    public void setSslKeyAlias(String sslKeyAlias) { this.sslKeyAlias = sslKeyAlias; }
    
    
@@ -183,7 +183,7 @@
     * Certificate revocation list.
     */
    private String sslCrlFile = null;
-   public String getSslCrlFile() { return sslCrlFile; }
+   public String getSslCrlFile() { return this.sslCrlFile; }
    public void setSslCrlFile(String sslCrlFile) { this.sslCrlFile = sslCrlFile; }
    
    
@@ -191,7 +191,7 @@
     * Trust max certificate length.
     */
    private int sslTrustMaxCertLength = 5;
-   public int getSslTrustMaxCertLength() { return sslTrustMaxCertLength; }
+   public int getSslTrustMaxCertLength() { return this.sslTrustMaxCertLength; }
    public void setSslTrustMaxCertLength(int sslTrustMaxCertLength) { this.sslTrustMaxCertLength = sslTrustMaxCertLength; }
    
    
@@ -199,7 +199,7 @@
     * Trust store file.
     */
    private String sslTrustStore = System.getProperty("javax.net.ssl.trustStore");
-   public String getSslTrustStore() { return sslTrustStore; }
+   public String getSslTrustStore() { return this.sslTrustStore; }
    public void setSslTrustStore(String sslTrustStore) { this.sslTrustStore = sslTrustStore; }
    
    
@@ -207,7 +207,7 @@
     * Trust store password.
     */
    private String sslTrustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
-   public String getSslTrustStorePassword() { return sslTrustStorePassword; }
+   public String getSslTrustStorePassword() { return this.sslTrustStorePassword; }
    public void setSslTrustStorePassword(String sslTrustStorePassword) { this.sslTrustStorePassword = sslTrustStorePassword; }
    
    
@@ -215,7 +215,7 @@
     * Trust store type.
     */
    private String sslTrustStoreType = System.getProperty("javax.net.ssl.trustStoreType");
-   public String getSslTrustStoreType() { return sslTrustStoreType; }
+   public String getSslTrustStoreType() { return this.sslTrustStoreType; }
    public void setSslTrustStoreType(String sslTrustStoreType) { this.sslTrustStoreType = sslTrustStoreType; }
    
    
@@ -223,7 +223,7 @@
     * Trust store provider.
     */
    private String sslTrustStoreProvider = System.getProperty("javax.net.ssl.trustStoreProvider");
-   public String getSslTrustStoreProvider() { return sslTrustStoreProvider; }
+   public String getSslTrustStoreProvider() { return this.sslTrustStoreProvider; }
    public void setSslTrustStoreProvider(String sslTrustStoreProvider) { this.sslTrustStoreProvider = sslTrustStoreProvider; }
    
 
@@ -234,7 +234,7 @@
     * Domain parameter, which allows tying a jvmRoute to a particular domain.
     */
    private String domain = null;
-   public String getDomain() { return domain; }
+   public String getDomain() { return this.domain; }
    public void setDomain(String domain) { this.domain = domain; }
 
 
@@ -242,7 +242,7 @@
     * Allows controlling flushing of packets.
     */
    private boolean flushPackets = false;
-   public boolean getFlushPackets() { return flushPackets; }
+   public boolean getFlushPackets() { return this.flushPackets; }
    public void setFlushPackets(boolean flushPackets) { this.flushPackets = flushPackets; }
 
 
@@ -250,7 +250,7 @@
     * Time to wait before flushing packets.
     */
    private int flushWait = -1;
-   public int getFlushWait() { return flushWait; }
+   public int getFlushWait() { return this.flushWait; }
    public void setFlushWait(int flushWait) { this.flushWait = flushWait; }
 
 
@@ -258,7 +258,7 @@
     * Time to wait for a pong answer to a ping.
     */
    private int ping = -1;
-   public int getPing() { return ping; }
+   public int getPing() { return this.ping; }
    public void setPing(int ping) { this.ping = ping; }
 
 
@@ -266,7 +266,7 @@
     * Soft maximum inactive connection count.
     */
    private int smax = -1;
-   public int getSmax() { return smax; }
+   public int getSmax() { return this.smax; }
    public void setSmax(int smax) { this.smax = smax; }
 
 
@@ -274,7 +274,7 @@
     * Maximum time on seconds for idle connections above smax.
     */
    private int ttl = -1;
-   public int getTtl() { return ttl; }
+   public int getTtl() { return this.ttl; }
    public void setTtl(int ttl) { this.ttl = ttl; }
 
 
@@ -282,7 +282,7 @@
     * Maximum time on seconds for idle connections the proxy will wait to connect to the node.
     */
    private int nodeTimeout = -1;
-   public int getNodeTimeout() { return nodeTimeout; }
+   public int getNodeTimeout() { return this.nodeTimeout; }
    public void setNodeTimeout(int nodeTimeout) { this.nodeTimeout = nodeTimeout; }
 
 
@@ -290,15 +290,15 @@
     * Name of the balancer.
     */
    private String balancer = null;
-   public String getBalancer() { return balancer; }
+   public String getBalancer() { return this.balancer; }
    public void setBalancer(String balancer) { this.balancer = balancer; }
 
    /**
     * Our load balance factor
     */
    private int loadBalanceFactor = 1;
-   public int getLoadBalanceFactor() { return loadBalanceFactor; }
-   public void setLoadBalanceFactor(int loadBalanceFactor) 
+   public int getLoadBalanceFactor() { return this.loadBalanceFactor; }
+   public void setLoadBalanceFactor(int loadBalanceFactor)
    {
       assert loadBalanceFactor >= 0 : "loadBalanceFactor is negative";
       this.loadBalanceFactor = loadBalanceFactor;
@@ -311,7 +311,7 @@
     * Enables sticky sessions.
     */
    private boolean stickySession = true;
-   public boolean getStickySession() { return stickySession; }
+   public boolean getStickySession() { return this.stickySession; }
    public void setStickySession(boolean stickySession) { this.stickySession = stickySession; }
 
 
@@ -319,7 +319,7 @@
     * Remove session when the request cannot be routed to the right node.
     */
    private boolean stickySessionRemove = false;
-   public boolean getStickySessionRemove() { return stickySessionRemove; }
+   public boolean getStickySessionRemove() { return this.stickySessionRemove; }
    public void setStickySessionRemove(boolean stickySessionRemove) { this.stickySessionRemove = stickySessionRemove; }
 
 
@@ -327,7 +327,7 @@
     * Return an error when the request cannot be routed to the right node.
     */
    private boolean stickySessionForce = true;
-   public boolean getStickySessionForce() { return stickySessionForce; }
+   public boolean getStickySessionForce() { return this.stickySessionForce; }
    public void setStickySessionForce(boolean stickySessionForce) { this.stickySessionForce = stickySessionForce; }
 
 
@@ -335,7 +335,7 @@
     * Timeout to wait for an available worker (default is no wait).
     */
    private int workerTimeout = -1;
-   public int getWorkerTimeout() { return workerTimeout; }
+   public int getWorkerTimeout() { return this.workerTimeout; }
    public void setWorkerTimeout(int workerTimeout) { this.workerTimeout = workerTimeout; }
 
 
@@ -343,7 +343,10 @@
     * Maximum number of attempts to send the request to the backend server.
     */
    private int maxAttempts = -1;
-   public int getMaxAttempts() { return maxAttempts; }
-   public void setMaxAttempts(int maxAttempts) { this.maxAttempts = maxAttempts; }    
+   public int getMaxAttempts() { return this.maxAttempts; }
+   public void setMaxAttempts(int maxAttempts) { this.maxAttempts = maxAttempts; }
 
+   private boolean servicePerDomain = false;
+   public boolean isServicePerDomain() { return this.servicePerDomain; }
+   public void setServicePerDomain(boolean servicePerDomain) { this.servicePerDomain = servicePerDomain; }
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandler.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandler.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandler.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -50,7 +50,6 @@
    void setMasterNode(boolean master);
    
    String getHAServiceName();
-   void setHAServiceName(String serviceName);
    
    String getPartitionName();
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -33,7 +33,7 @@
 import net.jcip.annotations.GuardedBy;
 
 import org.apache.catalina.util.StringManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.HAServiceKeyProvider;
 import org.jboss.logging.Logger;
 import org.jboss.web.tomcat.service.modcluster.Constants;
 import org.jboss.web.tomcat.service.modcluster.Utils;
@@ -62,7 +62,7 @@
    
    static final Logger log = Logger.getLogger(ClusteredMCMPHandlerImpl.class);
    
-   final HAPartition partition;
+   final HAServiceKeyProvider serviceKeyProvider;
    private final MCMPHandler localHandler;
    private final ClusteredMCMPHandlerRpcHandler rpcStub = new RpcStub();
 //   private AdvertiseListener advertiseListener;
@@ -83,11 +83,10 @@
     */
    final StringManager sm = StringManager.getManager(Constants.Package);
    
-   public ClusteredMCMPHandlerImpl(MCMPHandler localHandler, HAPartition partition, String haServiceName)
+   public ClusteredMCMPHandlerImpl(MCMPHandler localHandler, HAServiceKeyProvider serviceKeyProvider)
    {
       this.localHandler = localHandler;
-      this.partition = partition;
-      this.haServiceName = haServiceName;
+      this.serviceKeyProvider = serviceKeyProvider;
    }
    
    // ---------------------------------------------------  ClusteredMCMPHandler
@@ -123,7 +122,7 @@
     */
    public String getPartitionName()
    {
-      return this.partition.getPartitionName();
+      return this.serviceKeyProvider.getHAPartition().getPartitionName();
    }
 
    public synchronized List<MCMPServerDiscoveryEvent> getPendingDiscoveryEvents()
@@ -242,19 +241,21 @@
       this.localHandler.addProxy(address, port, established);
    }
    
-   
    /**
     * Remove proxy.
     */
    public synchronized void removeProxy(String host, int port)
    {
-      InetAddress address = null;
-      try {
-         address = InetAddress.getByName(host);
-      } catch (Exception e) {
+      try
+      {
+         InetAddress address = InetAddress.getByName(host);
+         
+         this.removeProxy(address, port);
+      }
+      catch (Exception e)
+      {
          throw new IllegalArgumentException(e);
       }
-      this.removeProxy(address, port);
    }
    
    /**
@@ -413,7 +414,7 @@
    private synchronized void sendDiscoveryEventToPartition(InetAddress address, int port, boolean addition)
    {
       AddressPort ap = new AddressPort(address, port);
-      MCMPServerDiscoveryEvent event = new MCMPServerDiscoveryEvent(this.partition.getClusterNode(), ap, addition, this.discoveryEventIndex.incrementAndGet());
+      MCMPServerDiscoveryEvent event = new MCMPServerDiscoveryEvent(this.serviceKeyProvider.getHAPartition().getClusterNode(), ap, addition, this.discoveryEventIndex.incrementAndGet());
       this.pendingDiscoveryEvents.add(event);
       
       GroupRpcResponse response = this.rpcStub.mcmpServerDiscoveryEvent(event);
@@ -527,7 +528,7 @@
       
       private GroupRpcResponse invokeRpc(String methodName, Object[] args, Class<?>[] types) throws Exception
       {
-         List<?> responses = ClusteredMCMPHandlerImpl.this.partition.callMethodOnCluster(ClusteredMCMPHandlerImpl.this.getHAServiceName(), methodName, args, types, false, new GroupRpcResponseFilter());
+         List<?> responses = ClusteredMCMPHandlerImpl.this.serviceKeyProvider.getHAPartition().callMethodOnCluster(ClusteredMCMPHandlerImpl.this.serviceKeyProvider.getHAServiceKey(), methodName, args, types, false, new GroupRpcResponseFilter());
          
          Throwable thrown = null;
          

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/HASingletonAwareResetRequestSource.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/HASingletonAwareResetRequestSource.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/HASingletonAwareResetRequestSource.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -28,7 +28,7 @@
 
 import org.apache.catalina.Server;
 import org.apache.catalina.util.StringManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.HAServiceKeyProvider;
 import org.jboss.logging.Logger;
 import org.jboss.web.tomcat.service.modcluster.Constants;
 import org.jboss.web.tomcat.service.modcluster.Utils;
@@ -67,11 +67,11 @@
    private volatile boolean master;
    private volatile Server jbossWebServer;
    
-   public HASingletonAwareResetRequestSource(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, HAPartition partition, String haServiceName)
+   public HASingletonAwareResetRequestSource(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, HAServiceKeyProvider serviceKeyProvider)
    {
       this.nodeConfig = nodeConfig;
       this.balancerConfig = balancerConfig;
-      this.rpcStub = new RpcStub(partition, haServiceName);
+      this.rpcStub = new RpcStub(serviceKeyProvider);
    }
    
    public List<MCMPRequest> getResetRequests()
@@ -141,13 +141,11 @@
 
    private class RpcStub implements ResetRequestSourceRpcHandler<List<?>>
    {
-      private final HAPartition partition;
-      private final String haServiceName;
+      private final HAServiceKeyProvider serviceKeyProvider;
       
-      public RpcStub(HAPartition partition, String haServiceName)
+      public RpcStub(HAServiceKeyProvider serviceKeyProvider)
       {
-         this.partition = partition;
-         this.haServiceName = haServiceName;
+         this.serviceKeyProvider = serviceKeyProvider;
       }
       
       /**
@@ -157,7 +155,7 @@
       {
          try
          {
-            return this.partition.callMethodOnCluster(this.haServiceName, METHOD_NAME, ARGS, TYPES, true);
+            return this.serviceKeyProvider.getHAPartition().callMethodOnCluster(this.serviceKeyProvider.getHAServiceKey(), METHOD_NAME, ARGS, TYPES, true);
          }
          catch (Exception e)
          {

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -41,7 +41,6 @@
    private static final long serialVersionUID = 8275232749243297786L;
    
    private final ClusterNode peer;
-   private final String domain;
    private final Set<MCMPServerState> mcmpServerStates;
    private final Integer healthyEstablishedCount;
    private final Integer establishedCount;
@@ -49,12 +48,11 @@
    private final Integer knownCount;
    private final Set<String> jvmRoutes = new HashSet<String>();
 
-   public ModClusterServiceDRMEntry(ClusterNode peer, String domain, Set<MCMPServerState> mcmpServerStates)
+   public ModClusterServiceDRMEntry(ClusterNode peer, Set<MCMPServerState> mcmpServerStates)
    {
       assert peer != null : "peer is null";
       
       this.peer = peer;
-      this.domain = domain;
       this.mcmpServerStates = mcmpServerStates;
       
       int healthyEstablished = 0;
@@ -93,11 +91,6 @@
    {
       return this.peer;
    }
-
-   public String getDomain()
-   {
-      return this.domain;
-   }
    
    public Set<MCMPServerState> getMCMPServerStates()
    {
@@ -159,7 +152,6 @@
       {
          ModClusterServiceDRMEntry other = (ModClusterServiceDRMEntry) obj;
          return (this.peer.equals(other.peer)
-                   && this.safeEquals(this.domain, other.domain)
                    && this.safeEquals(this.mcmpServerStates, other.mcmpServerStates)
                    && this.safeEquals(this.jvmRoutes, other.jvmRoutes));
       }
@@ -170,7 +162,6 @@
    public int hashCode()
    {
       int result = 17;
-      result += 23 * (this.domain == null ? 0 : this.domain.hashCode());
       result += 23 * this.peer.hashCode();
       result += 23 * (this.mcmpServerStates == null ? 0 : this.mcmpServerStates.hashCode());
       result += 23 * (this.jvmRoutes == null ? 0 : this.jvmRoutes.hashCode());
@@ -181,12 +172,11 @@
    public String toString()
    {
       return new StringBuilder(this.getClass().getName())
-                     .append("{peer=").append(this.peer).append(",domain=").append(this.domain).append("}").toString();
+                     .append("{peer=").append(this.peer).append("}").toString();
    }
 
    private boolean safeEquals(Object a, Object b)
    {
       return (a == b || (a != null && a.equals(b)));
    }
-
 }
\ No newline at end of file

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/ModClusterServiceRpcHandler.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/ModClusterServiceRpcHandler.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/ModClusterServiceRpcHandler.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -35,8 +35,6 @@
  */
 public interface ModClusterServiceRpcHandler<T, S extends MCMPServer> extends HAServiceRpcHandler<HAServiceEvent>
 {
-   void stopOldMaster(String domain);
-   
    void clusterStatusComplete(Map<ClusterNode, PeerMCMPDiscoveryStatus> statuses);
    
    T getClusterCoordinatorState(Set<S> masterList);

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/PeerMCMPDiscoveryStatus.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/PeerMCMPDiscoveryStatus.java	2008-08-08 15:17:49 UTC (rev 76834)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/rpc/PeerMCMPDiscoveryStatus.java	2008-08-08 15:25:38 UTC (rev 76835)
@@ -51,10 +51,10 @@
     *                         not be obtained for the peer.
     * @param latestDiscoveryEvent most recent discovery event received from the peer
     */
-   public PeerMCMPDiscoveryStatus(ClusterNode peer, String domain, Set<MCMPServerState> mcmpServerStates, 
+   public PeerMCMPDiscoveryStatus(ClusterNode peer, Set<MCMPServerState> mcmpServerStates, 
                              MCMPServerDiscoveryEvent latestDiscoveryEvent)
    {
-      super(peer, domain, mcmpServerStates);
+      super(peer, mcmpServerStates);
       this.latestDiscoveryEvent = latestDiscoveryEvent;
    }
 




More information about the jboss-cvs-commits mailing list