|
From: <btm...@us...> - 2010-07-28 20:48:02
|
Revision: 3337
http://bigdata.svn.sourceforge.net/bigdata/?rev=3337&view=rev
Author: btmurphy
Date: 2010-07-28 20:47:53 +0000 (Wed, 28 Jul 2010)
Log Message:
-----------
[branch dev-btm]: trac #126 - Uses of InetAddress.getLocalAddress should be changed to a mechanism that returns a non-loopback address
Modified Paths:
--------------
branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractStatisticsCollector.java
branches/dev-btm/bigdata/src/java/com/bigdata/resources/MoveTask.java
branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractEmbeddedLoadBalancerService.java
branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java
branches/dev-btm/bigdata/src/test/com/bigdata/counters/httpd/TestCounterSetHTTPDServer.java
branches/dev-btm/bigdata/src/test/com/bigdata/service/TestResourceService.java
branches/dev-btm/bigdata/src/test/com/bigdata/test/ExperimentDriver.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/config/executor.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JiniServiceConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxClientServicesPerHostConstraint.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxDataServicesPerHostConstraint.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ZookeeperServerConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/JiniCoreServicesProcessHelper.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/ZookeeperProcessHelper.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/config/loadbalancer.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/config/shardlocator.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/config/process.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/config/quorum.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/LoadBalancerServer.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/LookupStarter.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/config/lookup.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/shard/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/shard/config/shard.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/transaction/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/transaction/config/transaction.config
branches/dev-btm/bigdata-jini/src/java/com/bigdata/util/config/ConfigDeployUtil.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/util/config/default-deploy.properties
branches/dev-btm/bigdata-jini/src/java/com/bigdata/zookeeper/ZooHelper.java
branches/dev-btm/bigdata-jini/src/resources/config/bigdataStandaloneTesting.config
branches/dev-btm/bigdata-jini/src/test/com/bigdata/jini/start/config/TestZookeeperServerEntry.java
branches/dev-btm/bigdata-jini/src/test/com/bigdata/jini/start/testReggie.config
branches/dev-btm/bigdata-jini/src/test/com/bigdata/jini/start/testStartJini.config
branches/dev-btm/bigdata-jini/src/test/com/bigdata/service/jini/AbstractServerTestCase.java
branches/dev-btm/bigdata-jini/src/test/com/bigdata/zookeeper/testzoo.config
branches/dev-btm/bigdata-lubm/src/java/edu/lehigh/swat/bench/ubt/Test.java
branches/dev-btm/bigdata-rdf/src/test/com/bigdata/rdf/metrics/TestMetrics.java
branches/dev-btm/bigdata-rdf/src/test/com/bigdata/rdf/store/AbstractServerTestCase.java
branches/dev-btm/build.properties
branches/dev-btm/build.xml
branches/dev-btm/src/resources/bin/config/browser.config
branches/dev-btm/src/resources/bin/pstart
branches/dev-btm/src/resources/config/bigdataCluster.config
branches/dev-btm/src/resources/config/jini/reggie.config
branches/dev-btm/src/resources/scripts/bigdataup
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractStatisticsCollector.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractStatisticsCollector.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractStatisticsCollector.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -48,6 +48,8 @@
import com.bigdata.counters.win.StatisticsCollectorForWindows;
import com.bigdata.io.DirectBufferPool;
import com.bigdata.rawstore.Bytes;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
import com.bigdata.util.httpd.AbstractHTTPD;
/**
@@ -64,7 +66,6 @@
* and Un*x platforms so as to support the declared counters on all platforms.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
abstract public class AbstractStatisticsCollector implements IStatisticsCollector {
@@ -83,32 +84,10 @@
String s;
try {
-
-// hostname = InetAddress.getLocalHost().getHostName();
-
- s = InetAddress.getLocalHost().getCanonicalHostName();
-
- } catch (UnknownHostException e) {
-
- try {
-
- s = InetAddress.getLocalHost().getHostName();
-
- } catch(UnknownHostException e2) {
-
- final String msg = "Could not resolve hostname";
- try {
- log.error(msg);
- } catch(Throwable t) {
- System.err.println(msg);
- }
-
- s = "localhost";
-
- //throw new AssertionError(e);
-
- }
-
+ s = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
+ } catch(Throwable t) {//for now, maintain same failure logic as used previously
+ t.printStackTrace();
+ s = NicUtil.getIpAddressByLocalHost();
}
fullyQualifiedHostName = s;
@@ -520,7 +499,6 @@
* Options for {@link AbstractStatisticsCollector}
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
public interface Options {
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/resources/MoveTask.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/resources/MoveTask.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/resources/MoveTask.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -63,6 +63,8 @@
import com.bigdata.service.IMetadataService;
import com.bigdata.service.MetadataService;
import com.bigdata.service.ResourceService;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
/**
* Task moves an index partition to another {@link IDataService}.
@@ -155,7 +157,6 @@
* need to do the atomic update phase.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
public class MoveTask extends AbstractPrepareTask<MoveResult> {
@@ -421,7 +422,6 @@
* successful.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*
* @todo optimization to NOT send an empty index segment if there are no
* buffered writes on the live journal.
@@ -434,6 +434,7 @@
private final UUID targetDataServiceUUID;
private final int targetIndexPartitionId;
private final Event parentEvent;
+ private final InetAddress thisInetAddr;
/**
*
@@ -481,6 +482,11 @@
this.targetIndexPartitionId = targetIndexPartitionId;
this.parentEvent = parentEvent;
+ try {
+ this.thisInetAddr = InetAddress.getByName(NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.dataNetwork"), false));
+ } catch(Throwable t) {
+ throw new IllegalArgumentException(t.getMessage(), t);
+ }
}
/**
@@ -591,7 +597,7 @@
targetIndexPartitionId,//
historicalWritesBuildResult.segmentMetadata,//
bufferedWritesBuildResult.segmentMetadata,//
- InetAddress.getLocalHost(),//
+ thisInetAddr,
resourceManager
.getResourceServicePort()//
)).get();
@@ -856,7 +862,6 @@
* until the "receive" operation is complete.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
private static class IsIndexRegistered_UsingWriteService implements
IIndexProcedure {
@@ -896,7 +901,6 @@
* @see InnerReceiveIndexPartitionTask
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
protected static class ReceiveIndexPartitionTask extends DataServiceCallable<Void> {
@@ -1039,7 +1043,6 @@
* source data service.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
private static class InnerReceiveIndexPartitionTask extends AbstractTask<Void> {
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractEmbeddedLoadBalancerService.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractEmbeddedLoadBalancerService.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractEmbeddedLoadBalancerService.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -5,6 +5,9 @@
import java.util.Properties;
import java.util.UUID;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
+
/**
* Embedded {@link LoadBalancerService}.
*
@@ -14,7 +17,7 @@
abstract public class AbstractEmbeddedLoadBalancerService extends LoadBalancerService {
// final private UUID serviceUUID;
- final private String hostname;
+ private String hostname = NicUtil.getIpAddressByLocalHost();//for now, maintain the same failure logic as in constructor
public AbstractEmbeddedLoadBalancerService(UUID serviceUUID,
Properties properties) {
@@ -28,17 +31,11 @@
setServiceUUID(serviceUUID);
- String hostname;
try {
-
- hostname = Inet4Address.getLocalHost().getCanonicalHostName();
-
- } catch (UnknownHostException e) {
-
- hostname = "localhost";
-
+ this.hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
+ } catch(Throwable t) {
+ t.printStackTrace();
}
- this.hostname = hostname;
}
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -507,54 +507,42 @@
/**
* Special-purpose convenience method that returns a
* <code>String</code> value representing the ip address of
- * the current node; where the value that is returned is
- * determined according to following criteria:
+ * the current node.
* <p>
- * <ul>
- * <li> If a non-<code>null</code> value is input for the
- * <code>systemPropertyName</code> parameter, then
- * this is viewed as a declaration by the caller that
- * that the system property with that given value
- * should take precedence over all other means of
- * determining the desired ip address. As such, this
- * method determines if a system property having the
- * given has indeed been set and, if it has, returns
- * the ip address of the nic having that name; or
- * <code>null</code> if there is no nic with the
- * desired name installed on the node.
- * <li> If a non-<code>null</code> value is input for the
- * <code>systemPropertyName</code> parameter, but
- * no system property with that name has been set,
- * and <code>true</code> has been passed in for
- * the <code>fallbackOk</code> parameter, then this
- * method will return the IPV4 based address of the
- * first reachable nic that is found on the node.
- * Upon failing to find such an address, if the
- * <code>loopbackOk</code> parameter is also
- * <code>true</code>, then this method will return
- * the <i>loop back</i> address of the node; otherwise
- * <code>null</code> is returned.
- * <li> If <code>null</code> is input for the
- * <code>systemPropertyName</code> parameter, but
- * a non-<code>null</code> value is input for the
- * <code>defaultNic</code> parameter, then this
- * method returns the ip address of the nic having
- * that name; or <code>null</code> if there is no
- * nic with the desired default name installed on the
- * node.
- * <li> If <code>null</code> is input for both the
- * <code>systemPropertyName</code> parameter and the
- * <code>defaultNic</code> parameter, and if the
- * <code>fallbackOk</code> parameter is <code>true</code>,
- * then this method will return the IPV4 based address
- * of the first reachable nic that is found on the node.
- * Upon failing to find such an address, if the
- * <code>loopbackOk</code> parameter is also
- * <code>true</code>, then this method will return
- * the <i>loop back</i> address of the node; otherwise
- * <code>null</code> is returned.
- * </ul>
+ * If a non-<code>null</code> value is input for the
+ * <code>systemPropertyName</code> parameter, then this
+ * method first determines if a system property with
+ * name equivalent to the given value has been set and,
+ * if it has, returns the ip address of the nic whose name
+ * is equivalent to that system property value; or
+ * <code>null</code> if there is no nic with the desired
+ * name installed on the node.
* <p>
+ * If there is no system property whose name is the value
+ * of the <code>systemPropertyName</code> parameter, and
+ * if the value "default" is input for the
+ * <code>defaultNic</code> parameter, then this method
+ * will return the IPV4 based address of the first reachable
+ * nic that can be found on the node; otherwise, if a
+ * non-<code>null</code> value not equal to "default" is
+ * input for the the <code>defaultNic</code> parameter,
+ * then this method returns the ip address of the nic
+ * corresponding to that given name; or <code>null</code>
+ * if there is no such nic name installed on the node.
+ * <p>
+ * If, on the other hand, <code>null</code> is input for
+ * the <code>systemPropertyName</code> parameter, then
+ * this method will attempt to find the desired ip address
+ * using only the value of the <code>defaultNic</code>,
+ * and applying the same search criteria as described
+ * above.
+ * <p>
+ * Note that in all cases, if <code>true</code> is input
+ * for the <code>loopOk</code> parameter, then upon failing
+ * to find a valid ip address using the specified search
+ * mechanism, this method will return the <i>loop back</i>
+ * address; otherwise, <code>null</code> is returned.
+ * <p>
* This method can be called from within a configuration
* as well as from within program control.
*
@@ -568,33 +556,24 @@
* the name of the network interface
* whose ip address should be returned
* if <code>null</code> is input for the
+ * <code>systemPropertyName</code> parameter,
+ * or if there is no system property with
+ * name equivalent the value of the
* <code>systemPropertyName</code> parameter.
*
- * @param fallbackOk if <code>true</code>, then if either
- * no system property is set having the
- * name referenced by the
- * <code>systemPropertyName</code> parameter,
- * or if <code>null</code> is input for both
- * the <code>systemPropertyName</code>
- * parameter and the <code>defaultNic</code>
- * parameter, return the IPV4 based address
- * of the first reachable network interface
- * that can be found on the node.
+ * @param loopbackOk if <code>true</code>, then return the
+ * <i>loop back</i> address upon failure
+ * to find a valid ip address using the
+ * search criteria specified through the
+ * <code>systemPropertyName</code> and
+ * <code>defaultNic</code> parameters.
*
- * @param loopbackOk if <code>true</code>, and if <code>true</code>
- * is also input for the <code>fallbackOk</code>
- * parameter, then if this method attempts,
- * but fails, to find a valid IPV4 fallback
- * address, then the node's <i>loop back</i>
- * address is returned.
- *
* @return a <code>String</code> representing an ip address associated
* with the current node; where the value that is returned is
* determined according to the criteria described above.
*/
public static String getIpAddress(String systemPropertyName,
String defaultNic,
- boolean fallbackOk,
boolean loopbackOk)
throws SocketException, IOException
{
@@ -613,32 +592,30 @@
}
if(propSet) {
return getIpAddress(nicName, 0, loopbackOk);
- } else {//desired system property not set, try fallback
- if(fallbackOk) {
- return getDefaultIpv4Address(loopbackOk);
+ } else {//system property not set, try default and/or fallback
+ if(defaultNic != null) {
+ if( defaultNic.equals("default") ) {
+ return getDefaultIpv4Address(loopbackOk);
+ } else {
+ return getIpAddress(defaultNic, 0, loopbackOk);
+ }
} else {
return null;
}
}
- } else {//no system property name provided, try default nic
+ } else {//no system property name provided, try default
if(defaultNic != null) {
- return getIpAddress(defaultNic, 0, loopbackOk);
- } else {//no default nic provided, try fallback
- if(fallbackOk) {
+ if( defaultNic.equals("default") ) {
return getDefaultIpv4Address(loopbackOk);
} else {
- return null;
+ return getIpAddress(defaultNic, 0, loopbackOk);
}
+ } else {
+ return getIpAddress(null, loopbackOk);
}
}
}
- public static String getIpAddress()
- throws SocketException, IOException
- {
- return getIpAddress(null, null, true, true);
- }
-
/**
* Examines each address associated with each network interface
* card (nic) installed on the current node, and returns the
Modified: branches/dev-btm/bigdata/src/test/com/bigdata/counters/httpd/TestCounterSetHTTPDServer.java
===================================================================
--- branches/dev-btm/bigdata/src/test/com/bigdata/counters/httpd/TestCounterSetHTTPDServer.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/test/com/bigdata/counters/httpd/TestCounterSetHTTPDServer.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -39,6 +39,7 @@
import com.bigdata.counters.Instrument;
import com.bigdata.counters.OneShotInstrument;
import com.bigdata.counters.PeriodEnum;
+import com.bigdata.util.config.NicUtil;
/**
* Utility class for testing {@link CounterSetHTTPD} or
@@ -62,12 +63,10 @@
CounterSet cset = root.makePath("localhost");
- cset.addCounter("hostname", new OneShotInstrument<String>(
- InetAddress.getLocalHost().getHostName()));
+ String localIpAddr = NicUtil.getIpAddress("default.nic", "default", true);
+ cset.addCounter("hostname", new OneShotInstrument<String>(localIpAddr));
+ cset.addCounter("ipaddr", new OneShotInstrument<String>(localIpAddr));
- cset.addCounter("ipaddr", new OneShotInstrument<String>(InetAddress
- .getLocalHost().getHostAddress()));
-
// 60 minutes of data : @todo replace with CounterSetBTree (no fixed limit).
final HistoryInstrument<Double> history1 = new HistoryInstrument<Double>(
new History<Double>(new Double[60], PeriodEnum.Minutes
Modified: branches/dev-btm/bigdata/src/test/com/bigdata/service/TestResourceService.java
===================================================================
--- branches/dev-btm/bigdata/src/test/com/bigdata/service/TestResourceService.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/test/com/bigdata/service/TestResourceService.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -43,6 +43,7 @@
import com.bigdata.service.ResourceService.ReadResourceTask;
import com.bigdata.util.concurrent.DaemonThreadFactory;
+import com.bigdata.util.config.NicUtil;
/**
* Test verifies the ability to transmit a file using the
@@ -103,14 +104,15 @@
};
+ InetAddress thisInetAddr;
+ thisInetAddr = InetAddress.getByName(NicUtil.getIpAddress("default.nic", "default", true));
try {
service.awaitRunning(100, TimeUnit.MILLISECONDS);
assertTrue(service.isOpen());
- assertEquals(tmpFile, new ReadResourceTask(InetAddress
- .getLocalHost(), service.port, allowedUUID, tmpFile).call());
+ assertEquals(tmpFile, new ReadResourceTask(thisInetAddr, service.port, allowedUUID, tmpFile).call());
if (log.isInfoEnabled())
log.info(service.counters.getCounters());
@@ -182,6 +184,8 @@
final List<File> tempFiles = new LinkedList<File>();
+ InetAddress thisInetAddr;
+ thisInetAddr = InetAddress.getByName(NicUtil.getIpAddress("default.nic", "default", true));
try {
service.awaitRunning(100, TimeUnit.MILLISECONDS);
@@ -197,8 +201,7 @@
tempFiles.add(tmpFile);
- tasks.add(new ReadResourceTask(InetAddress.getLocalHost(),
- service.port, allowedUUID, tmpFile));
+ tasks.add(new ReadResourceTask(thisInetAddr, service.port, allowedUUID, tmpFile));
}
Modified: branches/dev-btm/bigdata/src/test/com/bigdata/test/ExperimentDriver.java
===================================================================
--- branches/dev-btm/bigdata/src/test/com/bigdata/test/ExperimentDriver.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata/src/test/com/bigdata/test/ExperimentDriver.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -68,6 +68,7 @@
import com.bigdata.journal.ProxyTestCase;
import com.bigdata.util.NV;
+import com.bigdata.util.config.NicUtil;
/**
* A harness for running comparison of different configurations.
@@ -1364,13 +1365,9 @@
props.setProperty("os.arch.cpus", ""+SystemUtil.numProcessors());
try {
-
- props.setProperty("host",InetAddress.getLocalHost().getHostName());
-
- } catch(UnknownHostException ex) {
- /*
- * ignore.
- */
+ props.setProperty( "host", NicUtil.getIpAddress("default.nic", "default", true) );
+ } catch(Throwable t) {
+ t.printStackTrace();
}
return props;
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -244,13 +244,9 @@
}
innerProxy = (PrivateInterface)serverExporter.export(this);
+ String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
outerProxy = ServiceProxy.createProxy
- (innerProxy, proxyId,
- NicUtil.getIpAddress(
- System.getProperty(
- "exportNic",
- ConfigDeployUtil.getString(
- "node.serviceNetwork"))) );
+ (innerProxy, proxyId, hostname);
adminProxy = AdminProxy.createProxy(innerProxy, proxyId);
//Setup lookup discovery
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/config/executor.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/config/executor.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/config/executor.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -16,10 +16,8 @@
com.bigdata.executor {
- private static exportNic =
- System.getProperty("exportNic",
- ConfigDeployUtil.getString("node.serviceNetwork"));
- private static exportIpAddr = NicUtil.getIpAddress(exportNic);
+ private static exportIpAddr =
+ NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
private static exportPort =
Integer.parseInt( System.getProperty("exportPort", "0") );
@@ -59,7 +57,7 @@
net.jini.discovery.LookupDiscovery {
multicastRequestHost = com.bigdata.executor.exportIpAddr;
multicastInterfaces = new NetworkInterface[] {
- NicUtil.getNetworkInterface(com.bigdata.executor.exportNic)
+ NicUtil.getNetworkInterface(com.bigdata.executor.exportIpAddr)
};
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JiniServiceConfiguration.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JiniServiceConfiguration.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JiniServiceConfiguration.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -78,6 +78,8 @@
import com.bigdata.service.jini.JiniClient;
import com.bigdata.service.jini.JiniClientConfig;
import com.bigdata.service.jini.JiniFederation;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
import com.bigdata.zookeeper.ZNodeCreatedWatcher;
/**
@@ -130,6 +132,8 @@
public final Properties properties;
public final String[] jiniOptions;
+ private final String serviceIpAddr;
+
protected void toString(StringBuilder sb) {
super.toString(sb);
@@ -155,6 +159,7 @@
final Configuration config) throws ConfigurationException {
super(className, config);
+//BTM
System.out.println("*** JiniServiceConfiguration: constructor");
final JiniClientConfig tmp = new JiniClientConfig(className, config);
@@ -176,6 +181,12 @@
} else {
log.warn("groups = " + Arrays.toString(this.groups));
}
+
+ try {
+ this.serviceIpAddr = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
+ } catch(IOException e) {
+ throw new ConfigurationException(e.getMessage(), e);
+ }
}
/**
@@ -472,8 +483,7 @@
final ServiceDir serviceDir = new ServiceDir(this.serviceDir);
- final Hostname hostName = new Hostname(InetAddress.getLocalHost()
- .getCanonicalHostName().toString());
+ final Hostname hostName = new Hostname(serviceIpAddr);
final ServiceUUID serviceUUID = new ServiceUUID(this.serviceUUID);
@@ -854,7 +864,8 @@
log.info("Discovered service: elapsed=" + elapsed
+ ", name=" + processHelper.name + ", item="
+ items[0]);
-System.out.println("\n**** JiniServiceConfiguration: DISCOVERED SERVICE ---> "+items[0].service+" ****\n");
+//BTM
+System.out.println("\n**** JiniServiceConfiguration.awaitServiceDiscoveryOrDeath: DISCOVERED ---> "+items[0].service+" ****");
return items[0];
} finally {
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxClientServicesPerHostConstraint.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxClientServicesPerHostConstraint.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxClientServicesPerHostConstraint.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -10,6 +10,8 @@
import com.bigdata.jini.lookup.entry.ServiceItemFilterChain;
import com.bigdata.service.IClientService;
import com.bigdata.service.jini.JiniFederation;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
/**
* Constraint on the #of {@link IClientService}s on the same host.
@@ -51,11 +53,9 @@
// */
// filter.add(ClientServiceFilter.INSTANCE);
- final String hostname = InetAddress.getLocalHost().getHostName();
+ final String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
+ final String canonicalHostname = hostname;
- final String canonicalHostname = InetAddress.getLocalHost()
- .getCanonicalHostName();
-
// filters for _this_ host.
filter.add(new HostnameFilter(new Hostname[] {//
new Hostname(hostname),//
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxDataServicesPerHostConstraint.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxDataServicesPerHostConstraint.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/MaxDataServicesPerHostConstraint.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -11,6 +11,8 @@
import com.bigdata.service.IDataService;
import com.bigdata.service.jini.JiniFederation;
import com.bigdata.service.jini.lookup.DataServiceFilter;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
/**
* Constraint on the #of {@link IDataService}s on the same host.
@@ -47,11 +49,9 @@
// only consider data services.
filter.add(DataServiceFilter.INSTANCE);
- final String hostname = InetAddress.getLocalHost().getHostName();
+ final String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
+ final String canonicalHostname = hostname;
- final String canonicalHostname = InetAddress.getLocalHost()
- .getCanonicalHostName();
-
// filters for _this_ host.
filter.add(new HostnameFilter(new Hostname[] {//
new Hostname(hostname),//
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ZookeeperServerConfiguration.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ZookeeperServerConfiguration.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ZookeeperServerConfiguration.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -54,6 +54,8 @@
import com.bigdata.io.FileLockUtility;
import com.bigdata.jini.start.IServiceListener;
import com.bigdata.jini.start.process.ZookeeperProcessHelper;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
import com.bigdata.zookeeper.ZooHelper;
/**
@@ -213,6 +215,8 @@
*/
public final Map<String, String> other;
+ private final InetAddress thisInetAddr;
+
/**
* Adds value to {@link #other} if found in the {@link Configuration}.
*
@@ -318,6 +322,14 @@
putIfDefined(config, Options.FORCE_SYNC, Boolean.TYPE);
putIfDefined(config, Options.SKIP_ACL, Boolean.TYPE);
+ try {
+ thisInetAddr = InetAddress.getByName(NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false));
+ } catch(IOException e) {
+ throw new ConfigurationException(e.getMessage(), e);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("zookeeper host="+thisInetAddr.getCanonicalHostName());
+ }
}
/**
@@ -541,7 +553,7 @@
*/
public V call() throws Exception {
- if (ZooHelper.isRunning(InetAddress.getLocalHost(), clientPort)) {
+ if (ZooHelper.isRunning(thisInetAddr, clientPort)) {
/*
* Query for an instance already running on local host at that
@@ -552,7 +564,7 @@
* instance on the localhost.
*/
- ZooHelper.ruok(InetAddress.getLocalHost(), clientPort);
+ ZooHelper.ruok(thisInetAddr, clientPort);
throw new ZookeeperRunningException(
"Zookeeper already running on localhost: clientport="
@@ -625,7 +637,7 @@
* Note: We don't test this until we have the file lock.
*/
- ZooHelper.ruok(InetAddress.getLocalHost(), clientPort);
+ ZooHelper.ruok(thisInetAddr, clientPort);
throw new ZookeeperRunningException(
"Zookeeper already running on localhost: clientport="
@@ -727,7 +739,7 @@
* clientPort. That could have already been true.
*/
- ZooHelper.ruok(InetAddress.getLocalHost(), clientPort);
+ ZooHelper.ruok(thisInetAddr, clientPort);
// adjust for time remaining.
nanos = (System.nanoTime() - begin);
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/JiniCoreServicesProcessHelper.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/JiniCoreServicesProcessHelper.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/JiniCoreServicesProcessHelper.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -42,6 +42,8 @@
import com.bigdata.service.jini.JiniClientConfig;
import com.bigdata.service.jini.util.JiniServicesHelper;
import com.bigdata.service.jini.util.LookupStarter;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
/**
* Class for starting the jini services.
@@ -83,12 +85,14 @@
public static boolean startCoreServices(final Configuration config,
final IServiceListener listener) throws Exception {
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: new JiniCoreServicesConfiguration() ...");
final JiniCoreServicesConfiguration serviceConfig = new JiniCoreServicesConfiguration(
config);
// Note: will throw NPE or IAE if constraint relies on fed!
if (!serviceConfig.canStartService(null/* fed */)) {
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: Constraints do NOT permit start --> "+serviceConfig);
// refuse to start.
@@ -97,11 +101,13 @@
}
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: new JiniClientConfig() ...");
final JiniClientConfig clientConfig = new JiniClientConfig(
null/* class */, config);
final LookupLocator[] locators = clientConfig.locators;
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: locators.length = "+locators.length);
if (locators.length > 0) {
@@ -120,6 +126,7 @@
int i = 0;
for (LookupLocator locator : locators) {
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: locator["+i+"] = "+locator);
allowed[i++] = locator.getHost();
@@ -130,6 +137,7 @@
if (log.isInfoEnabled())
log.info("Host not selected by locator(s).");
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: locator NOT ALLOWED");
return false;
@@ -144,6 +152,7 @@
if (log.isInfoEnabled())
log.info("Constraint(s) do not allow service start: " + config);
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: CONSTRAINTS do not allow start ["+config+"]");
return false;
@@ -153,6 +162,7 @@
/*
* The #of registrars that we can locate within a timeout.
*/
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: JiniServicesHelper.getServiceRegistrars() ...");
final ServiceRegistrar[] registrars = JiniServicesHelper
.getServiceRegistrars(Integer.MAX_VALUE/* maxCount */,
@@ -162,13 +172,13 @@
if (log.isInfoEnabled())
log.info("registrars: #found=" + registrars.length + ", #desired="
+ serviceConfig.serviceCount);
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: JiniServicesHelper.getServiceRegistrars() - #found=" + registrars.length + ", #desired=" + serviceConfig.serviceCount);
if (registrars.length >= serviceConfig.serviceCount) {
if (log.isInfoEnabled())
log.info("Enough instances - will not start another.");
-System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: Enough instances - will not start another.");
return false;
@@ -179,17 +189,20 @@
*/
if (log.isInfoEnabled())
- log.info("Will start instance: " + InetAddress.getLocalHost()
+ log.info("Will start instance: " + NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false)
+ ", config=" + config);
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: serviceConfig.newServiceStarter() ...");
final JiniCoreServicesStarter<JiniCoreServicesProcessHelper> serviceStarter = serviceConfig
.newServiceStarter(listener, clientConfig);
// start jini.
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: serviceStarter.call() ...");
final JiniCoreServicesProcessHelper processHelper = serviceStarter
.call();
+//BTM
System.out.println("*** JiniCoreServicesProcessHelper.startCoreServices: serviceStarter.call() ... RETURNED!!!");
return true;
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/ZookeeperProcessHelper.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/ZookeeperProcessHelper.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/ZookeeperProcessHelper.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -16,6 +16,8 @@
import com.bigdata.jini.start.config.ZookeeperServerConfiguration;
import com.bigdata.jini.start.config.ZookeeperServerEntry;
import com.bigdata.jini.start.config.ZookeeperServerConfiguration.ZookeeperRunningException;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
import com.bigdata.zookeeper.ZooHelper;
/**
@@ -40,6 +42,14 @@
protected final int clientPort;
+ protected static InetAddress thisInetAddr = null;
+ static {
+ try {
+ thisInetAddr = InetAddress.getByName
+ (NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false));
+ } catch (Throwable t) { /* swallow */ }
+ }
+
/**
* @param name
* @param builder
@@ -144,14 +154,16 @@
final ZookeeperServerConfiguration serverConfig = new ZookeeperServerConfiguration(
config);
-System.out.println("---- ZookeeperProcessHelper.startZookeeper: [localhost="+InetAddress.getLocalHost()+", clientPort="+serverConfig.clientPort+"] ----");
- if (ZooHelper.isRunning(InetAddress.getLocalHost(), serverConfig.clientPort)) {
+//BTM
+System.out.println("---- ZookeeperProcessHelper.startZookeeper: [localhost="+thisInetAddr.getCanonicalHostName()+", clientPort="+serverConfig.clientPort+"] ----");
+ if (ZooHelper.isRunning(thisInetAddr, serverConfig.clientPort)) {
if (log.isInfoEnabled())
log.info("Zookeeper already running: "
- + InetAddress.getLocalHost().getCanonicalHostName()
+ + thisInetAddr.getCanonicalHostName()
+ ":" + serverConfig.clientPort);
-System.out.println("---- ZookeeperProcessHelper.startZookeeper: Zookeeper ALREADY RUNNING ----");
+//BTM
+System.out.println("---- ZookeeperProcessHelper.startZookeeper: Zookeeper ALREADY RUNNING on "+thisInetAddr.getCanonicalHostName()+" ----");
// will not consider start.
return 0;
@@ -179,7 +191,6 @@
for (ZookeeperServerEntry entry : entries) {
if (entry.isLocalHost()) {
-System.out.println("---- ZookeeperProcessHelper.startZookeeper: IS LOCAL HOST ----");
if (log.isInfoEnabled())
log.info("Zookeeper instance is local: " + entry);
@@ -203,8 +214,6 @@
log.error("Could not start: entry=" + entry, ex);
}
-}else{
-System.out.println("---- ZookeeperProcessHelper.startZookeeper: is NOT local host ----");
}
} // next entry
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceImpl.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceImpl.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceImpl.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -123,12 +123,12 @@
//To start service using the old bigdata ServicesManagerService mechanism or from the command line or tests without the Jini ServiceStarter
public static void main(String[] args) {
-String str1 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/61e99f71-a6f7-4a61-a330-ce7a04e6a0fb/Thread Pool/Service Time";
-String str2 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/61e99f71-a6f7-4a61-a330-ce7a04e6a0fb";
-String str3 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/";
-System.out.println("\n\n SSSSS >>>>> "+str1+ "str1.contains(//) >>>> "+str1.contains("//"));
-System.out.println("\n\n SSSSS >>>>> "+str2+ "str1.contains(//) >>>> "+str2.contains("//"));
-System.out.println("\n\n SSSSS >>>>> "+str3+ "str1.contains(//) >>>> "+str3.contains("//"));
+//String str1 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/61e99f71-a6f7-4a61-a330-ce7a04e6a0fb/Thread Pool/Service Time";
+//String str2 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/61e99f71-a6f7-4a61-a330-ce7a04e6a0fb";
+//String str3 = "/raglan/service/com.bigdata.jini.start.IServicesManagerService/";
+//System.out.println("\n\n SSSSS >>>>> "+str1+ "str1.contains(//) >>>> "+str1.contains("//"));
+//System.out.println("\n\n SSSSS >>>>> "+str2+ "str1.contains(//) >>>> "+str2.contains("//"));
+//System.out.println("\n\n SSSSS >>>>> "+str3+ "str1.contains(//) >>>> "+str3.contains("//"));
try {
ArrayList<String> argsList = new ArrayList<String>();
@@ -416,17 +416,17 @@
( args,
(this.getClass()).getClassLoader() );
if(smsProxyId == null) {//service assigns its own proxyId
-System.out.println("XXXXX LOAD BALANCER ServiceImpl: smsProxyId = null ---> service-assigned id");
+logger.warn("XXXXX LOAD BALANCER ServiceImpl: smsProxyId = null ---> service-assigned id");
BootStateUtil bootStateUtil =
new BootStateUtil(config, COMPONENT_NAME, this.getClass(), logger);
proxyId = bootStateUtil.getProxyId();
serviceId = bootStateUtil.getServiceId();
} else {//ServicesManagerService assigned the proxyId
-System.out.println("XXXXX LOAD BALANCER ServiceImpl: smsProxyId NOT null ---> SMS-assigned id");
+logger.warn("XXXXX LOAD BALANCER ServiceImpl: smsProxyId NOT null ---> SMS-assigned id");
proxyId = smsProxyId;
serviceId = com.bigdata.jini.util.JiniUtil.uuid2ServiceID(proxyId);
}
-System.out.println("XXXXX LOAD BALANCER ServiceImpl: proxyId = "+proxyId+"\n");
+logger.warn("XXXXX LOAD BALANCER ServiceImpl: proxyId = "+proxyId+"\n");
//Service export and proxy creation
ServerEndpoint endpoint = TcpServerEndpoint.getInstance(0);
@@ -445,11 +445,7 @@
}
innerProxy = (PrivateInterface)serverExporter.export(this);
- String hostname = NicUtil.getIpAddress(
- System.getProperty(
- "exportNic",
- ConfigDeployUtil.getString(
- "node.serviceNetwork")));
+ String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
outerProxy = ServiceProxy.createProxy
(innerProxy, proxyId, hostname);
adminProxy = AdminProxy.createProxy(innerProxy, proxyId);
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/config/loadbalancer.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/config/loadbalancer.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/config/loadbalancer.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -16,10 +16,8 @@
com.bigdata.loadbalancer {
- private static exportNic =
- System.getProperty("exportNic",
- ConfigDeployUtil.getString("node.serviceNetwork"));
- private static exportIpAddr = NicUtil.getIpAddress(exportNic);
+ private static exportIpAddr =
+ NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
private static exportPort =
Integer.parseInt( System.getProperty("exportPort", "0") );
@@ -59,7 +57,7 @@
net.jini.discovery.LookupDiscovery {
multicastRequestHost = com.bigdata.loadbalancer.exportIpAddr;
multicastInterfaces = new NetworkInterface[] {
- NicUtil.getNetworkInterface(com.bigdata.loadbalancer.exportNic)
+ NicUtil.getNetworkInterface(com.bigdata.loadbalancer.exportIpAddr)
};
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/ServiceImpl.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/ServiceImpl.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/ServiceImpl.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -296,13 +296,9 @@
}
innerProxy = (PrivateInterface)serverExporter.export(this);
+ String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
outerProxy = ServiceProxy.createProxy
- (innerProxy, proxyId,
- NicUtil.getIpAddress(
- System.getProperty(
- "exportNic",
- ConfigDeployUtil.getString(
- "node.serviceNetwork"))) );
+ (innerProxy, proxyId, hostname);
adminProxy = AdminProxy.createProxy(innerProxy, proxyId);
//Setup lookup discovery
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/config/shardlocator.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/config/shardlocator.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/config/shardlocator.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -16,10 +16,8 @@
com.bigdata.metadata {
- private static exportNic =
- System.getProperty("exportNic",
- ConfigDeployUtil.getString("node.serviceNetwork"));
- private static exportIpAddr = NicUtil.getIpAddress(exportNic);
+ private static exportIpAddr =
+ NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
private static exportPort =
Integer.parseInt( System.getProperty("exportPort", "0") );
@@ -59,7 +57,7 @@
net.jini.discovery.LookupDiscovery {
multicastRequestHost = com.bigdata.metadata.exportIpAddr;
multicastInterfaces = new NetworkInterface[] {
- NicUtil.getNetworkInterface(com.bigdata.metadata.exportNic)
+ NicUtil.getNetworkInterface(com.bigdata.metadata.exportIpAddr)
};
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/ServiceImpl.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/ServiceImpl.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/ServiceImpl.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -362,13 +362,9 @@
}
innerProxy = (PrivateInterface)serverExporter.export(this);
+ String hostname = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
outerProxy = ServiceProxy.createProxy
- (innerProxy, proxyId,
- NicUtil.getIpAddress(
- System.getProperty(
- "exportNic",
- ConfigDeployUtil.getString(
- "node.serviceNetwork"))) );
+ (innerProxy, proxyId, hostname);
adminProxy = AdminProxy.createProxy(innerProxy, proxyId);
// Setup lookup discovery
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/config/process.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/config/process.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/process/config/process.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -16,10 +16,8 @@
com.bigdata.process {
- private static exportNic =
- System.getProperty("exportNic",
- ConfigDeployUtil.getString("node.serviceNetwork"));
- private static exportIpAddr = NicUtil.getIpAddress(exportNic);
+ private static exportIpAddr =
+ NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
private static exportPort =
Integer.parseInt( System.getProperty("exportPort", "0") );
@@ -59,7 +57,7 @@
net.jini.discovery.LookupDiscovery {
multicastRequestHost = com.bigdata.process.exportIpAddr;
multicastInterfaces = new NetworkInterface[] {
- NicUtil.getNetworkInterface(com.bigdata.process.exportNic)
+ NicUtil.getNetworkInterface(com.bigdata.process.exportIpAddr)
};
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/ServiceImpl.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/ServiceImpl.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/ServiceImpl.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -1092,12 +1092,7 @@
// servers are discovered and a leader is elected.
//zookeeperNetwork (peerAddress)
- String zookeeperNetwork =
- NicUtil.getIpAddress(
- System.getProperty(
- "exportNic",
- ConfigDeployUtil.getString(
- "node.serviceNetwork")));
+ String zookeeperNetwork = NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
if(zookeeperNetwork == null) {
throw new ConfigurationException
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/config/quorum.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/config/quorum.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/quorum/config/quorum.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -21,10 +21,8 @@
com.bigdata.quorum {
- private static exportNic =
- System.getProperty("exportNic",
- ConfigDeployUtil.getString("node.serviceNetwork"));
- private static exportIpAddr = NicUtil.getIpAddress(exportNic);
+ private static exportIpAddr =
+ NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.serviceNetwork"), false);
private static exportPort =
Integer.parseInt( System.getProperty("exportPort", "0") );
@@ -78,7 +76,7 @@
net.jini.discovery.LookupDiscovery {
multicastRequestHost = com.bigdata.quorum.exportIpAddr;
multicastInterfaces = new NetworkInterface[] {
- NicUtil.getNetworkInterface(com.bigdata.quorum.exportNic)
+ NicUtil.getNetworkInterface(com.bigdata.quorum.exportIpAddr)
};
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/LoadBalancerServer.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/LoadBalancerServer.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/LoadBalancerServer.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -36,6 +36,8 @@
import com.bigdata.service.jini.util.DumpFederation;
import com.bigdata.service.jini.util.DumpFederation.FormatRecord;
import com.bigdata.service.jini.util.DumpFederation.FormatTabTable;
+import com.bigdata.util.config.ConfigDeployUtil;
+import com.bigdata.util.config.NicUtil;
import com.bigdata.util.httpd.AbstractHTTPD;
import com.bigdata.util.httpd.NanoHTTPD;
import com.bigdata.util.httpd.NanoHTTPD.Response;
@@ -43,6 +45,7 @@
import com.sun.jini.start.ServiceDescriptor;
import com.sun.jini.start.ServiceStarter;
+
/**
* The load balancer server.
* <p>
@@ -634,15 +637,10 @@
* This exception gets thrown if the client has made a direct
* (vs RMI) call.
*/
-
try {
-
- clientAddr = Inet4Address.getLocalHost();
-
- } catch (UnknownHostException ex) {
-
- return "localhost";
-
+ clientAddr = InetAddress.getByName(NicUtil.getIpAddress("default.nic", ConfigDeployUtil.getString("node.dataNetwork"), false));
+ } catch(Throwable t) {//for now, maintain the same failure logic as used previously
+ return NicUtil.getIpAddressByLocalHost();
}
}
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/LookupStarter.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/LookupStarter.java 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/LookupStarter.java 2010-07-28 20:47:53 UTC (rev 3337)
@@ -74,8 +74,7 @@
private static String defaultGroup = null;
static {
try {
- thisHost = NicUtil.getIpAddress
- ("default.nic", null, true, true);
+ thisHost = NicUtil.getIpAddress("default.nic", "default", true);
defaultGroup =
System.getProperty("federation.name",
"bigdata.test.group-"+thisHost);
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/config/lookup.config
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/config/lookup.config 2010-07-28 18:31:51 UTC (rev 3336)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/config/lookup.config 2010-07-28 20:47:53 UTC (rev 3337)
@@ -10,7 +10,7 @@
com.sun.jini.reggie {
private static exportPort = 0;//randomly chosen port
private static exportIpAddr =
- NicUtil.getIpAddress("default.nic", null, true, true);
+ NicUtil.getIpAddress("default.nic", "default", true);
private static codebasePort = 23333;//value used if not set by system prop
// Public configuration entries
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/shard/ServiceImpl.java
==============================================...
[truncated message content] |