[jboss-cvs] JBossAS SVN: r91642 - trunk/main/src/main/org/jboss.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 24 13:18:32 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-07-24 13:18:32 -0400 (Fri, 24 Jul 2009)
New Revision: 91642
Modified:
trunk/main/src/main/org/jboss/Main.java
Log:
[JBAS-7119] Properly handle 0.0.0.0 addresses set via JAVA_OPTS
Modified: trunk/main/src/main/org/jboss/Main.java
===================================================================
--- trunk/main/src/main/org/jboss/Main.java 2009-07-24 16:17:02 UTC (rev 91641)
+++ trunk/main/src/main/org/jboss/Main.java 2009-07-24 17:18:32 UTC (rev 91642)
@@ -522,18 +522,11 @@
System.setProperty(name, value);
// Ensure setting the old bind.address property also sets the new
// jgroups.bind_addr property, otherwise jgroups may ignore it
- if ("bind.address".equals(name))
+ if ("bind.address".equals(name)
+ && System.getProperty("jgroups.bind_addr") == null)
{
- // Wildcard address is not valid for JGroups
- String addr = ServerConfigUtil.fixRemoteAddress(value);
- System.setProperty("jgroups.bind_addr", addr);
+ System.setProperty("jgroups.bind_addr", value);
}
- else if ("jgroups.bind_addr".equals(name))
- {
- // Wildcard address is not valid for JGroups
- String addr = ServerConfigUtil.fixRemoteAddress(value);
- System.setProperty("jgroups.bind_addr", addr);
- }
break;
}
@@ -623,16 +616,12 @@
String bindAddress = System.getProperty("bind.address");
if (bindAddress == null)
{
- // Wildcard address is not valid for JGroups
- bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
- System.setProperty("bind.address", bindAddress);
+ System.setProperty("bind.address", arg);
}
bindAddress = System.getProperty("jgroups.bind_addr");
if (bindAddress == null)
{
- // Wildcard address is not valid for JGroups
- bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
- System.setProperty("jgroups.bind_addr", bindAddress);
+ System.setProperty("jgroups.bind_addr", arg);
}
// Set the java.rmi.server.hostname if not set
@@ -685,12 +674,13 @@
}
}
- // Fix up other bind addresses
- String bindAddress = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS);
- if (System.getProperty("java.rmi.server.hostname") == null)
- System.setProperty("java.rmi.server.hostname", bindAddress);
- if (System.getProperty("jgroups.bind_addr") == null)
- System.setProperty("jgroups.bind_addr", bindAddress);
+ // Make sure some address properties are set and/or don't specify
+ // a "any local address" value that's useless for their intended usage
+ String defaultAddress = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS);
+ ServerConfigUtil.fixRemoteAddressProperty("java.rmi.server.hostname", defaultAddress);
+ ServerConfigUtil.fixRemoteAddressProperty("jgroups.bind_addr", defaultAddress);
+ // Don't set deprecated bind.address -- just fix it if it's already set
+ ServerConfigUtil.fixRemoteAddressProperty("bind.address", null);
// Enable jboss.vfs.forceCopy by default, if unspecified
if (System.getProperty("jboss.vfs.forceCopy") == null)
@@ -831,6 +821,35 @@
return System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME,
JBossASConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT);
}
+
+ /**
+ * Checks if the given system property is set; if so ensures it's value has
+ * been fixed by {@link #fixRemoteAddress(String)}; otherwise if
+ * a default value has been provided, passes the defaultValue through
+ * {@link #fixRemoteAddress(String)} and sets the system property.
+ *
+ * @param systemPropertyName the name of the system property
+ * @param defaultValue the defaultValue to use if the property isn't
+ * already set
+ */
+ public static void fixRemoteAddressProperty(String systemPropertyName,
+ String defaultValue)
+ {
+ String old = System.getProperty(systemPropertyName);
+ if (old == null)
+ {
+ if (defaultValue != null)
+ {
+ String fixed = fixRemoteAddress(old);
+ System.setProperty(systemPropertyName, fixed);
+ }
+ }
+ else
+ {
+ String fixed = fixRemoteAddress(old);
+ System.setProperty(systemPropertyName, fixed);
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list