fix lifecycle issue introduced by hyracks nc fix
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 3502abb..5423d2a 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -14,7 +14,6 @@
*/
package edu.uci.ics.asterix.hyracks.bootstrap;
-import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Map;
@@ -56,10 +55,7 @@
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Starting Asterix node controller TAKE NOTE: " + nodeId);
}
- JVMShutdownHook sHook = new JVMShutdownHook(this);
- Runtime.getRuntime().addShutdownHook(sHook);
-
runtimeContext = new AsterixAppRuntimeContext(ncApplicationContext);
runtimeContext.initialize();
ncApplicationContext.setApplicationObject(runtimeContext);
@@ -145,7 +141,7 @@
IMetadataNode stub = null;
stub = (IMetadataNode) UnicastRemoteObject.exportObject(MetadataNode.INSTANCE, 0);
proxy.setMetadataNode(stub);
-
+
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Metadata node bound");
}
@@ -154,7 +150,7 @@
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Starting lifecycle components");
}
-
+
Map<String, String> lifecycleMgmtConfiguration = new HashMap<String, String>();
String key = LifeCycleComponentManager.Config.DUMP_PATH_KEY;
String value = metadataProperties.getCoredumpPath(nodeId);
@@ -166,7 +162,7 @@
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Configured:" + LifeCycleComponentManager.INSTANCE);
}
-
+
LifeCycleComponentManager.INSTANCE.startAll();
IRecoveryManager recoveryMgr = runtimeContext.getTransactionSubsystem().getRecoveryManager();
@@ -176,29 +172,4 @@
// reclaim storage for orphaned index artifacts in NCs.
}
- /**
- * Shutdown hook that invokes {@link NCApplicationEntryPoint#stop() stop} method.
- */
- private static class JVMShutdownHook extends Thread {
-
- private final NCApplicationEntryPoint ncAppEntryPoint;
-
- public JVMShutdownHook(NCApplicationEntryPoint ncAppEntryPoint) {
- this.ncAppEntryPoint = ncAppEntryPoint;
- }
-
- public void run() {
- if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("Shutdown hook in progress");
- }
- try {
- ncAppEntryPoint.stop();
- } catch (Exception e) {
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.warning("Exception in executing shutdown hook" + e);
- }
- }
- }
- }
-
}
\ No newline at end of file
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
index 455715d..1096da3 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -210,18 +210,7 @@
public static void stopUniverse() throws HyracksDataException {
// Close all BTree files in BufferCache.
- for (int i = 0; i < primaryIndexes.length; i++) {
- long resourceID = localResourceRepository
- .getResourceByName(primaryIndexes[i].getFile().getFile().getPath()).getResourceId();
- indexLifecycleManager.close(resourceID);
- indexLifecycleManager.unregister(resourceID);
- }
- for (int i = 0; i < secondaryIndexes.length; i++) {
- long resourceID = localResourceRepository.getResourceByName(
- secondaryIndexes[i].getFile().getFile().getPath()).getResourceId();
- indexLifecycleManager.close(resourceID);
- indexLifecycleManager.unregister(resourceID);
- }
+ // metadata datasets will be closed when the dataset life cycle manger is closed
}
public static void insertInitialDataverses(MetadataTransactionContext mdTxnCtx) throws Exception {