[jboss-cvs] JBossAS SVN: r88130 - in projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as: server and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun May 3 20:54:20 EDT 2009


Author: ALRubinger
Date: 2009-05-03 20:54:20 -0400 (Sun, 03 May 2009)
New Revision: 88130

Modified:
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
Log:
[JBBOOT-31] Handle configuration of "jboss.partition.udpGroup" and "jboss.jgroups.udp.mcast_port", overrides, and tests

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java	2009-05-04 00:54:08 UTC (rev 88129)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java	2009-05-04 00:54:20 UTC (rev 88130)
@@ -52,6 +52,12 @@
    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(BasicJBossASServerConfig.class);
 
+   /**
+    * Property for JGroups denoting the UDP Multicast address.  Should be set alongside
+    * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP}
+    */
+   private static String PROP_KEY_JGROUPS_UDP_MCAST_ADDRESS = "jgroups.udp.mcast_addr";
+
    //-------------------------------------------------------------------------------||
    // Instance Members -------------------------------------------------------------||
    //-------------------------------------------------------------------------------||
@@ -154,6 +160,22 @@
     */
    private volatile String partitionName;
 
+   /**
+    * UDP Group this instance uses when taking
+    * part in clustering.  Synchronized on "this".
+    * Volatile so we don't have to block
+    * when simply setting the value.
+    */
+   private volatile String udpGroup;
+
+   /**
+    * UDP Port this instance uses when taking
+    * part in clustering.  Synchronized on "this".
+    * Volatile so we don't have to block
+    * when simply setting the value.
+    */
+   private volatile Integer udpPort;
+
    //-------------------------------------------------------------------------------||
    // Constructor ------------------------------------------------------------------||
    //-------------------------------------------------------------------------------||
@@ -793,6 +815,53 @@
       return this.covarientReturn();
    }
 
+   /* (non-Javadoc)
+    * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#getUdpGroup()
+    */
+   public String getUdpGroup()
+   {
+      return this.udpGroup;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#udpGroup(java.lang.String)
+    */
+   public synchronized JBossASServerConfig udpGroup(final String udpGroup)
+   {
+      // Set
+      this.udpGroup = udpGroup;
+
+      // Set properties
+      this.setPropertyForString(PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP, udpGroup);
+      this.setPropertyForString(PROP_KEY_JGROUPS_UDP_MCAST_ADDRESS, udpGroup);
+
+      // Return
+      return this.covarientReturn();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#getUdpPort()
+    */
+   public Integer getUdpPort()
+   {
+      return this.udpPort;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#udpGroup(java.lang.Integer)
+    */
+   public synchronized JBossASServerConfig udpPort(final Integer udpPort)
+   {
+      // Set
+      this.udpPort = udpPort;
+
+      // Set property
+      this.setPropertyForString(PROP_KEY_JBOSSAS_PARTITION_UDP_PORT, udpPort);
+
+      // Return
+      return this.covarientReturn();
+   }
+
    //-------------------------------------------------------------------------------||
    // Internal Helper Methods ------------------------------------------------------||
    //-------------------------------------------------------------------------------||
@@ -868,7 +937,7 @@
       if (url == null)
       {
          // Set the dir property to null
-         this.setPropertyForString(dirPropName, null);
+         this.setPropertyForString(dirPropName, (String) null);
       }
       // Convert the dir property to strip the protocol, and set
       else

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java	2009-05-04 00:54:08 UTC (rev 88129)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java	2009-05-04 00:54:20 UTC (rev 88130)
@@ -218,6 +218,29 @@
             config.getPartitionName(), JBossASConfigurationInitializer.DEFAULT_VALUE_PARITION_NAME, configProps);
       config.partitionName(partitionName);
 
+      // ${jboss.partition.udpGroup}
+      final String udpGroup = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP,
+            config.getUdpGroup(), null, configProps);
+      config.udpGroup(udpGroup);
+
+      // ${jboss.jgroups.udp.mcast_port}
+      final Integer udpPort = config.getUdpPort();
+      final String udpPortString = udpPort != null ? udpPort.toString() : null;
+      final String udpPortResolved = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_UDP_PORT,
+            udpPortString, null, configProps);
+      if (udpPortResolved != null)
+      {
+         try
+         {
+            final int udpPortOverride = Integer.parseInt(udpPortResolved);
+            config.udpPort(udpPortOverride);
+         }
+         catch (final NumberFormatException nfe)
+         {
+            throw new InvalidConfigurationException("UDP Port overridden to non-integer value", nfe);
+         }
+      }
+
    }
 
    //-------------------------------------------------------------------------------||

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java	2009-05-04 00:54:08 UTC (rev 88129)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java	2009-05-04 00:54:20 UTC (rev 88130)
@@ -165,6 +165,18 @@
     */
    String PROP_KEY_JBOSSAS_PARTITION_NAME = "jboss.partition.name";
 
