asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject [2/6] asterixdb git commit: Unify structure of Cluster Controller and Node Controller
Date Fri, 10 Mar 2017 08:14:21 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/application/CCServiceContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/application/CCServiceContext.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/application/CCServiceContext.java
new file mode 100644
index 0000000..5075081
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/application/CCServiceContext.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.control.cc.application;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hyracks.api.application.ICCServiceContext;
+import org.apache.hyracks.api.application.IClusterLifecycleListener;
+import org.apache.hyracks.api.config.IApplicationConfig;
+import org.apache.hyracks.api.config.IOption;
+import org.apache.hyracks.api.context.ICCContext;
+import org.apache.hyracks.api.exceptions.HyracksException;
+import org.apache.hyracks.api.job.IJobLifecycleListener;
+import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.api.job.JobSpecification;
+import org.apache.hyracks.api.service.IControllerService;
+import org.apache.hyracks.control.cc.ClusterControllerService;
+import org.apache.hyracks.control.common.application.ServiceContext;
+import org.apache.hyracks.control.common.context.ServerContext;
+import org.apache.hyracks.control.common.utils.HyracksThreadFactory;
+import org.apache.hyracks.control.common.work.IResultCallback;
+
+public class CCServiceContext extends ServiceContext implements ICCServiceContext {
+    private final ICCContext ccContext;
+
+    protected final Set<String> initPendingNodeIds;
+    protected final Set<String> deinitPendingNodeIds;
+
+    protected IResultCallback<Object> initializationCallback;
+    protected IResultCallback<Object> deinitializationCallback;
+
+    private List<IJobLifecycleListener> jobLifecycleListeners;
+    private List<IClusterLifecycleListener> clusterLifecycleListeners;
+    private final ClusterControllerService ccs;
+
+    public CCServiceContext(ClusterControllerService ccs, ServerContext serverCtx, ICCContext ccContext,
+            IApplicationConfig appConfig) throws IOException {
+        super(serverCtx, appConfig, new HyracksThreadFactory("ClusterController"));
+        this.ccContext = ccContext;
+        this.ccs = ccs;
+        initPendingNodeIds = new HashSet<>();
+        deinitPendingNodeIds = new HashSet<>();
+        jobLifecycleListeners = new ArrayList<>();
+        clusterLifecycleListeners = new ArrayList<>();
+    }
+
+    @Override
+    public ICCContext getCCContext() {
+        return ccContext;
+    }
+
+    @Override
+    public void setDistributedState(Serializable state) {
+        this.distributedState = state;
+    }
+
+    @Override
+    public void addJobLifecycleListener(IJobLifecycleListener jobLifecycleListener) {
+        jobLifecycleListeners.add(jobLifecycleListener);
+    }
+
+    public synchronized void notifyJobStart(JobId jobId) throws HyracksException {
+        for (IJobLifecycleListener l : jobLifecycleListeners) {
+            l.notifyJobStart(jobId);
+        }
+    }
+
+    public synchronized void notifyJobFinish(JobId jobId) throws HyracksException {
+        for (IJobLifecycleListener l : jobLifecycleListeners) {
+            l.notifyJobFinish(jobId);
+        }
+    }
+
+    public synchronized void notifyJobCreation(JobId jobId, JobSpecification spec)
+            throws HyracksException {
+        for (IJobLifecycleListener l : jobLifecycleListeners) {
+            l.notifyJobCreation(jobId, spec);
+        }
+    }
+
+    @Override
+    public void addClusterLifecycleListener(IClusterLifecycleListener clusterLifecycleListener) {
+        clusterLifecycleListeners.add(clusterLifecycleListener);
+    }
+
+    public void notifyNodeJoin(String nodeId, Map<IOption, Object> ncConfiguration) throws HyracksException {
+        for (IClusterLifecycleListener l : clusterLifecycleListeners) {
+            l.notifyNodeJoin(nodeId, ncConfiguration);
+        }
+    }
+
+    public void notifyNodeFailure(Collection<String> deadNodeIds) throws HyracksException {
+        for (IClusterLifecycleListener l : clusterLifecycleListeners) {
+            l.notifyNodeFailure(deadNodeIds);
+        }
+    }
+
+    @Override
+    public IControllerService getControllerService() {
+        return ccs;
+    }
+
+    @Override
+    public Object getApplicationContext() {
+        return ccs.getApplicationContext();
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/executor/JobExecutor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/executor/JobExecutor.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/executor/JobExecutor.java
index 084bd1b..2150bdd 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/executor/JobExecutor.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/executor/JobExecutor.java
@@ -92,8 +92,8 @@ public class JobExecutor {
         this.jobRun = jobRun;
         this.predistributed = predistributed;
         solver = new PartitionConstraintSolver();
-        partitionProducingTaskClusterMap = new HashMap<PartitionId, TaskCluster>();
-        inProgressTaskClusters = new HashSet<TaskCluster>();
+        partitionProducingTaskClusterMap = new HashMap<>();
+        inProgressTaskClusters = new HashSet<>();
         solver.addConstraints(constraints);
         random = new Random();
     }
@@ -112,7 +112,7 @@ public class JobExecutor {
 
     public void startJob() throws HyracksException {
         startRunnableActivityClusters();
-        ccs.getApplicationContext().notifyJobStart(jobRun.getJobId());
+        ccs.getContext().notifyJobStart(jobRun.getJobId());
     }
 
     public void cancelJob() throws HyracksException {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobManager.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobManager.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobManager.java
index 649487b..45c7711 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobManager.java
@@ -41,7 +41,7 @@ import org.apache.hyracks.api.job.JobStatus;
 import org.apache.hyracks.api.job.resource.IJobCapacityController;
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.NodeControllerState;
-import org.apache.hyracks.control.cc.application.CCApplicationContext;
+import org.apache.hyracks.control.cc.application.CCServiceContext;
 import org.apache.hyracks.control.cc.cluster.INodeManager;
 import org.apache.hyracks.control.cc.scheduler.FIFOJobQueue;
 import org.apache.hyracks.control.cc.scheduler.IJobQueue;
@@ -205,10 +205,10 @@ public class JobManager implements IJobManager {
         checkJob(run);
         JobId jobId = run.getJobId();
         HyracksException caughtException = null;
-        CCApplicationContext appCtx = ccs.getApplicationContext();
-        if (appCtx != null) {
+        CCServiceContext serviceCtx = ccs.getContext();
+        if (serviceCtx != null) {
             try {
-                appCtx.notifyJobFinish(jobId);
+                serviceCtx.notifyJobFinish(jobId);
             } catch (HyracksException e) {
                 LOGGER.log(Level.SEVERE, e.getMessage(), e);
                 caughtException = e;
@@ -301,10 +301,10 @@ public class JobManager implements IJobManager {
         JobId jobId = run.getJobId();
         activeRunMap.put(jobId, run);
 
-        CCApplicationContext appCtx = ccs.getApplicationContext();
+        CCServiceContext serviceCtx = ccs.getContext();
         JobSpecification spec = run.getJobSpecification();
         if (!run.getExecutor().isPredistributed()) {
-            appCtx.notifyJobCreation(jobId, spec);
+            serviceCtx.notifyJobCreation(jobId, spec);
         }
         run.setStatus(JobStatus.RUNNING, null);
         executeJobInternal(run);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java
index 40a83a2..341834c 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/ApplicationMessageWork.java
@@ -21,7 +21,7 @@ package org.apache.hyracks.control.cc.work;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.hyracks.api.application.ICCApplicationContext;
+import org.apache.hyracks.api.application.ICCServiceContext;
 import org.apache.hyracks.api.deployment.DeploymentId;
 import org.apache.hyracks.api.messages.IMessage;
 import org.apache.hyracks.control.cc.ClusterControllerService;
@@ -49,7 +49,7 @@ public class ApplicationMessageWork extends AbstractHeartbeatWork {
 
     @Override
     public void runWork() {
-        final ICCApplicationContext ctx = ccs.getApplicationContext();
+        final ICCServiceContext ctx = ccs.getContext();
         try {
             final IMessage data = (IMessage) DeploymentUtils.deserialize(message, deploymentId, ctx);
             ccs.getExecutor().execute(new Runnable() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliDeployBinaryWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliDeployBinaryWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliDeployBinaryWork.java
index 6480674..c0ecffb 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliDeployBinaryWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliDeployBinaryWork.java
@@ -65,7 +65,7 @@ public class CliDeployBinaryWork extends SynchronizableWork {
             /**
              * Deploy for the cluster controller
              */
-            DeploymentUtils.deploy(deploymentId, binaryURLs, ccs.getApplicationContext()
+            DeploymentUtils.deploy(deploymentId, binaryURLs, ccs.getContext()
                     .getJobSerializerDeserializerContainer(), ccs.getServerContext(), false);
 
             /**

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliUnDeployBinaryWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliUnDeployBinaryWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliUnDeployBinaryWork.java
index de28c32..638c27d 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliUnDeployBinaryWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/CliUnDeployBinaryWork.java
@@ -20,7 +20,6 @@
 package org.apache.hyracks.control.cc.work;
 
 import java.util.Collection;
-import java.util.Set;
 import java.util.UUID;
 
 import org.apache.hyracks.api.deployment.DeploymentId;
@@ -62,7 +61,7 @@ public class CliUnDeployBinaryWork extends SynchronizableWork {
             /**
              * Deploy for the cluster controller
              */
-            DeploymentUtils.undeploy(deploymentId, ccs.getApplicationContext().getJobSerializerDeserializerContainer(),
+            DeploymentUtils.undeploy(deploymentId, ccs.getContext().getJobSerializerDeserializerContainer(),
                     ccs.getServerContext());
 
             /**

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/DistributeJobWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/DistributeJobWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/DistributeJobWork.java
index f0c3303..e5fd66a 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/DistributeJobWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/DistributeJobWork.java
@@ -28,7 +28,7 @@ import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.api.util.JavaSerializationUtils;
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.NodeControllerState;
-import org.apache.hyracks.control.cc.application.CCApplicationContext;
+import org.apache.hyracks.control.cc.application.CCServiceContext;
 import org.apache.hyracks.control.cc.cluster.INodeManager;
 import org.apache.hyracks.control.common.deployment.DeploymentUtils;
 import org.apache.hyracks.control.common.work.IResultCallback;
@@ -51,17 +51,17 @@ public class DistributeJobWork extends SynchronizableWork {
     @Override
     protected void doRun() throws Exception {
         try {
-            final CCApplicationContext appCtx = ccs.getApplicationContext();
+            final CCServiceContext ccServiceCtx = ccs.getContext();
             ccs.getPreDistributedJobStore().checkForExistingDistributedJobDescriptor(jobId);
             IActivityClusterGraphGeneratorFactory acggf =
-                    (IActivityClusterGraphGeneratorFactory) DeploymentUtils.deserialize(acggfBytes, null, appCtx);
+                    (IActivityClusterGraphGeneratorFactory) DeploymentUtils.deserialize(acggfBytes, null, ccServiceCtx);
             IActivityClusterGraphGenerator acgg =
-                    acggf.createActivityClusterGraphGenerator(jobId, appCtx, EnumSet.noneOf(JobFlag.class));
+                    acggf.createActivityClusterGraphGenerator(jobId, ccServiceCtx, EnumSet.noneOf(JobFlag.class));
             ActivityClusterGraph acg = acgg.initialize();
             ccs.getPreDistributedJobStore().addDistributedJobDescriptor(jobId, acg, acggf.getJobSpecification(),
                     acgg.getConstraints());
 
-            appCtx.notifyJobCreation(jobId, acggf.getJobSpecification());
+            ccServiceCtx.notifyJobCreation(jobId, acggf.getJobSpecification());
 
             byte[] acgBytes = JavaSerializationUtils.serialize(acg);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobStartWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobStartWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobStartWork.java
index 1253cf7..2dbb631 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobStartWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobStartWork.java
@@ -26,7 +26,7 @@ import org.apache.hyracks.api.job.IActivityClusterGraphGeneratorFactory;
 import org.apache.hyracks.api.job.JobFlag;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.cc.ClusterControllerService;
-import org.apache.hyracks.control.cc.application.CCApplicationContext;
+import org.apache.hyracks.control.cc.application.CCServiceContext;
 import org.apache.hyracks.control.cc.job.IJobManager;
 import org.apache.hyracks.control.cc.job.JobRun;
 import org.apache.hyracks.control.common.deployment.DeploymentUtils;
@@ -57,14 +57,14 @@ public class JobStartWork extends SynchronizableWork {
     protected void doRun() throws Exception {
         IJobManager jobManager = ccs.getJobManager();
         try {
-            final CCApplicationContext appCtx = ccs.getApplicationContext();
+            final CCServiceContext ccServiceCtx = ccs.getContext();
             JobRun run;
             if (!predestributed) {
                 //Need to create the ActivityClusterGraph
                 IActivityClusterGraphGeneratorFactory acggf = (IActivityClusterGraphGeneratorFactory) DeploymentUtils
-                        .deserialize(acggfBytes, deploymentId, appCtx);
+                        .deserialize(acggfBytes, deploymentId, ccServiceCtx);
                 IActivityClusterGraphGenerator acgg =
-                        acggf.createActivityClusterGraphGenerator(jobId, appCtx, jobFlags);
+                        acggf.createActivityClusterGraphGenerator(jobId, ccServiceCtx, jobFlags);
                 run = new JobRun(ccs, deploymentId, jobId, acggf, acgg, jobFlags);
             } else {
                 //ActivityClusterGraph has already been distributed

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
index e97950e..79033d8 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
@@ -65,7 +65,7 @@ public class RegisterNodeWork extends SynchronizableWork {
             LOGGER.log(Level.INFO, "Registered INodeController: id = " + id);
             NodeParameters params = new NodeParameters();
             params.setClusterControllerInfo(ccs.getClusterControllerInfo());
-            params.setDistributedState(ccs.getApplicationContext().getDistributedState());
+            params.setDistributedState(ccs.getContext().getDistributedState());
             params.setHeartbeatPeriod(ccs.getCCConfig().getHeartbeatPeriod());
             params.setProfileDumpPeriod(ccs.getCCConfig().getProfileDumpPeriod());
             result = new CCNCFunctions.NodeRegistrationResult(params, null);
@@ -73,6 +73,6 @@ public class RegisterNodeWork extends SynchronizableWork {
             result = new CCNCFunctions.NodeRegistrationResult(null, e);
         }
         ncIPCHandle.send(-1, result, null);
-        ccs.getApplicationContext().notifyNodeJoin(id, ncConfiguration);
+        ccs.getContext().notifyNodeJoin(id, ncConfiguration);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RemoveDeadNodesWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RemoveDeadNodesWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RemoveDeadNodesWork.java
index 410b75f..a162708 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RemoveDeadNodesWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RemoveDeadNodesWork.java
@@ -61,7 +61,7 @@ public class RemoveDeadNodesWork extends AbstractWork {
                 }
             }
             if (!deadNodes.isEmpty()) {
-                ccs.getApplicationContext().notifyNodeFailure(deadNodes);
+                ccs.getContext().notifyNodeFailure(deadNodes);
             }
         } catch (HyracksException e) {
             LOGGER.log(Level.WARNING, "Uncaught exception on notifyNodeFailure", e);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/test/java/org/apache/hyracks/control/cc/job/JobManagerTest.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/test/java/org/apache/hyracks/control/cc/job/JobManagerTest.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/test/java/org/apache/hyracks/control/cc/job/JobManagerTest.java
index 1628248..ed2a740 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/test/java/org/apache/hyracks/control/cc/job/JobManagerTest.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/test/java/org/apache/hyracks/control/cc/job/JobManagerTest.java
@@ -42,7 +42,7 @@ import org.apache.hyracks.api.job.JobStatus;
 import org.apache.hyracks.api.job.resource.IJobCapacityController;
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.NodeControllerState;
-import org.apache.hyracks.control.cc.application.CCApplicationContext;
+import org.apache.hyracks.control.cc.application.CCServiceContext;
 import org.apache.hyracks.control.cc.cluster.INodeManager;
 import org.apache.hyracks.control.cc.cluster.NodeManager;
 import org.apache.hyracks.control.common.base.INodeController;
@@ -279,10 +279,10 @@ public class JobManagerTest {
 
     private ClusterControllerService mockClusterControllerService() {
         ClusterControllerService ccs = mock(ClusterControllerService.class);
-        CCApplicationContext appCtx = mock(CCApplicationContext.class);
+        CCServiceContext ccServiceCtx = mock(CCServiceContext.class);
         LogFile logFile = mock(LogFile.class);
         INodeManager nodeManager = mockNodeManager();
-        when(ccs.getApplicationContext()).thenReturn(appCtx);
+        when(ccs.getContext()).thenReturn(ccServiceCtx);
         when(ccs.getJobLogFile()).thenReturn(logFile);
         when(ccs.getNodeManager()).thenReturn(nodeManager);
         when(ccs.getCCConfig()).thenReturn(ccConfig);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ApplicationContext.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ApplicationContext.java
deleted file mode 100644
index 42bc636..0000000
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ApplicationContext.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.control.common.application;
-
-import java.io.Serializable;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.hyracks.api.config.IApplicationConfig;
-import org.apache.hyracks.api.application.IApplicationContext;
-import org.apache.hyracks.api.job.IJobSerializerDeserializerContainer;
-import org.apache.hyracks.api.job.JobSerializerDeserializerContainer;
-import org.apache.hyracks.api.messages.IMessageBroker;
-import org.apache.hyracks.control.common.context.ServerContext;
-
-public abstract class ApplicationContext implements IApplicationContext {
-    protected final ServerContext serverCtx;
-    protected final IApplicationConfig appConfig;
-    protected ThreadFactory threadFactory;
-    protected Serializable distributedState;
-    protected IMessageBroker messageBroker;
-    protected IJobSerializerDeserializerContainer jobSerDeContainer = new JobSerializerDeserializerContainer();
-
-    public ApplicationContext(ServerContext serverCtx, IApplicationConfig appConfig, ThreadFactory threadFactory) {
-        this.serverCtx = serverCtx;
-        this.appConfig = appConfig;
-        this.threadFactory = threadFactory;
-    }
-
-    @Override
-    public Serializable getDistributedState() {
-        return distributedState;
-    }
-
-    @Override
-    public void setMessageBroker(IMessageBroker messageBroker) {
-        this.messageBroker = messageBroker;
-    }
-
-    @Override
-    public IMessageBroker getMessageBroker() {
-        return this.messageBroker;
-    }
-
-    @Override
-    public IJobSerializerDeserializerContainer getJobSerializerDeserializerContainer() {
-        return this.jobSerDeContainer;
-    }
-
-    @Override
-    public ThreadFactory getThreadFactory() {
-        return threadFactory;
-    }
-
-    @Override
-    public void setThreadFactory(ThreadFactory threadFactory) {
-        this.threadFactory = threadFactory;
-    }
-
-    @Override
-    public IApplicationConfig getAppConfig() {
-        return appConfig;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ServiceContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ServiceContext.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ServiceContext.java
new file mode 100644
index 0000000..1ee2315
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/application/ServiceContext.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.control.common.application;
+
+import java.io.Serializable;
+import java.util.concurrent.ThreadFactory;
+
+import org.apache.hyracks.api.config.IApplicationConfig;
+import org.apache.hyracks.api.application.IServiceContext;
+import org.apache.hyracks.api.job.IJobSerializerDeserializerContainer;
+import org.apache.hyracks.api.job.JobSerializerDeserializerContainer;
+import org.apache.hyracks.api.messages.IMessageBroker;
+import org.apache.hyracks.control.common.context.ServerContext;
+
+public abstract class ServiceContext implements IServiceContext {
+    protected final ServerContext serverCtx;
+    protected final IApplicationConfig appConfig;
+    protected ThreadFactory threadFactory;
+    protected Serializable distributedState;
+    protected IMessageBroker messageBroker;
+    protected IJobSerializerDeserializerContainer jobSerDeContainer = new JobSerializerDeserializerContainer();
+
+    public ServiceContext(ServerContext serverCtx, IApplicationConfig appConfig, ThreadFactory threadFactory) {
+        this.serverCtx = serverCtx;
+        this.appConfig = appConfig;
+        this.threadFactory = threadFactory;
+    }
+
+    @Override
+    public Serializable getDistributedState() {
+        return distributedState;
+    }
+
+    @Override
+    public void setMessageBroker(IMessageBroker messageBroker) {
+        this.messageBroker = messageBroker;
+    }
+
+    @Override
+    public IMessageBroker getMessageBroker() {
+        return this.messageBroker;
+    }
+
+    @Override
+    public IJobSerializerDeserializerContainer getJobSerializerDeserializerContainer() {
+        return this.jobSerDeContainer;
+    }
+
+    @Override
+    public ThreadFactory getThreadFactory() {
+        return threadFactory;
+    }
+
+    @Override
+    public void setThreadFactory(ThreadFactory threadFactory) {
+        this.threadFactory = threadFactory;
+    }
+
+    @Override
+    public IApplicationConfig getAppConfig() {
+        return appConfig;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java
index e033ff9..bb65f7f 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java
@@ -34,7 +34,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.hyracks.api.application.IApplicationContext;
+import org.apache.hyracks.api.application.IServiceContext;
 import org.apache.hyracks.api.deployment.DeploymentId;
 import org.apache.hyracks.api.exceptions.HyracksException;
 import org.apache.hyracks.api.job.IJobSerializerDeserializer;
@@ -111,18 +111,17 @@ public class DeploymentUtils {
      *            the bytes to be deserialized
      * @param deploymentId
      *            the deployment id
-     * @param appCtx
+     * @param serviceCtx
      * @return the deserialized object
      * @throws HyracksException
      */
-    public static Object deserialize(byte[] bytes, DeploymentId deploymentId, IApplicationContext appCtx)
+    public static Object deserialize(byte[] bytes, DeploymentId deploymentId, IServiceContext serviceCtx)
             throws HyracksException {
         try {
-            IJobSerializerDeserializerContainer jobSerDeContainer = appCtx.getJobSerializerDeserializerContainer();
+            IJobSerializerDeserializerContainer jobSerDeContainer = serviceCtx.getJobSerializerDeserializerContainer();
             IJobSerializerDeserializer jobSerDe = deploymentId == null ? null
                     : jobSerDeContainer.getJobSerializerDeserializer(deploymentId);
-            Object obj = jobSerDe == null ? JavaSerializationUtils.deserialize(bytes) : jobSerDe.deserialize(bytes);
-            return obj;
+            return jobSerDe == null ? JavaSerializationUtils.deserialize(bytes) : jobSerDe.deserialize(bytes);
         } catch (Exception e) {
             throw new HyracksException(e);
         }
@@ -133,14 +132,14 @@ public class DeploymentUtils {
      *
      * @param className
      * @param deploymentId
-     * @param appCtx
+     * @param serviceCtx
      * @return the loaded class
      * @throws HyracksException
      */
-    public static Class<?> loadClass(String className, DeploymentId deploymentId, IApplicationContext appCtx)
+    public static Class<?> loadClass(String className, DeploymentId deploymentId, IServiceContext serviceCtx)
             throws HyracksException {
         try {
-            IJobSerializerDeserializerContainer jobSerDeContainer = appCtx.getJobSerializerDeserializerContainer();
+            IJobSerializerDeserializerContainer jobSerDeContainer = serviceCtx.getJobSerializerDeserializerContainer();
             IJobSerializerDeserializer jobSerDe = deploymentId == null ? null
                     : jobSerDeContainer.getJobSerializerDeserializer(deploymentId);
             return jobSerDe == null ? JavaSerializationUtils.loadClass(className) : jobSerDe.loadClass(className);
@@ -157,7 +156,7 @@ public class DeploymentUtils {
      * @return
      * @throws HyracksException
      */
-    public static ClassLoader getClassLoader(DeploymentId deploymentId, IApplicationContext appCtx)
+    public static ClassLoader getClassLoader(DeploymentId deploymentId, IServiceContext appCtx)
             throws HyracksException {
         IJobSerializerDeserializerContainer jobSerDeContainer = appCtx.getJobSerializerDeserializerContainer();
         IJobSerializerDeserializer jobSerDe = deploymentId == null ? null
@@ -185,7 +184,7 @@ public class DeploymentUtils {
         while (tried < retryCount) {
             try {
                 tried++;
-                List<URL> downloadedFileURLs = new ArrayList<URL>();
+                List<URL> downloadedFileURLs = new ArrayList<>();
                 File dir = new File(deploymentDir);
                 if (!dir.exists()) {
                     FileUtils.forceMkdir(dir);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
new file mode 100644
index 0000000..869ab5b
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.control.nc;
+
+import java.lang.management.ManagementFactory;
+import java.util.Arrays;
+
+import org.apache.hyracks.api.application.INCApplication;
+import org.apache.hyracks.api.application.IServiceContext;
+import org.apache.hyracks.api.config.IConfigManager;
+import org.apache.hyracks.api.config.Section;
+import org.apache.hyracks.api.job.resource.NodeCapacity;
+import org.apache.hyracks.control.common.controllers.CCConfig;
+import org.apache.hyracks.control.common.controllers.ControllerConfig;
+import org.apache.hyracks.control.common.controllers.NCConfig;
+
+public class BaseNCApplication implements INCApplication {
+    public static final BaseNCApplication INSTANCE = new BaseNCApplication();
+
+    protected BaseNCApplication() {
+    }
+
+    @Override
+    public void start(IServiceContext ncAppCtx, String[] args) throws Exception {
+        if (args.length > 0) {
+            throw new IllegalArgumentException("Unrecognized argument(s): " + Arrays.toString(args));
+        }
+    }
+
+    @Override
+    public void startupCompleted() throws Exception {
+        // no-op
+    }
+
+    @Override
+    public void stop() throws Exception {
+        // no-op
+    }
+
+    @Override
+    public NodeCapacity getCapacity() {
+        int allCores = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
+        return new NodeCapacity(Runtime.getRuntime().maxMemory(), allCores > 1 ? allCores - 1 : allCores);
+    }
+
+    @Override
+    public void registerConfig(IConfigManager configManager) {
+        configManager.addIniParamOptions(ControllerConfig.Option.CONFIG_FILE, ControllerConfig.Option.CONFIG_FILE_URL);
+        configManager.addCmdLineSections(Section.NC, Section.COMMON, Section.LOCALNC);
+        configManager.setUsageFilter(getUsageFilter());
+        configManager.register(ControllerConfig.Option.class, CCConfig.Option.class, NCConfig.Option.class);
+    }
+
+    @Override
+    public Object getApplicationContext() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Joblet.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Joblet.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Joblet.java
index 25ab245..46aa992 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Joblet.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Joblet.java
@@ -27,7 +27,7 @@ import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
 
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 import org.apache.hyracks.api.comm.IPartitionCollector;
 import org.apache.hyracks.api.comm.PartitionChannel;
 import org.apache.hyracks.api.context.IHyracksJobletContext;
@@ -65,7 +65,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
 
     private final NodeControllerService nodeController;
 
-    private final INCApplicationContext appCtx;
+    private final INCServiceContext serviceCtx;
 
     private final DeploymentId deploymentId;
 
@@ -100,9 +100,9 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
     private boolean cleanupPending;
 
     public Joblet(NodeControllerService nodeController, DeploymentId deploymentId, JobId jobId,
-            INCApplicationContext appCtx, ActivityClusterGraph acg) {
+            INCServiceContext serviceCtx, ActivityClusterGraph acg) {
         this.nodeController = nodeController;
-        this.appCtx = appCtx;
+        this.serviceCtx = serviceCtx;
         this.deploymentId = deploymentId;
         this.jobId = jobId;
         this.frameManager = new FrameManager(acg.getFrameSize());
@@ -114,7 +114,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
         taskMap = new HashMap<>();
         counterMap = new HashMap<>();
         deallocatableRegistry = new DefaultDeallocatableRegistry();
-        fileFactory = new WorkspaceFileFactory(this, appCtx.getIoManager());
+        fileFactory = new WorkspaceFileFactory(this, serviceCtx.getIoManager());
         cleanupPending = false;
         IJobletEventListenerFactory jelf = acg.getJobletEventListenerFactory();
         if (jelf != null) {
@@ -197,8 +197,8 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
     }
 
     @Override
-    public INCApplicationContext getApplicationContext() {
-        return appCtx;
+    public INCServiceContext getServiceContext() {
+        return serviceCtx;
     }
 
     @Override
@@ -215,7 +215,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
         long stillAllocated = memoryAllocation.get();
         if (stillAllocated > 0) {
             LOGGER.warning("Freeing leaked " + stillAllocated + " bytes");
-            appCtx.getMemoryManager().deallocate(stillAllocated);
+            serviceCtx.getMemoryManager().deallocate(stillAllocated);
         }
         nodeController.getExecutorService().execute(new Runnable() {
             @Override
@@ -230,7 +230,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
     }
 
     ByteBuffer allocateFrame(int bytes) throws HyracksDataException {
-        if (appCtx.getMemoryManager().allocate(bytes)) {
+        if (serviceCtx.getMemoryManager().allocate(bytes)) {
             memoryAllocation.addAndGet(bytes);
             return frameManager.allocateFrame(bytes);
         }
@@ -244,7 +244,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
 
     void deallocateFrames(int bytes) {
         memoryAllocation.addAndGet(bytes);
-        appCtx.getMemoryManager().deallocate(bytes);
+        serviceCtx.getMemoryManager().deallocate(bytes);
         frameManager.deallocateFrames(bytes);
     }
 
@@ -253,7 +253,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
     }
 
     public IIOManager getIOManager() {
-        return appCtx.getIoManager();
+        return serviceCtx.getIoManager();
     }
 
     @Override
@@ -326,11 +326,11 @@ public class Joblet implements IHyracksJobletContext, ICounterContext {
 
     @Override
     public Class<?> loadClass(String className) throws HyracksException {
-        return DeploymentUtils.loadClass(className, deploymentId, appCtx);
+        return DeploymentUtils.loadClass(className, deploymentId, serviceCtx);
     }
 
     @Override
     public ClassLoader getClassLoader() throws HyracksException {
-        return DeploymentUtils.getClassLoader(deploymentId, appCtx);
+        return DeploymentUtils.getClassLoader(deploymentId, serviceCtx);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCApplicationEntryPoint.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCApplicationEntryPoint.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCApplicationEntryPoint.java
deleted file mode 100644
index d4e67fd..0000000
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCApplicationEntryPoint.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.control.nc;
-
-import java.lang.management.ManagementFactory;
-import java.util.Arrays;
-
-import org.apache.hyracks.api.application.INCApplicationContext;
-import org.apache.hyracks.api.application.INCApplicationEntryPoint;
-import org.apache.hyracks.api.config.IConfigManager;
-import org.apache.hyracks.api.config.Section;
-import org.apache.hyracks.api.job.resource.NodeCapacity;
-import org.apache.hyracks.control.common.controllers.CCConfig;
-import org.apache.hyracks.control.common.controllers.ControllerConfig;
-import org.apache.hyracks.control.common.controllers.NCConfig;
-
-public class NCApplicationEntryPoint implements INCApplicationEntryPoint {
-    public static final NCApplicationEntryPoint INSTANCE = new NCApplicationEntryPoint();
-
-    protected NCApplicationEntryPoint() {
-    }
-
-    @Override
-    public void start(INCApplicationContext ncAppCtx, String[] args) throws Exception {
-        if (args.length > 0) {
-            throw new IllegalArgumentException("Unrecognized argument(s): " + Arrays.toString(args));
-        }
-    }
-
-    @Override
-    public void notifyStartupComplete() throws Exception {
-        // no-op
-    }
-
-    @Override
-    public void stop() throws Exception {
-        // no-op
-    }
-
-    @Override
-    public NodeCapacity getCapacity() {
-        int allCores = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
-        return new NodeCapacity(Runtime.getRuntime().maxMemory(), allCores > 1 ? allCores - 1 : allCores);
-    }
-
-    @Override
-    public void registerConfigOptions(IConfigManager configManager) {
-        configManager.addIniParamOptions(ControllerConfig.Option.CONFIG_FILE, ControllerConfig.Option.CONFIG_FILE_URL);
-        configManager.addCmdLineSections(Section.NC, Section.COMMON, Section.LOCALNC);
-        configManager.setUsageFilter(getUsageFilter());
-        configManager.register(ControllerConfig.Option.class, CCConfig.Option.class, NCConfig.Option.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java
----------------------------------------------------------------------
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 b52064e..d36586f 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
@@ -23,7 +23,7 @@ import java.util.Arrays;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.hyracks.api.application.INCApplicationEntryPoint;
+import org.apache.hyracks.api.application.INCApplication;
 import org.apache.hyracks.control.common.config.ConfigManager;
 import org.apache.hyracks.control.common.config.ConfigUtils;
 import org.apache.hyracks.control.common.controllers.NCConfig;
@@ -40,10 +40,10 @@ public class NCDriver {
         try {
             final String nodeId = ConfigUtils.getOptionValue(args, NCConfig.Option.NODE_ID);
             final ConfigManager configManager = new ConfigManager(args);
-            INCApplicationEntryPoint appEntryPoint = getAppEntryPoint(args);
-            appEntryPoint.registerConfigOptions(configManager);
+            INCApplication application = getApplication(args);
+            application.registerConfig(configManager);
             NCConfig ncConfig = new NCConfig(nodeId, configManager);
-            final NodeControllerService ncService = new NodeControllerService(ncConfig, appEntryPoint);
+            final NodeControllerService ncService = new NodeControllerService(ncConfig, application);
             if (LOGGER.isLoggable(Level.SEVERE)) {
                 LOGGER.severe("Setting uncaught exception handler " + ncService.getLifeCycleComponentManager());
             }
@@ -62,11 +62,11 @@ public class NCDriver {
         }
     }
 
-    private static INCApplicationEntryPoint getAppEntryPoint(String[] args)
+    private static INCApplication getApplication(String[] args)
             throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
         // determine app class so that we can use the correct implementation of the configuration...
         String appClassName = ConfigUtils.getOptionValue(args, NCConfig.Option.APP_CLASS);
-        return appClassName != null ? (INCApplicationEntryPoint) (Class.forName(appClassName)).newInstance()
-                : NCApplicationEntryPoint.INSTANCE;
+        return appClassName != null ? (INCApplication) (Class.forName(appClassName)).newInstance()
+                : BaseNCApplication.INSTANCE;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
----------------------------------------------------------------------
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 2ee9161..b893d26 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
@@ -42,7 +42,7 @@ import java.util.logging.Logger;
 
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
-import org.apache.hyracks.api.application.INCApplicationEntryPoint;
+import org.apache.hyracks.api.application.INCApplication;
 import org.apache.hyracks.api.client.NodeControllerInfo;
 import org.apache.hyracks.api.comm.NetworkAddress;
 import org.apache.hyracks.api.dataset.IDatasetPartitionManager;
@@ -69,7 +69,7 @@ import org.apache.hyracks.control.common.job.profiling.om.JobProfile;
 import org.apache.hyracks.control.common.utils.PidHelper;
 import org.apache.hyracks.control.common.work.FutureValue;
 import org.apache.hyracks.control.common.work.WorkQueue;
-import org.apache.hyracks.control.nc.application.NCApplicationContext;
+import org.apache.hyracks.control.nc.application.NCServiceContext;
 import org.apache.hyracks.control.nc.dataset.DatasetPartitionManager;
 import org.apache.hyracks.control.nc.io.IOManager;
 import org.apache.hyracks.control.nc.io.profiling.IIOCounter;
@@ -130,9 +130,9 @@ public class NodeControllerService implements IControllerService {
 
     private final ServerContext serverCtx;
 
-    private NCApplicationContext appCtx;
+    private NCServiceContext serviceCtx;
 
-    private final INCApplicationEntryPoint ncAppEntryPoint;
+    private final INCApplication application;
 
     private final ILifeCycleComponentManager lccm;
 
@@ -159,17 +159,17 @@ public class NodeControllerService implements IControllerService {
     private final ConfigManager configManager;
 
     public NodeControllerService(NCConfig config) throws Exception {
-        this(config, getApplicationEntryPoint(config));
+        this(config, getApplication(config));
     }
 
-    public NodeControllerService(NCConfig config, INCApplicationEntryPoint aep) throws IOException, CmdLineException {
+    public NodeControllerService(NCConfig config, INCApplication application) throws IOException, CmdLineException {
         this.ncConfig = config;
         this.configManager = ncConfig.getConfigManager();
-        if (aep == null) {
-            throw new IllegalArgumentException("INCApplicationEntryPoint cannot be null");
+        if (application == null) {
+            throw new IllegalArgumentException("INCApplication cannot be null");
         }
         configManager.processConfig();
-        this.ncAppEntryPoint = aep;
+        this.application = application;
         id = ncConfig.getNodeId();
 
         ioManager = new IOManager(IODeviceHandle.getDevices(ncConfig.getIODevices()));
@@ -199,8 +199,9 @@ public class NodeControllerService implements IControllerService {
         return ioManager;
     }
 
-    public NCApplicationContext getApplicationContext() {
-        return appCtx;
+    @Override
+    public NCServiceContext getContext() {
+        return serviceCtx;
     }
 
     public ILifeCycleComponentManager getLifeCycleComponentManager() {
@@ -244,11 +245,11 @@ public class NodeControllerService implements IControllerService {
                 ncConfig.getResultListenPort(), datasetPartitionManager, ncConfig.getNetThreadCount(),
                 ncConfig.getNetBufferCount(), ncConfig.getResultPublicAddress(), ncConfig.getResultPublicPort(),
                 FullFrameChannelInterfaceFactory.INSTANCE);
-        if (ncConfig.getMessagingListenAddress() != null && appCtx.getMessagingChannelInterfaceFactory() != null) {
+        if (ncConfig.getMessagingListenAddress() != null && serviceCtx.getMessagingChannelInterfaceFactory() != null) {
             messagingNetManager = new MessagingNetworkManager(this, ncConfig.getMessagingListenAddress(),
                     ncConfig.getMessagingListenPort(), ncConfig.getNetThreadCount(),
                     ncConfig.getMessagingPublicAddress(), ncConfig.getMessagingPublicPort(),
-                    appCtx.getMessagingChannelInterfaceFactory());
+                    serviceCtx.getMessagingChannelInterfaceFactory());
         }
     }
 
@@ -292,7 +293,7 @@ public class NodeControllerService implements IControllerService {
                 runtimeMXBean.getVmName(), runtimeMXBean.getVmVersion(), runtimeMXBean.getVmVendor(),
                 runtimeMXBean.getClassPath(), runtimeMXBean.getLibraryPath(), runtimeMXBean.getBootClassPath(),
                 runtimeMXBean.getInputArguments(), runtimeMXBean.getSystemProperties(), hbSchema, meesagingPort,
-                ncAppEntryPoint.getCapacity(), PidHelper.getPid()));
+                application.getCapacity(), PidHelper.getPid()));
 
         synchronized (this) {
             while (registrationPending) {
@@ -302,7 +303,7 @@ public class NodeControllerService implements IControllerService {
         if (registrationException != null) {
             throw registrationException;
         }
-        appCtx.setDistributedState(nodeParameters.getDistributedState());
+        serviceCtx.setDistributedState(nodeParameters.getDistributedState());
 
         workQueue.start();
 
@@ -322,13 +323,13 @@ public class NodeControllerService implements IControllerService {
         }
 
         LOGGER.log(Level.INFO, "Started NodeControllerService");
-        ncAppEntryPoint.notifyStartupComplete();
+        application.startupCompleted();
     }
 
     private void startApplication() throws Exception {
-        appCtx = new NCApplicationContext(this, serverCtx, ioManager, id, memoryManager, lccm, ncConfig.getAppConfig());
-        ncAppEntryPoint.start(appCtx, ncConfig.getAppArgsArray());
-        executor = Executors.newCachedThreadPool(appCtx.getThreadFactory());
+        serviceCtx = new NCServiceContext(this, serverCtx, ioManager, id, memoryManager, lccm, ncConfig.getAppConfig());
+        application.start(serviceCtx, ncConfig.getAppArgsArray());
+        executor = Executors.newCachedThreadPool(serviceCtx.getThreadFactory());
     }
 
     @Override
@@ -347,7 +348,7 @@ public class NodeControllerService implements IControllerService {
                 messagingNetManager.stop();
             }
             workQueue.stop();
-            ncAppEntryPoint.stop();
+            application.stop();
             /*
              * Stop heartbeat after NC has stopped to avoid false node failure detection
              * on CC if an NC takes a long time to stop.
@@ -530,13 +531,18 @@ public class NodeControllerService implements IControllerService {
         return messagingNetManager;
     }
 
-    private static INCApplicationEntryPoint getApplicationEntryPoint(NCConfig config)
+    private static INCApplication getApplication(NCConfig config)
             throws ClassNotFoundException, IllegalAccessException, InstantiationException {
             if (config.getAppClass() != null) {
                 Class<?> c = Class.forName(config.getAppClass());
-                return (INCApplicationEntryPoint) c.newInstance();
+                return (INCApplication) c.newInstance();
             } else {
-                return NCApplicationEntryPoint.INSTANCE;
+                return BaseNCApplication.INSTANCE;
             }
     }
+
+    @Override
+    public Object getApplicationContext() {
+        return application.getApplicationContext();
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCApplicationContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCApplicationContext.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCApplicationContext.java
deleted file mode 100644
index 6d549c2..0000000
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCApplicationContext.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.control.nc.application;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-
-import org.apache.hyracks.api.application.INCApplicationContext;
-import org.apache.hyracks.api.application.IStateDumpHandler;
-import org.apache.hyracks.api.comm.IChannelInterfaceFactory;
-import org.apache.hyracks.api.config.IApplicationConfig;
-import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
-import org.apache.hyracks.api.resources.memory.IMemoryManager;
-import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.common.application.ApplicationContext;
-import org.apache.hyracks.control.common.context.ServerContext;
-import org.apache.hyracks.control.common.utils.HyracksThreadFactory;
-import org.apache.hyracks.control.nc.NodeControllerService;
-import org.apache.hyracks.control.nc.io.IOManager;
-import org.apache.hyracks.control.nc.resources.memory.MemoryManager;
-
-public class NCApplicationContext extends ApplicationContext implements INCApplicationContext {
-    private final ILifeCycleComponentManager lccm;
-    private final String nodeId;
-    private final IOManager ioManager;
-    private final MemoryManager memoryManager;
-    private Object appObject;
-    private IStateDumpHandler sdh;
-    private final NodeControllerService ncs;
-    private IChannelInterfaceFactory messagingChannelInterfaceFactory;
-
-    public NCApplicationContext(NodeControllerService ncs, ServerContext serverCtx, IOManager ioManager,
-            String nodeId, MemoryManager memoryManager, ILifeCycleComponentManager lifeCyclecomponentManager,
-            IApplicationConfig appConfig) throws IOException {
-        super(serverCtx, appConfig, new HyracksThreadFactory(nodeId));
-        this.lccm = lifeCyclecomponentManager;
-        this.nodeId = nodeId;
-        this.ioManager = ioManager;
-        this.memoryManager = memoryManager;
-        this.ncs = ncs;
-        sdh = new IStateDumpHandler() {
-
-            @Override
-            public void dumpState(OutputStream os) throws IOException {
-                lccm.dumpState(os);
-            }
-        };
-    }
-
-    @Override
-    public ILifeCycleComponentManager getLifeCycleComponentManager() {
-        return lccm;
-    }
-
-    @Override
-    public String getNodeId() {
-        return nodeId;
-    }
-
-    public void setDistributedState(Serializable state) {
-        distributedState = state;
-    }
-
-    @Override
-    public void setStateDumpHandler(IStateDumpHandler handler) {
-        this.sdh = handler;
-    }
-
-    public IStateDumpHandler getStateDumpHandler() {
-        return sdh;
-    }
-
-    @Override
-    public IOManager getIoManager() {
-        return ioManager;
-    }
-
-    @Override
-    public void setApplicationObject(Object object) {
-        this.appObject = object;
-    }
-
-    @Override
-    public Object getApplicationObject() {
-        return appObject;
-    }
-
-    @Override
-    public IMemoryManager getMemoryManager() {
-        return memoryManager;
-    }
-
-    @Override
-    public IControllerService getControllerService() {
-        return ncs;
-    }
-
-    @Override
-    public IChannelInterfaceFactory getMessagingChannelInterfaceFactory() {
-        return messagingChannelInterfaceFactory;
-    }
-
-    @Override
-    public void setMessagingChannelInterfaceFactory(IChannelInterfaceFactory interfaceFactory) {
-        this.messagingChannelInterfaceFactory = interfaceFactory;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCServiceContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCServiceContext.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCServiceContext.java
new file mode 100644
index 0000000..dc0bf0c
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/application/NCServiceContext.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.control.nc.application;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+import org.apache.hyracks.api.application.INCServiceContext;
+import org.apache.hyracks.api.application.IStateDumpHandler;
+import org.apache.hyracks.api.comm.IChannelInterfaceFactory;
+import org.apache.hyracks.api.config.IApplicationConfig;
+import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
+import org.apache.hyracks.api.resources.memory.IMemoryManager;
+import org.apache.hyracks.api.service.IControllerService;
+import org.apache.hyracks.control.common.application.ServiceContext;
+import org.apache.hyracks.control.common.context.ServerContext;
+import org.apache.hyracks.control.common.utils.HyracksThreadFactory;
+import org.apache.hyracks.control.nc.NodeControllerService;
+import org.apache.hyracks.control.nc.io.IOManager;
+import org.apache.hyracks.control.nc.resources.memory.MemoryManager;
+
+public class NCServiceContext extends ServiceContext implements INCServiceContext {
+    private final ILifeCycleComponentManager lccm;
+    private final String nodeId;
+    private final IOManager ioManager;
+    private final MemoryManager memoryManager;
+    private IStateDumpHandler sdh;
+    private final NodeControllerService ncs;
+    private IChannelInterfaceFactory messagingChannelInterfaceFactory;
+
+    public NCServiceContext(NodeControllerService ncs, ServerContext serverCtx, IOManager ioManager,
+            String nodeId, MemoryManager memoryManager, ILifeCycleComponentManager lifeCyclecomponentManager,
+            IApplicationConfig appConfig) throws IOException {
+        super(serverCtx, appConfig, new HyracksThreadFactory(nodeId));
+        this.lccm = lifeCyclecomponentManager;
+        this.nodeId = nodeId;
+        this.ioManager = ioManager;
+        this.memoryManager = memoryManager;
+        this.ncs = ncs;
+        sdh = new IStateDumpHandler() {
+
+            @Override
+            public void dumpState(OutputStream os) throws IOException {
+                lccm.dumpState(os);
+            }
+        };
+    }
+
+    @Override
+    public ILifeCycleComponentManager getLifeCycleComponentManager() {
+        return lccm;
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    public void setDistributedState(Serializable state) {
+        distributedState = state;
+    }
+
+    @Override
+    public void setStateDumpHandler(IStateDumpHandler handler) {
+        this.sdh = handler;
+    }
+
+    public IStateDumpHandler getStateDumpHandler() {
+        return sdh;
+    }
+
+    @Override
+    public IOManager getIoManager() {
+        return ioManager;
+    }
+
+    @Override
+    public IMemoryManager getMemoryManager() {
+        return memoryManager;
+    }
+
+    @Override
+    public IControllerService getControllerService() {
+        return ncs;
+    }
+
+    @Override
+    public IChannelInterfaceFactory getMessagingChannelInterfaceFactory() {
+        return messagingChannelInterfaceFactory;
+    }
+
+    @Override
+    public void setMessagingChannelInterfaceFactory(IChannelInterfaceFactory interfaceFactory) {
+        this.messagingChannelInterfaceFactory = interfaceFactory;
+    }
+
+    @Override
+    public Object getApplicationContext() {
+        return ncs.getApplicationContext();
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/task/ThreadDumpTask.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/task/ThreadDumpTask.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/task/ThreadDumpTask.java
index 68d9223..5ebb99a 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/task/ThreadDumpTask.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/task/ThreadDumpTask.java
@@ -45,7 +45,7 @@ public class ThreadDumpTask implements Runnable {
         }
         try {
             ncs.getClusterController().notifyThreadDump(
-                    ncs.getApplicationContext().getNodeId(), requestId, result);
+                    ncs.getContext().getNodeId(), requestId, result);
         } catch (Exception e) {
             LOGGER.log(Level.WARNING, "Exception sending thread dump to CC", e);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/ApplicationMessageWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/ApplicationMessageWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/ApplicationMessageWork.java
index e589ece..7f5302a 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/ApplicationMessageWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/ApplicationMessageWork.java
@@ -26,7 +26,7 @@ import org.apache.hyracks.api.messages.IMessage;
 import org.apache.hyracks.control.common.deployment.DeploymentUtils;
 import org.apache.hyracks.control.common.work.AbstractWork;
 import org.apache.hyracks.control.nc.NodeControllerService;
-import org.apache.hyracks.control.nc.application.NCApplicationContext;
+import org.apache.hyracks.control.nc.application.NCServiceContext;
 
 /**
  * @author rico
@@ -47,7 +47,7 @@ public class ApplicationMessageWork extends AbstractWork {
 
     @Override
     public void run() {
-        NCApplicationContext ctx = ncs.getApplicationContext();
+        NCServiceContext ctx = ncs.getContext();
         try {
             IMessage data = (IMessage) DeploymentUtils.deserialize(message, deploymentId, ctx);;
             if (ctx.getMessageBroker() != null) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DeployBinaryWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DeployBinaryWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DeployBinaryWork.java
index 264a131..0fe55e6 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DeployBinaryWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DeployBinaryWork.java
@@ -51,7 +51,7 @@ public class DeployBinaryWork extends AbstractWork {
     public void run() {
         DeploymentStatus status;
         try {
-            DeploymentUtils.deploy(deploymentId, binaryURLs, ncs.getApplicationContext()
+            DeploymentUtils.deploy(deploymentId, binaryURLs, ncs.getContext()
                     .getJobSerializerDeserializerContainer(), ncs.getServerContext(), true);
             status = DeploymentStatus.SUCCEED;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DistributeJobWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DistributeJobWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DistributeJobWork.java
index 3a4f6ac..807142b 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DistributeJobWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/DistributeJobWork.java
@@ -47,7 +47,7 @@ public class DistributeJobWork extends AbstractWork {
         try {
             ncs.checkForDuplicateDistributedJob(jobId);
             ActivityClusterGraph acg =
-                    (ActivityClusterGraph) DeploymentUtils.deserialize(acgBytes, null, ncs.getApplicationContext());
+                    (ActivityClusterGraph) DeploymentUtils.deserialize(acgBytes, null, ncs.getContext());
             ncs.storeActivityClusterGraph(jobId, acg);
         } catch (HyracksException e) {
             try {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StartTasksWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StartTasksWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StartTasksWork.java
index 6cd9fa2..692eac6 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StartTasksWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StartTasksWork.java
@@ -28,7 +28,7 @@ import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 import org.apache.hyracks.api.comm.IFrameWriter;
 import org.apache.hyracks.api.comm.IPartitionCollector;
 import org.apache.hyracks.api.comm.IPartitionWriterFactory;
@@ -62,7 +62,7 @@ import org.apache.hyracks.control.common.work.AbstractWork;
 import org.apache.hyracks.control.nc.Joblet;
 import org.apache.hyracks.control.nc.NodeControllerService;
 import org.apache.hyracks.control.nc.Task;
-import org.apache.hyracks.control.nc.application.NCApplicationContext;
+import org.apache.hyracks.control.nc.application.NCServiceContext;
 import org.apache.hyracks.control.nc.partitions.MaterializedPartitionWriter;
 import org.apache.hyracks.control.nc.partitions.MaterializingPipelinedPartition;
 import org.apache.hyracks.control.nc.partitions.PipelinedPartition;
@@ -102,8 +102,8 @@ public class StartTasksWork extends AbstractWork {
     public void run() {
         Task task = null;
         try {
-            NCApplicationContext appCtx = ncs.getApplicationContext();
-            Joblet joblet = getOrCreateLocalJoblet(deploymentId, jobId, appCtx, acgBytes);
+            NCServiceContext serviceCtx = ncs.getContext();
+            Joblet joblet = getOrCreateLocalJoblet(deploymentId, jobId, serviceCtx, acgBytes);
             final ActivityClusterGraph acg = joblet.getActivityClusterGraph();
             IRecordDescriptorProvider rdp = new IRecordDescriptorProvider() {
                 @Override
@@ -182,7 +182,7 @@ public class StartTasksWork extends AbstractWork {
         }
     }
 
-    private Joblet getOrCreateLocalJoblet(DeploymentId deploymentId, JobId jobId, INCApplicationContext appCtx,
+    private Joblet getOrCreateLocalJoblet(DeploymentId deploymentId, JobId jobId, INCServiceContext appCtx,
             byte[] acgBytes) throws HyracksException {
         Map<JobId, Joblet> jobletMap = ncs.getJobletMap();
         Joblet ji = jobletMap.get(jobId);
@@ -265,10 +265,10 @@ public class StartTasksWork extends AbstractWork {
     private List<List<PartitionChannel>> createInputChannels(TaskAttemptDescriptor td,
             List<IConnectorDescriptor> inputs) throws UnknownHostException {
         NetworkAddress[][] inputAddresses = td.getInputPartitionLocations();
-        List<List<PartitionChannel>> channelsForInputConnectors = new ArrayList<List<PartitionChannel>>();
+        List<List<PartitionChannel>> channelsForInputConnectors = new ArrayList<>();
         if (inputAddresses != null) {
             for (int i = 0; i < inputAddresses.length; i++) {
-                List<PartitionChannel> channels = new ArrayList<PartitionChannel>();
+                List<PartitionChannel> channels = new ArrayList<>();
                 if (inputAddresses[i] != null) {
                     for (int j = 0; j < inputAddresses[i].length; j++) {
                         NetworkAddress networkAddress = inputAddresses[i][j];

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StateDumpWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StateDumpWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StateDumpWork.java
index e3f03f7..9dbc901 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StateDumpWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/StateDumpWork.java
@@ -36,8 +36,7 @@ public class StateDumpWork extends SynchronizableWork {
     @Override
     protected void doRun() throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ncs.getApplicationContext().getStateDumpHandler().dumpState(baos);
-        ncs.getClusterController().notifyStateDump(ncs.getApplicationContext().getNodeId(), stateDumpId,
-                baos.toString("UTF-8"));
+        ncs.getContext().getStateDumpHandler().dumpState(baos);
+        ncs.getClusterController().notifyStateDump(ncs.getContext().getNodeId(), stateDumpId, baos.toString("UTF-8"));
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/UnDeployBinaryWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/UnDeployBinaryWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/UnDeployBinaryWork.java
index f564ff4..1c10589 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/UnDeployBinaryWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/UnDeployBinaryWork.java
@@ -45,7 +45,7 @@ public class UnDeployBinaryWork extends AbstractWork {
     public void run() {
         DeploymentStatus status;
         try {
-            DeploymentUtils.undeploy(deploymentId, ncs.getApplicationContext().getJobSerializerDeserializerContainer(),
+            DeploymentUtils.undeploy(deploymentId, ncs.getContext().getJobSerializerDeserializerContainer(),
                     ncs.getServerContext());
             status = DeploymentStatus.SUCCEED;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
index 6b8b38f..705244a 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
@@ -21,7 +21,7 @@ package org.apache.hyracks.dataflow.std.base;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.hyracks.api.application.ICCApplicationContext;
+import org.apache.hyracks.api.application.ICCServiceContext;
 import org.apache.hyracks.api.constraints.IConstraintAcceptor;
 import org.apache.hyracks.api.dataflow.ConnectorDescriptorId;
 import org.apache.hyracks.api.dataflow.IConnectorDescriptor;
@@ -68,7 +68,7 @@ public abstract class AbstractConnectorDescriptor implements IConnectorDescripto
 
     @Override
     public void contributeSchedulingConstraints(IConstraintAcceptor constraintAcceptor, ActivityCluster ac,
-            ICCApplicationContext appCtx) {
+            ICCServiceContext serviceCtx) {
         // do nothing
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
index a18328e..155aa03 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
@@ -20,7 +20,7 @@ package org.apache.hyracks.dataflow.std.base;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.hyracks.api.application.ICCApplicationContext;
+import org.apache.hyracks.api.application.ICCServiceContext;
 import org.apache.hyracks.api.constraints.IConstraintAcceptor;
 import org.apache.hyracks.api.dataflow.IOperatorDescriptor;
 import org.apache.hyracks.api.dataflow.OperatorDescriptorId;
@@ -86,7 +86,7 @@ public abstract class AbstractOperatorDescriptor implements IOperatorDescriptor
     }
 
     @Override
-    public void contributeSchedulingConstraints(IConstraintAcceptor constraintAcceptor, ICCApplicationContext appCtx) {
+    public void contributeSchedulingConstraints(IConstraintAcceptor constraintAcceptor, ICCServiceContext serviceCtx) {
         // do nothing
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
index f773918..eda353b 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
@@ -20,7 +20,7 @@ package org.apache.hyracks.dataflow.std.connectors;
 
 import java.util.BitSet;
 
-import org.apache.hyracks.api.application.ICCApplicationContext;
+import org.apache.hyracks.api.application.ICCServiceContext;
 import org.apache.hyracks.api.comm.IFrameWriter;
 import org.apache.hyracks.api.comm.IPartitionCollector;
 import org.apache.hyracks.api.comm.IPartitionWriterFactory;
@@ -65,7 +65,7 @@ public class OneToOneConnectorDescriptor extends AbstractConnectorDescriptor {
 
     @Override
     public void contributeSchedulingConstraints(IConstraintAcceptor constraintAcceptor, ActivityCluster ac,
-            ICCApplicationContext appCtx) {
+            ICCServiceContext serviceCtx) {
         OperatorDescriptorId consumer = ac.getConsumerActivity(getConnectorId()).getOperatorDescriptorId();
         OperatorDescriptorId producer = ac.getProducerActivity(getConnectorId()).getOperatorDescriptorId();
 


Mime
View raw message