|
From: <btm...@us...> - 2010-07-23 12:19:21
|
Revision: 3269
http://bigdata.svn.sourceforge.net/bigdata/?rev=3269&view=rev
Author: btmurphy
Date: 2010-07-23 12:19:14 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
[branch dev-btm]: CHECKPOINT - smart proxy work, still incomplete and including debug println's and BTM markers, but checkpointed for syncing with trunk changes
Modified Paths:
--------------
branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractCounterSet.java
branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractFederation.java
branches/dev-btm/bigdata/src/java/com/bigdata/service/EmbeddedFederation.java
branches/dev-btm/bigdata/src/java/com/bigdata/service/LocalDataServiceFederation.java
branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java
branches/dev-btm/bigdata/src/test/com/bigdata/service/StressTestConcurrent.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/AbstractServicesManagerService.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ManageLogicalServiceTask.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/MonitorCreatePhysicalServiceLocksTask.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/RestartPersistentServices.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServiceConfigurationZNodeMonitorTask.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerServer.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerStartupTask.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/AbstractHostConstraint.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/BigdataServiceConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JavaServiceConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/JiniCoreServicesConfiguration.java
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/LoadBalancerConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ManagedServiceConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ServiceConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ServicesManagerConfiguration.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/config/ZookeeperServerEntry.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/JiniServiceProcessHelper.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/process/ProcessHelper.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/EmbeddedLoadBalancer.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/ServiceProxy.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/loadbalancer/config/logging.properties
branches/dev-btm/bigdata-jini/src/java/com/bigdata/metadata/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/AbstractServer.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/JiniFederation.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/lookup/LoadBalancerClient.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/service/jini/util/JiniServicesHelper.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/transaction/ServiceImpl.java
branches/dev-btm/bigdata-jini/src/java/com/bigdata/util/Util.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/zookeeper/testzoo.config
branches/dev-btm/build.properties
branches/dev-btm/build.xml
branches/dev-btm/src/resources/config/bigdataCluster.config
branches/dev-btm/src/resources/config/jini/reggie.config
branches/dev-btm/src/resources/config/log4j.properties
branches/dev-btm/src/resources/config/logging.properties
Added Paths:
-----------
branches/dev-btm/bigdata-jini/src/java/com/bigdata/util/EntryUtil.java
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractCounterSet.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractCounterSet.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/counters/AbstractCounterSet.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -42,6 +42,8 @@
*/
public abstract class AbstractCounterSet implements ICounterSet {
+public static org.apache.log4j.Logger logger = com.bigdata.util.config.LogUtil.getLog4jLogger((AbstractCounterSet.class).getName());
+
protected final String name;
protected AbstractCounterSet parent;
@@ -198,11 +200,39 @@
if( path.contains("//")) {
+if (logger.isEnabledFor(org.apache.log4j.Level.WARN)) {
+ logger.warn("***** AbstractCounterSet.getPath: CONTAINS SLASH-SLASH: path INPUT = "+path);
+ logger.warn("***** AbstractCounterSet.getPath: path.length = "+path.length());
+ byte[] pathBytes = path.getBytes();
+ StringBuffer strBuf = new StringBuffer();
+ if( (pathBytes[0] < 32) || (pathBytes[0] > 126) ) {
+ strBuf.append("X");
+ }else{
+ strBuf.append( new String(new byte[] {pathBytes[0]}) );
+ }
+ for(int i=1;i<pathBytes.length; i++) {
+ if( (pathBytes[i] < 32) || (pathBytes[i] > 126) ) {
+ strBuf.append("X");
+ }else{
+ strBuf.append( new String(new byte[] {pathBytes[i]}) );
+ }
+ }
+ logger.warn("***** AbstractCounterSet.getPath: CONTAINS SLASH-SLASH: path CONVERTED = "+strBuf.toString());
+}
+int slashSlashIndex = path.indexOf("//");
+if(slashSlashIndex >= 0) {//contains "//"
+ logger.warn("***** AbstractCounterSet.getPath: INDEX OF SLASH-SLASH = "+slashSlashIndex);
+}else{//does not contain "//"
+ logger.warn("***** AbstractCounterSet.getPath: !!!! path CONTAINS SLASH-SLASH, but indexOf = "+slashSlashIndex+" !!!!");
+}
+
+if(slashSlashIndex >= 0) {//throw exception only if BOTH path.contains AND path.indexOf say that the given path contains "//"
/*
* Empty path names are not allowed.
*/
throw new IllegalArgumentException(path);
+}//BTM
}
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractFederation.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractFederation.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/service/AbstractFederation.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -1388,7 +1388,7 @@
// Note: This _is_ a local method call.
final UUID serviceUUID = fed.getServiceUUID();
-
+System.out.println("\n>>>>> AbstractFederation.reportPerformanceCounters: serviceUUID = "+serviceUUID);
// Will be null until assigned by the service registrar.
if (serviceUUID == null) {
@@ -1403,12 +1403,14 @@
final LoadBalancer loadBalancerService = fed.getLoadBalancerService();
if (loadBalancerService == null) {
+System.out.println(">>>>> AbstractFederation.reportPerformanceCounters: loadBalancerService = NULL");
log.warn("Could not discover load balancer service.");
return;
}
+System.out.println(">>>>> AbstractFederation.reportPerformanceCounters: loadBalancerService = "+loadBalancerService);
/*
* @todo this is probably worth compressing as there will be a lot
@@ -1419,9 +1421,12 @@
final ByteArrayOutputStream baos = new ByteArrayOutputStream(
Bytes.kilobyte32 * 2);
+System.out.println(">>>>> AbstractFederation.reportPerformanceCounters: CALLING fed.getCounterSet() ...");
fed.getCounterSet().asXML(baos, "UTF-8", null/* filter */);
+System.out.println(">>>>> AbstractFederation.reportPerformanceCounters: CALLING loadBalancer.notify ...");
loadBalancerService.notify(serviceUUID, baos.toByteArray());
+System.out.println(">>>>> AbstractFederation.reportPerformanceCounters: DONE CALLING loadBalancer.notify");
if (log.isInfoEnabled())
log.info("Notified the load balancer.");
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/service/EmbeddedFederation.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/service/EmbeddedFederation.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/service/EmbeddedFederation.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -620,6 +620,9 @@
//BTM p.setProperty(LoadBalancerService.Options.TRANSIENT, "true");
p.setProperty(EmbeddedLoadBalancerServiceImpl.Options.TRANSIENT, "true");
+p.setProperty(EmbeddedLoadBalancerServiceImpl.Options.LOG_DIR,
+ new File(EmbeddedLoadBalancerServiceImpl.Options.DEFAULT_LOG_DIR).toString());
+
} else {
// specify the data directory for the load balancer.
@@ -860,6 +863,7 @@
{
super(serviceUUID, hostname,
sdm,
+properties.getProperty(EmbeddedLoadBalancerServiceImpl.Options.LOG_DIR),
//BTM*** EmbeddedFederation.this,
dataServiceMap,//BTM*** - remove after DataService smart proxy?
properties);
Modified: branches/dev-btm/bigdata/src/java/com/bigdata/service/LocalDataServiceFederation.java
===================================================================
--- branches/dev-btm/bigdata/src/java/com/bigdata/service/LocalDataServiceFederation.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/service/LocalDataServiceFederation.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -193,6 +193,7 @@
loadBalancerService = new EmbeddedLoadBalancer(UUID.randomUUID(),
hostname,
null,//SDM - replace with real SDM after conversion to smart proxy?
+p.getProperty(EmbeddedLoadBalancer.Options.LOG_DIR),
//BTM*** LocalDataServiceFederation.this,
//BTM*** remove after EmbeddedDataService is converted to smart proxy?
dataServiceMap,
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-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/java/com/bigdata/util/config/NicUtil.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -505,6 +505,253 @@
}
/**
+ * 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:
+ * <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>
+ * <p>
+ * This method can be called from within a configuration
+ * as well as from within program control.
+ *
+ * @param systemPropertyName <code>String</code> value containing
+ * the name of a system property whose
+ * value is the network interface name
+ * whose ip address should be returned.
+ * May be <code>null</code>.
+ *
+ * @param defaultNic <code>String</code> value containing
+ * the name of the network interface
+ * whose ip address should be returned
+ * if <code>null</code> is input for 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>, 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
+ {
+ if(systemPropertyName != null) {//system property takes precedence
+ String nicName = System.getProperty(systemPropertyName);
+ boolean propSet = true;
+ if(nicName == null) {
+ propSet = false;
+ } else {
+ // handle ant script case where the system property
+ // may not have been set on the command line, but
+ // was still set to "${<systemPropertyName>}" using
+ // ant <sysproperty> tag
+ String rawProp = "${" + systemPropertyName + "}";
+ if( rawProp.equals(nicName) ) propSet = false;
+ }
+ if(propSet) {
+ return getIpAddress(nicName, 0, loopbackOk);
+ } else {//desired system property not set, try fallback
+ if(fallbackOk) {
+ return getDefaultIpv4Address(loopbackOk);
+ } else {
+ return null;
+ }
+ }
+ } else {//no system property name provided, try default nic
+ if(defaultNic != null) {
+ return getIpAddress(defaultNic, 0, loopbackOk);
+ } else {//no default nic provided, try fallback
+ if(fallbackOk) {
+ return getDefaultIpv4Address(loopbackOk);
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+
+ 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
+ * <code>String</code> value of the first such address that is
+ * determined to be both <i>reachable</i> and an address type
+ * that represents an <i>IPv4</i> address.
+ *
+ * This method will always first examine addresses that are
+ * <i>not</i> the <i>loopback</i> address (<i>local host</i>);
+ * returning a loopback adddress only if <code>true</code>
+ * is input for the <code>loopbackOk</code> parameter, and
+ * none of the non-loopback addresses satisfy this method's
+ * search criteria.
+ *
+ * If this method fails to find any address that satisfies the
+ * above criteria, then this method returns <code>null</code>.
+ *
+ * @param loopbackOk if <code>true</code>, then upon failure
+ * find an non-<i>loopback</i> address that
+ * satisfies this method's search criteria
+ * (an IPv4 type address and reachable), the
+ * first loopback address that is found to be
+ * reachable is returned.
+ *
+ * If <code>false</code> is input for this
+ * parameter, then this method will examine
+ * only those addresses that do <i>not</i>
+ * correspond to the corresponding nic's
+ * loopback address.
+ *
+ * @return a <code>String</code> value representing the first
+ * network interface address installed on the current
+ * node that is determined to be both <i>reachable</i>
+ * and an IPv4 type address; where the return value
+ * corresponds to a <i>loopback</i> address only if
+ * <code>true</code> is input for the <code>loopbackOk</code>
+ * parameter, and no non-loopback address satisfying
+ * the desired criteria can be found. If this method
+ * fails to find any address that satisfies the desired
+ * criteria, then <code>null</code> is returned.
+ *
+ * @throws SocketException if there is an error in the underlying
+ * I/O subsystem and/or protocol while retrieving the
+ * the network interfaces currently installed on the
+ * node.
+ *
+ * @throws IOException if a network error occurs while determining
+ * if a candidate return address is <i>reachable</i>.
+ */
+ public static String getDefaultIpv4Address(boolean loopbackOk)
+ throws SocketException, IOException
+ {
+ //get all nics on the current node
+ Enumeration<NetworkInterface> nics =
+ NetworkInterface.getNetworkInterfaces();
+ while( nics.hasMoreElements() ) {
+ NetworkInterface curNic = nics.nextElement();
+ List<InterfaceAddress> interfaceAddrs =
+ curNic.getInterfaceAddresses();
+ for(InterfaceAddress interfaceAddr : interfaceAddrs) {
+ InetAddress inetAddr = interfaceAddr.getAddress();
+ boolean isIpv4 = inetAddr instanceof Inet4Address;
+ boolean isLoopbackAddress = inetAddr.isLoopbackAddress();
+ if(isIpv4) {
+ if(isLoopbackAddress) continue;
+ boolean isReachable = inetAddr.isReachable(3*1000);
+ Inet4Address inet4Addr = (Inet4Address)inetAddr;
+ String retVal = inet4Addr.getHostAddress();
+
+ jiniConfigLogger.log
+ (CONFIG, "default IPv4 address: "+retVal);
+ utilLogger.log
+ (Level.TRACE, "default IPv4 address: "+retVal);
+ return retVal;
+ }
+ }
+ }
+
+ if(!loopbackOk) return null;
+
+ nics = NetworkInterface.getNetworkInterfaces();
+ while( nics.hasMoreElements() ) {
+ NetworkInterface curNic = nics.nextElement();
+ List<InterfaceAddress> interfaceAddrs =
+ curNic.getInterfaceAddresses();
+ for(InterfaceAddress interfaceAddr : interfaceAddrs) {
+ InetAddress inetAddr = interfaceAddr.getAddress();
+ boolean isIpv4 = inetAddr instanceof Inet4Address;
+ boolean isLoopbackAddress = inetAddr.isLoopbackAddress();
+ if(isIpv4) {
+ if(!isLoopbackAddress) continue;
+ boolean isReachable = inetAddr.isReachable(3*1000);
+ Inet4Address inet4Addr = (Inet4Address)inetAddr;
+ String retVal = inet4Addr.getHostAddress();
+
+ jiniConfigLogger.log
+ (CONFIG, "default IPv4 address: "+retVal);
+ utilLogger.log
+ (Level.TRACE, "default IPv4 address: "+retVal);
+ return retVal;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String getDefaultIpv4Address()
+ throws SocketException, IOException
+ {
+ return getDefaultIpv4Address(false);//localhost NOT ok
+ }
+
+ /**
* Intended for use by scripts.
*/
public static void main(String[] args) {
Modified: branches/dev-btm/bigdata/src/test/com/bigdata/service/StressTestConcurrent.java
===================================================================
--- branches/dev-btm/bigdata/src/test/com/bigdata/service/StressTestConcurrent.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata/src/test/com/bigdata/service/StressTestConcurrent.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -791,10 +791,12 @@
throws IOException {
// explicitly set the log level for the load balancer.
- LoadBalancerService.log.setLevel(Level.INFO);
+//BTM LoadBalancerService.log.setLevel(Level.INFO);
+EmbeddedLoadBalancer.logger.setLevel(Level.INFO);
- final AbstractEmbeddedLoadBalancerService lbs = ((AbstractEmbeddedLoadBalancerService) ((EmbeddedFederation<?>) fed)
- .getLoadBalancerService());
+//BTM final AbstractEmbeddedLoadBalancerService lbs = ((AbstractEmbeddedLoadBalancerService) ((EmbeddedFederation<?>) fed)
+//BTM .getLoadBalancerService());
+final EmbeddedLoadBalancer lbs = ((EmbeddedLoadBalancer)((EmbeddedFederation)fed).getLoadBalancerService());
final ServiceScore[] fakeServiceScores = new ServiceScore[2];
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-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/executor/ServiceImpl.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -286,7 +286,7 @@
+", locators="
+Util.writeArrayElementsToString(locatorsToJoin));
- waitThread = new Util.WaitOnInterruptThread();
+ waitThread = new Util.WaitOnInterruptThread(logger);
waitThread.start();
readyState.ready();//ready to accept calls from clients
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/AbstractServicesManagerService.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/AbstractServicesManagerService.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/AbstractServicesManagerService.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -67,6 +67,7 @@
* processes.
*/
+System.out.println("\nXXXXXXX AbstractServicesManagerService.add >>>>> KILLING process = "+service.name);
service.kill(true/* immediateShutdown */);
} catch (InterruptedException e) {
@@ -121,6 +122,7 @@
// halt our monitor tasks.
getFederation().cancelMonitoredTasks(true/* mayInterruptIfRunning */);
+System.out.println("\nXXXXXXX AbstractServicesManagerService.shutdown >>>>> KILLING CHILD PROCESSES");
// kill our children.
killChildProcesses(false/* immediateShutdown */);
@@ -146,6 +148,7 @@
// halt our monitor tasks.
getFederation().cancelMonitoredTasks(true/* mayInterruptIfRunning */);
+System.out.println("\nXXXXXXX AbstractServicesManagerService.shutdownNow >>>>> KILLING CHILD PROCESSES");
// kill our children.
killChildProcesses(true/* immediateShutdown */);
@@ -186,6 +189,7 @@
try {
+System.out.println("\nXXXXXXX AbstractServicesManagerService.killChildProcesses >>>>> calling Process.kill");
helper.kill(immediateShutdown);
} catch (Throwable t) {
@@ -301,6 +305,7 @@
/*
* Run startup.
*/
+System.out.println("\n*** AbstractServicesManagerService: setup() - ServicesManagerStartupTask().call() ***\n");
new ServicesManagerStartupTask(fed, config, true/* pushConfig */,
true/* restartServices */, this/* listener */).call();
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ManageLogicalServiceTask.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ManageLogicalServiceTask.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ManageLogicalServiceTask.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -107,6 +107,7 @@
this.configZPath = configZPath;
this.children = children;
this.config = config;
+System.out.println("\nEEEE ManageLogicalServiceTask.constructor: configZPath="+this.configZPath);
}
@@ -178,6 +179,7 @@
*/
protected void newLogicalService() throws KeeperException, InterruptedException {
+System.out.println("\nEEEE ManageLogicalServiceTask.newLogicalService: className="+config.className);
if (INFO)
log.info("className=" + config.className);
@@ -194,31 +196,38 @@
/*
* Create zpath for the new logical service.
*/
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATING ZNODE ---> configZPath="+configZPath+", LOGICAL_SERVICE_PREFIX="+BigdataZooDefs.LOGICAL_SERVICE_PREFIX+", path="+(configZPath+"/"+BigdataZooDefs.LOGICAL_SERVICE_PREFIX));
final String logicalServiceZPath = zookeeper.create(configZPath + "/"
+ BigdataZooDefs.LOGICAL_SERVICE_PREFIX, new byte[0], acl,
CreateMode.PERSISTENT_SEQUENTIAL);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATED ZNODE ---> logicalServiceZPath="+logicalServiceZPath);
/*
* The new znode (last path component of the new zpath).
*/
final String logicalServiceZNode = logicalServiceZPath
.substring(logicalServiceZPath.lastIndexOf('/') + 1);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: logicalServiceZNode="+logicalServiceZNode);
/*
* Create the znode that is the parent for the physical service
* instances (direct child of the logicalSevice znode).
*/
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATING ZNODE Physical Service Parent ---> logicalServiceZPath="+logicalServiceZPath+", PHYSICAL_SERVICES_CONTAINER="+BigdataZooDefs.PHYSICAL_SERVICES_CONTAINER+", path="+(logicalServiceZPath+"/"+BigdataZooDefs.PHYSICAL_SERVICES_CONTAINER));
zookeeper.create(logicalServiceZPath + "/"
+ BigdataZooDefs.PHYSICAL_SERVICES_CONTAINER, new byte[0], acl,
CreateMode.PERSISTENT);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATED Parent ZNODE ---> "+(logicalServiceZPath+"/"+BigdataZooDefs.PHYSICAL_SERVICES_CONTAINER));
/*
* Create the znode for the election of the primary physical service for
* this logical service (direct child of the logicalSevice znode).
*/
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATING Election ZNODE ---> logicalServiceZPath="+logicalServiceZPath+", MASTER_ELECTION="+BigdataZooDefs.MASTER_ELECTION+", path="+(logicalServiceZPath+"/"+BigdataZooDefs.MASTER_ELECTION));
zookeeper.create(logicalServiceZPath + "/"
+ BigdataZooDefs.MASTER_ELECTION, new byte[0], acl,
CreateMode.PERSISTENT);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATED Election ZNODE ---> "+(logicalServiceZPath+"/"+BigdataZooDefs.MASTER_ELECTION));
try {
@@ -239,14 +248,19 @@
* lock.
*/
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: zroot="+(fed.getZooConfig().zroot)+", LOCKS_CREATE_PHYSICAL_SERVICE="+BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE+", className="+config.className+", UNDERSCORE, logicalServiceZNode="+logicalServiceZNode);
+
final String lockNodeZPath = fed.getZooConfig().zroot + "/"
+ BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE + "/"
+ config.className + "_" + logicalServiceZNode;
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: *** lockNodeZPath="+lockNodeZPath);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATING ZNODE for physical service host decision ---> logicalServiceZPath="+logicalServiceZPath);
zookeeper
.create(lockNodeZPath, SerializerUtil
.serialize(logicalServiceZPath), acl,
CreateMode.PERSISTENT);
+System.out.println("EEEE ManageLogicalServiceTask.newLogicalService: CREATED ZNODE for physical service host decision ---> logicalServiceZPath="+logicalServiceZPath);
if (INFO)
log.info("Created lock node: " + lockNodeZPath);
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/MonitorCreatePhysicalServiceLocksTask.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/MonitorCreatePhysicalServiceLocksTask.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/MonitorCreatePhysicalServiceLocksTask.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -1,6 +1,7 @@
package com.bigdata.jini.start;
import java.io.IOException;
+import java.net.SocketException;
import java.net.UnknownHostException;
import java.nio.channels.FileLock;
import java.rmi.RemoteException;
@@ -121,12 +122,15 @@
* Note: This task runs until cancelled.
*/
public Void call() throws Exception {
+System.out.println("\nDDDD MonitorCreatePhysicalServiceLocksTask.call: zroot="+fed.getZooConfig().zroot);
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.call: BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE="+BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE);
/*
* All the locks of interest are direct children of this znode.
*/
final String locksZPath = fed.getZooConfig().zroot + "/"
+ BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE;
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.call: locksZPath="+locksZPath);
while (true) {
@@ -170,15 +174,17 @@
protected void acquireWatcherAndRun(final String locksZPath)
throws KeeperException, InterruptedException {
-
final ZooKeeper zookeeper = fed.getZookeeper();
/*
* Note: The UnknownChildrenWatcher will keep trying until it is
* able to establish the watch.
*/
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: locksZPath="+locksZPath);
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: ADD EVENT WATCHER");
final UnknownChildrenWatcher watcher = new UnknownChildrenWatcher(
zookeeper, locksZPath);
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: EVENT WATCHER ADDED");
try {
@@ -188,7 +194,9 @@
try {
// child znode.
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: WAITING FOR EVENT ...");
final String znode = watcher.queue.take();
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: *** EVENT ---> znode="+znode);
if (znode.endsWith(ZLockImpl.INVALID)) {
@@ -204,6 +212,7 @@
// path to the new lock node.
final String lockNodeZPath = locksZPath + "/" + znode;
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.acquireWatcherAndRun: lockNodeZPath="+lockNodeZPath);
if (log.isInfoEnabled())
log.info("new lock: zpath=" + lockNodeZPath);
@@ -508,6 +517,8 @@
final String logicalServiceZPath = (String) SerializerUtil
.deserialize(zookeeper.getData(lockNodeZPath, false,
new Stat()));
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.checkConstraintsAndStartService: lockNodeZPath="+lockNodeZPath);
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.checkConstraintsAndStartService: **** logicalServiceZPath="+logicalServiceZPath);
/*
* If we hack off the last path component, we now have the zpath for the
@@ -515,6 +526,7 @@
*/
final String serviceConfigZPath = logicalServiceZPath.substring(0,
logicalServiceZPath.lastIndexOf('/'));
+System.out.println("DDDD MonitorCreatePhysicalServiceLocksTask.checkConstraintsAndStartService: **** serviceConfigZPath="+serviceConfigZPath);
if (log.isInfoEnabled())
log.info("logicalServiceZPath=" + logicalServiceZPath);
@@ -662,6 +674,7 @@
try {
if (!isLocalService(attributes)) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: NOT local service >>> RETURNING WITHOUT STARTING ["+serviceConfig.className+"]");
/*
* The service does not live on this host so we do not have
@@ -672,7 +685,9 @@
}
- } catch (UnknownHostException ex) {
+ } catch (IOException ex) {//SocketException or UnknownHostException
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: IOException ["+serviceConfig.className+"]");
+ex.printStackTrace();
log.warn("className=" + serviceConfig.className
+ ", physicalServiceZPath=" + physicalServiceZPath, ex);
@@ -686,6 +701,7 @@
+ ", physicalServiceZPath=" + physicalServiceZPath);
// block until we can evaluate this service for restart.
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: LOCAL SERVICE >>> start it ["+serviceConfig.className+"] ... BLOCKING");
lock.lockInterruptibly();
try {
@@ -695,6 +711,7 @@
if (!shouldRestartPhysicalService(zookeeper, serviceConfig,
physicalServiceZPath, attributes)) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: should NOT RESTART service ["+serviceConfig.className+"]");
if (log.isInfoEnabled())
log.info("Will not restart: className="
@@ -709,6 +726,8 @@
} catch (RemoteException ex) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: RemoteException ["+serviceConfig.className+"]");
+ex.printStackTrace();
log.error("RMI problem: className=" + serviceConfig.className
+ ", physicalServiceZPath=" + physicalServiceZPath, ex);
@@ -716,6 +735,8 @@
return false;
} catch (KeeperException ex) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: KeeperException ["+serviceConfig.className+"]");
+ex.printStackTrace();
log.error("Zookeeper problem: className="
+ serviceConfig.className + ", physicalServiceZPath="
@@ -740,6 +761,7 @@
final LinkedList<IServiceConstraint> violatedConstraints = new LinkedList<IServiceConstraint>();
if (!serviceConfig.canStartService(fed, violatedConstraints)) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: restart PREVENTED BY CONSTRAINTS ["+serviceConfig.className+"] >>> violatedConstraints="+violatedConstraints);
log.warn("Restart prevented by constraints: className="
+ serviceConfig.className + ", physicalServiceZPath="
+ physicalServiceZPath + ", violatedConstraints="
@@ -755,6 +777,7 @@
log.warn("Will restart: className=" + serviceConfig.className
+ ", physicalServiceZPath=" + physicalServiceZPath);
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: WILL RESTART service ["+serviceConfig.className+"] >>> restartPhysicalService");
return restartPhysicalService(serviceConfig,
logicalServiceZPath, physicalServiceZPath, attributes);
@@ -764,11 +787,15 @@
log.error("Service restart interrupted: className="
+ serviceConfig.className + ", physicalServiceZPath="
+ physicalServiceZPath);
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: InterruptedException ["+serviceConfig.className+"]");
+t.printStackTrace();
// rethrow so that the caller will see the interrupt.
throw t;
} catch (Throwable t) {
+System.out.println("*** MonitorCreatePhysicalServiceLocks.restartIfNotRunning: RESTART ERROR - "+t+" ["+serviceConfig.className+"]");
+t.printStackTrace();
// log and ignore.
log.error("Service restart error: className="
@@ -1148,10 +1175,11 @@
*
* @return <code>true</code> if the service lives on this host.
*
+ * @throws SocketException
* @throws UnknownHostException
*/
protected boolean isLocalService(final Entry[] attributes)
- throws UnknownHostException {
+ throws SocketException, UnknownHostException {
boolean isLocalHost = false;
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/RestartPersistentServices.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/RestartPersistentServices.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/RestartPersistentServices.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -171,12 +171,15 @@
if (log.isInfoEnabled())
log.info("Considering " + serviceConfigZNodes.size()
+ " service configurations");
+System.out.println("\n*********************************************************");
+System.out.println("*** RestartPersistentServices.runOnce: Considering " + serviceConfigZNodes.size()+ " service configurations");
for (String serviceConfigZNode : serviceConfigZNodes) {
if (log.isInfoEnabled())
log.info("Considering service configuration: "
+ serviceConfigZNode);
+System.out.println("*** RestartPersistentServices.runOnce: Considering service configuration: "+ serviceConfigZNode);
/*
* Get the service configuration. We will need it iff we restart an
@@ -200,6 +203,7 @@
log.info("Considering " + logicalServiceZNodes.size()
+ " logical services configurations for "
+ serviceConfigZNode);
+System.out.println("*** RestartPersistentServices.runOnce: Considering " + logicalServiceZNodes.size()+ " logical services configurations for "+ serviceConfigZNode);
for (String logicalServiceZNode : logicalServiceZNodes) {
@@ -224,6 +228,7 @@
+ " physical services configurations for "
+ logicalServiceZNode + " of "
+ serviceConfigZNode);
+System.out.println("*** RestartPersistentServices.runOnce: Considering " + physicalServiceZNodes.size()+ " physical services configurations for "+ logicalServiceZNode + " of "+ serviceConfigZNode);
for (String physicalServiceZNode : physicalServiceZNodes) {
@@ -238,6 +243,7 @@
log.info("Considering: "
+ physicalServicesContainerZPath);
+System.out.println("*** RestartPersistentServices.runOnce >>> monitorCreatePhysicalServiceLocksTask.restartIfNotRunning <<<< [serviceConfig="+serviceConfig+", logicalServiceZPath="+logicalServiceZPath+", physicalServiceZPath="+physicalServiceZPath+"]");
monitorCreatePhysicalServiceLocksTask.restartIfNotRunning(
serviceConfig, logicalServiceZPath,
physicalServiceZPath, attributes);
@@ -247,6 +253,7 @@
}
}
+System.out.println("*********************************************************\n");
// Success.
return true;
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServiceConfigurationZNodeMonitorTask.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServiceConfigurationZNodeMonitorTask.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServiceConfigurationZNodeMonitorTask.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -93,6 +93,13 @@
// zpath for the service configuration node.
serviceConfigZPath = zroot + "/" + BigdataZooDefs.CONFIG + "/" + className;
+
+System.out.println("\nGGGG ServiceConfigurationZNodeMonitorTask.constructor: zroot = "+zroot);
+System.out.println( "GGGG ServiceConfigurationZNodeMonitorTask.constructor: className = "+className);
+System.out.println( "GGGG ServiceConfigurationZNodeMonitorTask.constructor: LOCKS_SERVICE_CONFIG_MONITOR = "+BigdataZooDefs.LOCKS_SERVICE_CONFIG_MONITOR);
+System.out.println( "GGGG ServiceConfigurationZNodeMonitorTask.constructor: CONFIG = "+BigdataZooDefs.CONFIG);
+System.out.println( "GGGG ServiceConfigurationZNodeMonitorTask.constructor: lockZPath = "+lockZPath);
+System.out.println( "GGGG ServiceConfigurationZNodeMonitorTask.constructor: serviceConfigZPath = "+serviceConfigZPath);
}
@@ -216,6 +223,7 @@
* Note: This is done while we are holding the zlock. If we loose the
* zlock, the we cancel the watcher until we can reacquire the zlock.
*/
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: SETTING WATCHER for ZNodes of interest ...");
final ServiceConfigurationHierarchyWatcher watcher = new ServiceConfigurationHierarchyWatcher(
zookeeper, serviceConfigZPath);
@@ -225,7 +233,11 @@
* them now and make sure that everything is in balance.
*/
final String[] watchedSet = watcher.getWatchedNodes();
-
+if(watchedSet == null) {
+ System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: znodes-of-interest = "+watchedSet);
+}else{
+ System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: znodes-of-interest = "+java.util.Arrays.asList(watchedSet));
+}
// Get the service configuration.
final ManagedServiceConfiguration config = (ManagedServiceConfiguration) SerializerUtil
.deserialize(zookeeper.getData(serviceConfigZPath, false,
@@ -237,16 +249,20 @@
while (true) {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: WAITING FOR EVENT ...");
final WatchedEvent e = watcher.queue.take();
if (!zlock.isLockHeld()) {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: LOST THE LOCK [event="+e+"]");
// Lost the lock.
break;
}
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: HANDLE EVENT [event="+e+"]");
handleEvent(zookeeper, watcher, e);
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: EVENT HANDLED [event="+e+"]");
}
@@ -307,6 +323,7 @@
if (config.serviceCount != children.size()) {
// adjust the #of logical service instances (blocks).
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.runWithLock: *** NEW LOGICAL SERVICE TASK");
config.newLogicalServiceTask(fed, listener, serviceConfigZPath,
children).call();
@@ -339,6 +356,7 @@
throws KeeperException, InterruptedException {
for (String s : watchedSet) {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: serviceConfigZPath = "+serviceConfigZPath+", zpath="+s);
switch (ServiceConfigurationZNodeEnum
.getType(serviceConfigZPath, s)) {
@@ -348,10 +366,12 @@
// the parent is the logicalService.
final String logicalServiceZPath = s.substring(0, s
.lastIndexOf('/'));
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: logicalServiceZPath = "+logicalServiceZPath);
// the znode of the logical service (last path component).
final String logicalServiceZNode = logicalServiceZPath
.substring(logicalServiceZPath.lastIndexOf('/') + 1);
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: logicalServiceZNode = "+logicalServiceZNode);
// get children (the list of physical services).
final List<String> children = zookeeper.getChildren(
@@ -365,9 +385,11 @@
+ ", targetReplicationCount="
+ config.replicationCount + ", #children="
+ children.size() + ", children=" + children);
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: serviceConfigZPath=" + serviceConfigZPath+ ", logicalServiceZPath=" + logicalServiceZPath+ ", targetReplicationCount="+ config.replicationCount + ", #children="+ children.size() + ", children=" + children);
// too few instances? : @todo handle too many instances also.
if (config.replicationCount > children.size()) {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: (config.replicationCount > children.size()) ["+config.replicationCount+" > "+children.size()+"]");
try {
@@ -384,9 +406,11 @@
+ "/" + config.className + "_"
+ logicalServiceZNode;
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: *** CREATING logicalServiceZPath under lockNodeZPath ---> [zroot="+zroot+", LOCKS_CREATE_PHYSICAL_SERVICE="+BigdataZooDefs.LOCKS_CREATE_PHYSICAL_SERVICE+", className="+config.className+", UNDERSCORE, logicalServiceZNode="+logicalServiceZNode+"] ---> lockNodeZPath = "+lockNodeZPath);
zookeeper.create(lockNodeZPath, SerializerUtil
.serialize(logicalServiceZPath), fed
.getZooConfig().acl, CreateMode.PERSISTENT);
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: *** CREATED ZNODE logicalServiceZNode under lockNodeZPath ---> logicalServiceZPath="+logicalServiceZPath+", lockNodeZPath="+lockNodeZPath);
if (log.isInfoEnabled())
log.info("Created lock node: " + lockNodeZPath);
@@ -396,7 +420,8 @@
// ignore.
}
-
+}else{
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.balancePhysicalServices: (config.replicationCount NOT GREATER THAN children.size()) ["+config.replicationCount+" <= "+children.size()+"]");
}
default:
@@ -468,6 +493,7 @@
.getType(serviceConfigZPath, zpath)) {
case ServiceConfiguration: {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.handleEvent - CASE = ServiceConfiguration: HANDLE EVENT [event="+e+"]");
// Get the service configuration.
final ManagedServiceConfiguration config = (ManagedServiceConfiguration) SerializerUtil
@@ -481,6 +507,7 @@
}
case LogicalService: {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.handleEvent - CASE = LogicalService: HANDLE EVENT [event="+e+"]");
// Get the service configuration.
final ManagedServiceConfiguration config = (ManagedServiceConfiguration) SerializerUtil
@@ -494,12 +521,14 @@
}
case PhysicalServicesContainer: {
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.handleEvent - CASE = PhysicalServiceContainter: HANDLE EVENT [event="+e+"]");
// Get the service configuration.
final ManagedServiceConfiguration config = (ManagedServiceConfiguration) SerializerUtil
.deserialize(zookeeper.getData(serviceConfigZPath, false,
new Stat()));
+System.out.println("GGGG ServiceConfigurationZNodeMonitorTask.handleEvent - CASE = PhysicalServiceContainter >>> balancePhysicalServices [event="+e+"]");
balancePhysicalServices(zookeeper, config, watchedSet);
break;
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerServer.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerServer.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerServer.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -58,7 +58,7 @@
import com.bigdata.service.DataService;
import com.bigdata.service.DefaultServiceFederationDelegate;
import com.bigdata.service.IDataService;
-import com.bigdata.service.ILoadBalancerService;
+//BTM import com.bigdata.service.ILoadBalancerService;
import com.bigdata.service.IMetadataService;
import com.bigdata.service.MetadataService;
import com.bigdata.service.jini.AbstractServer;
@@ -70,6 +70,9 @@
import com.sun.jini.start.ServiceDescriptor;
import com.sun.jini.start.ServiceStarter;
+//BTM
+import com.bigdata.service.LoadBalancer;
+
/**
* A class for bootstrapping a {@link JiniFederation} across a cluster based on
* a {@link Configuration} file describing some basic configuration parameters
@@ -215,7 +218,8 @@
* The two main services which require failover are the
* {@link ITransactionService} and the {@link IDataService} (which includes the
* {@link IMetadataService} as a special case). The loss of the
- * {@link ILoadBalancerService} is normally not critical as only history about
+BTM * {@link ILoadBalancerService} is normally not critical as only history about
+* {@link LoadBalancer} service is normally not critical as only history about
* the system load over time is lost.
*
* <h4>Transaction service</h4>
@@ -295,7 +299,8 @@
* and supports transactions over operations on the space. Gigaspaces has
* defined a variety of extensions that provide FIFO queues.
*
- * @todo The {@link MetadataService}, the {@link ILoadBalancerService}, and
+BTM * @todo The {@link MetadataService}, the {@link ILoadBalancerService}, and
+* @todo The {@link MetadataService}, the {@link LoadBalancer} service, and
* the {@link ITransactionService} MUST NOT have more than one logical
* instance in a federation. They can (eventually) have failover
* instances, but not peers. The {@link DataService} is the only one that
@@ -617,11 +622,42 @@
@Override
synchronized public void shutdownNow() {
+try {
+ net.jini.lookup.ServiceDiscoveryManager sdm = (server.getClient().getFederation()).getServiceDiscoveryManager();
+ net.jini.core.lookup.ServiceTemplate tmpl = new net.jini.core.lookup.ServiceTemplate(null, new Class[] {com.bigdata.service.Service.class}, null);
+ net.jini.core.lookup.ServiceItem[] serviceItems = sdm.lookup(tmpl, Integer.MAX_VALUE, Integer.MAX_VALUE, null, 5000L);
+ if(serviceItems.length > 0) {
+ for(int i=0; i<serviceItems.length; i++) {
+ Object srvcRef = serviceItems[i].service;
+ if(srvcRef == null) continue;
+ if(srvcRef instanceof net.jini.admin.Administrable) {
+ try {
+ Object srvcRefAdmin = ((net.jini.admin.Administrable)srvcRef).getAdmin();
+ if(srvcRefAdmin instanceof com.sun.jini.admin.DestroyAdmin) {
+ try {
+ ((com.sun.jini.admin.DestroyAdmin)srvcRefAdmin).destroy();
+ } catch(Throwable t) { }
+ } else {
+System.out.println("\nAAAA*** ServicesManagerService.shutdownNow: SERVICE ADMIN NOT INSTANCE OF DestroyAdmin ["+srvcRef+"]");
+ }//endif
+ } catch(Throwable t) {
+ t.printStackTrace();
+ }
+ } else {
+System.out.println("\nAAAA*** ServicesManagerService.shutdownNow: SERVICE NOT Administrable ["+srvcRef+"]");
+ }
+ }
+ }
+} catch(Throwable t) {
+ t.printStackTrace();
+}
+
// immediate service shutdown (blocks).
super.shutdownNow();
// jini service and server shutdown.
server.shutdownNow(false/*destroy*/);
+
}
@@ -678,6 +714,7 @@
final ConfigurationFile config = (ConfigurationFile) ConfigurationProvider
.getInstance(server.args);
+System.out.println("\nAAAA*** ServicesManagerService.AdministrableServicesManagerService: sighup() - fed.submitMonitoredTask(new ServicesManagerStartupTask() ***\n");
fed.submitMonitoredTask(new ServicesManagerStartupTask(fed,
config, pushConfig, restartServices, this));
Modified: branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerStartupTask.java
===================================================================
--- branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerStartupTask.java 2010-07-23 11:04:00 UTC (rev 3268)
+++ branches/dev-btm/bigdata-jini/src/java/com/bigdata/jini/start/ServicesManagerStartupTask.java 2010-07-23 12:19:14 UTC (rev 3269)
@@ -139,6 +139,7 @@
for (ServiceConfiguration serviceConfig : serviceConfigurations) {
if (serviceConfig instanceof ZookeeperServerConfiguration) {
+System.out.println("\n---- ServicesManagerStartupTask.doStartup: startZookeeperService() ----");
startZookeeperService(config);
@@ -153,6 +154,7 @@
if (serviceConfig instanceof JiniCoreServicesConfiguration) {
+System.out.println("\n---- ServicesManagerStartupTask.doStartup: startJiniCoreServices() ----");
startJiniCoreServices(config);
}
@@ -169,10 +171,11 @@
final long begin = System.nanoTime();
- long nanos = TimeUnit.MILLISECONDS
- .toNanos(selfConfig.zookeeperDiscoveryTimeoutNanos);
-
+//BTM long nanos = TimeUnit.MILLISECONDS
+//BTm .toNanos(selfConfig.zookeeperDiscoveryTimeoutNanos);
+long nanos = selfConfig.zookeeperDiscoveryTimeoutNanos;
// await zookeeper connection.
+System.out.println("\n*** ServicesManagerStartupTask.doStartup: WAIT FOR ZOOKEEPER [zookeeperDiscoveryTimeoutNanos="+selfConfig.zookeeperDiscoveryTimeoutNanos+", nanos="+nanos+"] ***");
if (!fed.getZookeeperAccessor().awaitZookeeperConnected(nanos,
TimeUnit.NANOSECONDS)) {
@@ -189,6 +192,7 @@
* discovered and you can kill it if there is a problem.
*/
// await jini registrar(s)
+System.out.println("\n*** ServicesManagerStartupTask.doStartup: WAIT FOR LOOKUP ["+nanos+" nanoseconds] ***");
if (!fed.awaitJiniRegistrars(nanos, TimeUnit.NANOSECONDS)) {
throw new Exception(
@@ -197,6 +201,7 @@
}
}
+System.out.println("\n*** ServicesManagerStartupTask.doStartup: Lookup Service DISCOVERED *...
[truncated message content] |