abdullah alamoudi has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1323
Change subject: Remove Redundant Shutdown Hook
......................................................................
Remove Redundant Shutdown Hook
Currently, when we start a NodeControllerService, we add
its shutdown hook to the runtime. The NCDriver does that as well.
This change removes the NCDriver's addition of the shutdown hook
and moves the NCShutdown hook to its own class.
Change-Id: Ie9b4e2c870feb36fb25f35034dcfe3e315b9d183
---
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
2 files changed, 4 insertions(+), 15 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/23/1323/1
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
index 2d0a49d..cbd8edd 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
@@ -39,23 +39,12 @@
System.exit(1);
}
ncConfig.loadConfigAndApplyDefaults();
-
final NodeControllerService nService = new
NodeControllerService(ncConfig);
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.severe("Setting uncaught exception handler " +
nService.getLifeCycleComponentManager());
}
Thread.currentThread().setUncaughtExceptionHandler(nService.getLifeCycleComponentManager());
nService.start();
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- try {
- nService.stop();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
while (true) {
Thread.sleep(10000);
}
diff --git
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
index ed46b53..8a99bab 100644
---
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
+++
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
@@ -328,7 +328,7 @@
}
//add JVM shutdown hook
- Runtime.getRuntime().addShutdownHook(new JVMShutdownHook(this));
+ Runtime.getRuntime().addShutdownHook(new NCShutdownHook(this));
}
private void startApplication() throws Exception {
@@ -603,12 +603,12 @@
/**
* Shutdown hook that invokes {@link NodeControllerService#stop() stop}
method.
*/
- private static class JVMShutdownHook extends Thread {
+ private static class NCShutdownHook extends Thread {
private final NodeControllerService nodeControllerService;
- public JVMShutdownHook(NodeControllerService ncAppEntryPoint) {
- this.nodeControllerService = ncAppEntryPoint;
+ public NCShutdownHook(NodeControllerService nodeControllerService) {
+ this.nodeControllerService = nodeControllerService;
}
@Override
--
To view, visit https://asterix-gerrit.ics.uci.edu/1323
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9b4e2c870feb36fb25f35034dcfe3e315b9d183
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>