Merge asterix_stabilization_api_cleanup r1498:r1504.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1507 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-events/src/main/resources/events/node_failure/nc_failure.sh b/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
index 3ca083c..c562bf2 100755
--- a/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
+++ b/asterix-events/src/main/resources/events/node_failure/nc_failure.sh
@@ -5,3 +5,11 @@
PID_INFO=`ps -ef | grep asterix | grep -v grep | grep -v nc_join | grep $PARENT_ID`
PID=`echo $PID_INFO | cut -d " " -f2`
kill -15 $PID
+
+cmd_output=$(jps|grep $PID)
+while [ ${#cmd_output} -ne 0 ]
+do
+ sleep 1
+ kill -15 $PID
+ cmd_output=$(jps|grep $PID)
+done
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
index 0e10414..dfd8c5e 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
@@ -40,19 +40,24 @@
AsterixInstance asterixInstance = InstallerUtil.validateAsterixInstanceExists(asterixInstanceName,
State.ACTIVE, State.UNUSABLE);
PatternCreator pc = new PatternCreator();
- List<Pattern> patternsToExecute = new ArrayList<Pattern>();
- patternsToExecute.add(pc.createCCStopPattern(asterixInstance.getCluster().getMasterNode().getId()));
-
- for (Node node : asterixInstance.getCluster().getNode()) {
- patternsToExecute.add(pc.createNCStopPattern(node.getId(), asterixInstanceName + "_" + node.getId()));
- }
EventrixClient client = InstallerUtil.getEventrixClient(asterixInstance.getCluster());
+
+ List<Pattern> ncKillPatterns = new ArrayList<Pattern>();
+ for (Node node : asterixInstance.getCluster().getNode()) {
+ ncKillPatterns.add(pc.createNCStopPattern(node.getId(), asterixInstanceName + "_" + node.getId()));
+ }
+
+ List<Pattern> ccKillPatterns = new ArrayList<Pattern>();
+ ccKillPatterns.add(pc.createCCStopPattern(asterixInstance.getCluster().getMasterNode().getId()));
+
try {
- client.submit(new Patterns(patternsToExecute));
+ client.submit(new Patterns(ncKillPatterns));
+ client.submit(new Patterns(ccKillPatterns));
} catch (Exception e) {
// processes are already dead
LOGGER.debug("Attempt to kill non-existing processess");
}
+
asterixInstance.setState(State.INACTIVE);
asterixInstance.setStateChangeTimestamp(new Date());
ServiceProvider.INSTANCE.getLookupService().updateAsterixInstance(asterixInstance);