Omit Managix [nc|cc].java.opts From HTTP Api, Ini > Env

- Managix options for cc / nc java opts are not used for NC service
  clusters, omit these from the cluster HTTP api.
- Ini jvm.args should take precedence over $JAVA_OPTS in environment
  when launching NCDriver

Change-Id: If52da9f5cc2a66b7c327f39a6e4ea51d4a8ccf89
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1301
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
Integration-Tests: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
index d076f74..0db4561 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
@@ -6,7 +6,6 @@
     },
     "config": {
         "api.port": 19002,
-        "cc.java.opts": "-Xmx1024m",
         "cluster.partitions": {
             "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
             "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
@@ -33,7 +32,6 @@
         "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
         "metadata.port": 0,
         "metadata.registration.timeout.secs": 60,
-        "nc.java.opts": "-Xmx1024m",
         "node.partitions": {
             "asterix_nc1": [
                 "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
index 1a9096d..15a1f39 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
@@ -92,13 +92,11 @@
                 PropertyInterpreters.getLevelPropertyInterpreter());
     }
 
-    @PropertyKey(EXTERNAL_NC_JAVA_OPTS_KEY)
     public String getNCJavaParams() {
         return accessor.getProperty(EXTERNAL_NC_JAVA_OPTS_KEY, EXTERNAL_NC_JAVA_OPTS_DEFAULT,
                 PropertyInterpreters.getStringPropertyInterpreter());
     }
 
-    @PropertyKey(EXTERNAL_CC_JAVA_OPTS_KEY)
     public String getCCJavaParams() {
         return accessor.getProperty(EXTERNAL_CC_JAVA_OPTS_KEY, EXTERNAL_CC_JAVA_OPTS_DEFAULT,
                 PropertyInterpreters.getStringPropertyInterpreter());
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
index 848bdd2..8ca61ad 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
@@ -105,17 +105,20 @@
     }
 
     private static void configEnvironment(Map<String,String> env) {
-        if (env.containsKey("JAVA_OPTS")) {
-            if (LOGGER.isLoggable(Level.INFO)) {
-                LOGGER.info("Keeping JAVA_OPTS from environment");
+        String jvmargs = IniUtils.getString(ini, nodeSection, "jvm.args", null);
+        if (jvmargs != null) {
+            LOGGER.info("Using JAVA_OPTS from conf file (jvm.args)");
+        } else {
+            jvmargs = env.get("JAVA_OPTS");
+            if (jvmargs != null) {
+                LOGGER.info("Using JAVA_OPTS from environment");
+            } else {
+                LOGGER.info("Using default JAVA_OPTS");
+                jvmargs = "-Xmx1536m";
             }
-            return;
         }
-        String jvmargs = IniUtils.getString(ini, nodeSection, "jvm.args", "-Xmx1536m");
         env.put("JAVA_OPTS", jvmargs);
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Setting JAVA_OPTS to " + jvmargs);
-        }
+        LOGGER.info("Setting JAVA_OPTS to " + jvmargs);
     }
 
     /**