+   /** 
+    * Constant that holds the name of the system property
+    * for specifying the UDP Group for this instance in clustering
+    */
+   String PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP = "jboss.partition.udpGroup";
+
+   /** 
+    * Constant that holds the name of the system property
+    * for specifying the UDP Port for this instance in clustering
+    */
+   String PROP_KEY_JBOSSAS_PARTITION_UDP_PORT = "jboss.jgroups.udp.mcast_port";
+
    //-------------------------------------------------------------------------------||
    // Contracts --------------------------------------------------------------------||
    //-------------------------------------------------------------------------------||
@@ -496,9 +508,41 @@
    /**
     * Sets the partition name for this instance in clustering
     * 
-    * @param bindAddress
+    * @param partitionName
     * @return
     */
    JBossASServerConfig partitionName(String partitionName);
 
+   /**
+    * Obtains the UDP Group for this instance in clustering
+    * 
+    * @return
+    */
+   String getUdpGroup();
+
+   /**
+    * Sets the UDP Group for this instance in clustering
+    * 
+    * @param udpGroup
+    * @return
+    */
+   JBossASServerConfig udpGroup(String udpGroup);
+
+   /**
+    * Obtains the JGroups UDP Multicast port for use 
+    * in clustering
+    * 
+    * @return
+    */
+   Integer getUdpPort();
+
+   /**
+    * Sets the JGroups UDP Multicast port for use 
+    * in clustering
+    * 
+    * @param udpPort
+    * @return
+    */
+   JBossASServerConfig udpPort(Integer udpPort);
+
 }

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java	2009-05-04 00:54:08 UTC (rev 88129)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java	2009-05-04 00:54:20 UTC (rev 88130)
@@ -46,13 +46,7 @@
    /*
     * STUFF BELOW HERE has not been addressed/documented/reintegrated
     */
-  
-   /** The udp address property */
-   String PROP_KEY_JBOSSAS_PARTITION_UDP_PROPERTY = "jboss.partition.udpGroup";
 
-   /** The udp port property */
-   String PROP_KEY_JBOSSAS_PARTITION_UDP_PORT_PROPERTY = "jboss.jgroups.udp.mcast_port";
-
    /** Whether to load native libraries */
    String PROP_KEY_JBOSSAS_NATIVE_LOAD_PROPERTY = "jboss.native.load";
 

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java	2009-05-04 00:54:08 UTC (rev 88129)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java	2009-05-04 00:54:20 UTC (rev 88130)
@@ -103,6 +103,7 @@
       final String serverDataDir = this.getAbsoluteLocationOfUrl(configuration.getServerDataLocation());
       final String serverTempDir = this.getAbsoluteLocationOfUrl(configuration.getServerTempLocation());
       final String partitionName = configuration.getPartitionName();
+      final String udpGroup = configuration.getUdpGroup();
 
       // Set our system properties
       this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_HOME, jbossHomeDir);
@@ -123,6 +124,7 @@
       this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR, serverDataDir);
       this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR, serverTempDir);
       this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME, partitionName);
+      this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP, udpGroup);
    }
 
    //-------------------------------------------------------------------------------||




More information about the jboss-cvs-commits mailing list