asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject [6/6] asterixdb git commit: Unify structure of Cluster Controller and Node Controller
Date Fri, 10 Mar 2017 08:14:25 GMT
Unify structure of Cluster Controller and Node Controller

Change-Id: Ife3a002371a07ee9cdd32e1ffd50cc775bf1d453
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1514
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/953eb966
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/953eb966
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/953eb966

Branch: refs/heads/master
Commit: 953eb96686d84b7ae7395b8bdd8570dcb37add62
Parents: 1b288ca
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Thu Mar 9 16:35:52 2017 -0800
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Fri Mar 10 00:13:02 2017 -0800

----------------------------------------------------------------------
 asterixdb/asterix-active/pom.xml                |   4 -
 .../ActiveSourceOperatorNodePushable.java       |   4 +-
 .../active/message/ActiveManagerMessage.java    |   5 +-
 .../common/AsterixHyracksIntegrationUtil.java   |  26 +-
 .../api/http/server/ClusterApiServlet.java      |   2 +-
 .../asterix/app/nc/NCAppRuntimeContext.java     |  44 +--
 .../asterix/app/nc/NCExtensionManager.java      |  12 +-
 .../apache/asterix/app/nc/RecoveryManager.java  |  15 +-
 .../asterix/app/nc/TransactionSubsystem.java    |   6 +-
 .../app/nc/task/BindMetadataNodeTask.java       |   8 +-
 .../asterix/app/nc/task/CheckpointTask.java     |   6 +-
 .../app/nc/task/ExternalLibrarySetupTask.java   |   4 +-
 .../asterix/app/nc/task/LocalRecoveryTask.java  |   6 +-
 .../app/nc/task/MetadataBootstrapTask.java      |   4 +-
 .../asterix/app/nc/task/RemoteRecoveryTask.java |   6 +-
 .../asterix/app/nc/task/StartFailbackTask.java  |   6 +-
 .../nc/task/StartLifecycleComponentsTask.java   |  17 +-
 .../nc/task/StartReplicationServiceTask.java    |   8 +-
 .../message/CompleteFailbackRequestMessage.java |   7 +-
 ...PreparePartitionsFailbackRequestMessage.java |  15 +-
 .../ReplayPartitionLogsRequestMessage.java      |   4 +-
 .../message/StartupTaskRequestMessage.java      |   2 +-
 .../message/StartupTaskResponseMessage.java     |   4 +-
 .../TakeoverMetadataNodeRequestMessage.java     |  11 +-
 .../TakeoverPartitionsRequestMessage.java       |   6 +-
 .../bootstrap/ApplicationClassHelper.java       |  39 +++
 .../bootstrap/ApplicationEntryPointHelper.java  |  39 ---
 .../hyracks/bootstrap/CCApplication.java        | 325 +++++++++++++++++++
 .../bootstrap/CCApplicationEntryPoint.java      | 316 ------------------
 .../hyracks/bootstrap/NCApplication.java        | 254 +++++++++++++++
 .../bootstrap/NCApplicationEntryPoint.java      | 248 --------------
 .../asterix/messaging/NCMessageBroker.java      |   2 +-
 .../apache/asterix/utils/FeedOperations.java    |   2 +-
 .../app/bootstrap/TestNodeController.java       |   8 +-
 .../asterix/common/config/ConfigUsageTest.java  |   6 +-
 .../asterix/test/runtime/ExecutionTestUtil.java |   3 +-
 .../AsterixVirtualBufferCacheProvider.java      |   2 +-
 .../CorrelatedPrefixMergePolicyFactory.java     |   4 +-
 .../context/TransactionSubsystemProvider.java   |   6 +-
 .../dataflow/IApplicationContextInfo.java       |   8 +-
 .../LSMInsertDeleteOperatorNodePushable.java    |   4 +-
 .../asterix/common/transactions/Resource.java   |   4 +-
 .../builder/AbstractLocalExperimentBuilder.java |  82 -----
 asterixdb/asterix-external-data/pom.xml         |   5 -
 .../adapter/factory/GenericAdapterFactory.java  |   6 +-
 .../external/input/HDFSDataSourceFactory.java   |  24 +-
 .../factory/LocalFSInputStreamFactory.java      |   2 +-
 .../external/library/ExternalFunction.java      |   2 +-
 .../FeedCollectOperatorNodePushable.java        |   4 +-
 .../operators/FeedIntakeOperatorDescriptor.java |   2 +-
 .../operators/FeedMetaComputeNodePushable.java  |   4 +-
 .../operators/FeedMetaStoreNodePushable.java    |   4 +-
 .../apache/asterix/external/util/HDFSUtils.java |   4 +-
 .../adapter/TestTypedAdapterFactory.java        |   6 +-
 .../metadata/api/IMetadataExtension.java        |   4 +-
 .../metadata/bootstrap/MetadataBootstrap.java   |  54 +--
 .../management/ReplicationChannel.java          |  10 +-
 .../job/listener/JobEventListenerFactory.java   |   6 +-
 ...tiTransactionJobletEventListenerFactory.java |   4 +-
 .../runtime/message/ReplicaEventMessage.java    |   5 +-
 .../message/ReportMaxResourceIdMessage.java     |   5 +-
 .../message/ResourceIdRequestMessage.java       |   2 +-
 .../ResourceIdRequestResponseMessage.java       |   7 +-
 .../LSMPrimaryUpsertOperatorNodePushable.java   |   6 +-
 .../std/FlushDatasetOperatorDescriptor.java     |  10 +-
 .../transaction/GlobalResourceIdFactory.java    |  13 +-
 .../GlobalResourceIdFactoryProvider.java        |  10 +-
 .../asterix/runtime/utils/AppContextInfo.java   |  14 +-
 .../runtime/utils/ClusterStateManager.java      |   2 +-
 .../utils/RuntimeComponentsProvider.java        |  12 +-
 .../asterix/runtime/utils/RuntimeUtils.java     |   4 +-
 asterixdb/asterix-server/pom.xml                |   8 +-
 .../test/resources/NCServiceExecutionIT/cc.conf |   4 +-
 .../PrimaryIndexOperationTrackerFactory.java    |   8 +-
 .../SecondaryIndexOperationTrackerFactory.java  |   8 +-
 .../ExternalBTreeLocalResourceMetadata.java     |  18 +-
 ...rnalBTreeWithBuddyLocalResourceMetadata.java |  18 +-
 .../ExternalRTreeLocalResourceMetadata.java     |  18 +-
 .../resource/LSMBTreeLocalResourceMetadata.java |  16 +-
 .../LSMInvertedIndexLocalResourceMetadata.java  |  30 +-
 .../resource/LSMRTreeLocalResourceMetadata.java |  16 +-
 .../management/runtime/CommitRuntime.java       |   8 +-
 asterixdb/asterix-yarn/pom.xml                  |   1 -
 .../asterix/aoya/AsterixApplicationMaster.java  |  59 ++--
 .../hyracks/api/application/IApplication.java   |  38 +++
 .../api/application/IApplicationContext.java    |  60 ----
 .../hyracks/api/application/ICCApplication.java |  30 ++
 .../api/application/ICCApplicationContext.java  |  66 ----
 .../application/ICCApplicationEntryPoint.java   |  39 ---
 .../api/application/ICCServiceContext.java      |  64 ++++
 .../hyracks/api/application/INCApplication.java |  26 ++
 .../api/application/INCApplicationContext.java  |  94 ------
 .../application/INCApplicationEntryPoint.java   |  39 ---
 .../api/application/INCServiceContext.java      |  77 +++++
 .../api/application/IServiceContext.java        |  58 ++++
 .../client/impl/JobActivityGraphBuilder.java    |  14 +-
 ...ionActivityClusterGraphGeneratorFactory.java |  11 +-
 .../api/context/IHyracksJobletContext.java      |  14 +-
 .../api/dataflow/IConnectorDescriptor.java      |   4 +-
 .../api/dataflow/IOperatorDescriptor.java       |   4 +-
 .../IActivityClusterGraphGeneratorFactory.java  |   6 +-
 .../hyracks/api/service/IControllerService.java |  10 +-
 .../hyracks/control/cc/BaseCCApplication.java   |  79 +++++
 .../control/cc/CCApplicationEntryPoint.java     |  68 ----
 .../org/apache/hyracks/control/cc/CCDriver.java |  16 +-
 .../control/cc/ClusterControllerService.java    |  53 +--
 .../cc/application/CCApplicationContext.java    | 125 -------
 .../cc/application/CCServiceContext.java        | 130 ++++++++
 .../control/cc/executor/JobExecutor.java        |   6 +-
 .../hyracks/control/cc/job/JobManager.java      |  12 +-
 .../control/cc/work/ApplicationMessageWork.java |   4 +-
 .../control/cc/work/CliDeployBinaryWork.java    |   2 +-
 .../control/cc/work/CliUnDeployBinaryWork.java  |   3 +-
 .../control/cc/work/DistributeJobWork.java      |  10 +-
 .../hyracks/control/cc/work/JobStartWork.java   |   8 +-
 .../control/cc/work/RegisterNodeWork.java       |   4 +-
 .../control/cc/work/RemoveDeadNodesWork.java    |   2 +-
 .../hyracks/control/cc/job/JobManagerTest.java  |   6 +-
 .../common/application/ApplicationContext.java  |  79 -----
 .../common/application/ServiceContext.java      |  79 +++++
 .../common/deployment/DeploymentUtils.java      |  21 +-
 .../hyracks/control/nc/BaseNCApplication.java   |  74 +++++
 .../org/apache/hyracks/control/nc/Joblet.java   |  26 +-
 .../control/nc/NCApplicationEntryPoint.java     |  69 ----
 .../org/apache/hyracks/control/nc/NCDriver.java |  14 +-
 .../control/nc/NodeControllerService.java       |  52 +--
 .../nc/application/NCApplicationContext.java    | 124 -------
 .../nc/application/NCServiceContext.java        | 118 +++++++
 .../hyracks/control/nc/task/ThreadDumpTask.java |   2 +-
 .../control/nc/work/ApplicationMessageWork.java |   4 +-
 .../control/nc/work/DeployBinaryWork.java       |   2 +-
 .../control/nc/work/DistributeJobWork.java      |   2 +-
 .../hyracks/control/nc/work/StartTasksWork.java |  14 +-
 .../hyracks/control/nc/work/StateDumpWork.java  |   5 +-
 .../control/nc/work/UnDeployBinaryWork.java     |   2 +-
 .../std/base/AbstractConnectorDescriptor.java   |   4 +-
 .../std/base/AbstractOperatorDescriptor.java    |   4 +-
 .../connectors/OneToOneConnectorDescriptor.java |   4 +-
 .../btree/helper/NCApplicationEntryPoint.java   |  54 ---
 .../examples/btree/helper/RuntimeContext.java   |   6 +-
 .../btree/helper/TestNCApplication.java         |  61 ++++
 .../AbstractMultiNCIntegrationTest.java         |   6 +-
 .../dataflow/HDFSReadOperatorDescriptor.java    |   2 +-
 .../dataflow/HDFSReadOperatorDescriptor.java    |   2 +-
 .../hyracks/hdfs/dataflow/DataflowTest.java     |   9 +-
 .../hyracks/hdfs/scheduler/SchedulerTest.java   |   2 +-
 .../apache/hyracks/hdfs/utils/TestUtils.java    | 115 -------
 .../hyracks/hdfs2/scheduler/SchedulerTest.java  |  10 +-
 .../dataflow/ExternalBTreeDataflowHelper.java   |   2 +-
 .../ExternalBTreeWithBuddyDataflowHelper.java   |   2 +-
 .../btree/dataflow/LSMBTreeDataflowHelper.java  |   2 +-
 .../common/api/ILSMOperationTrackerFactory.java |   4 +-
 .../impls/NoOpOperationTrackerFactory.java      |   4 +-
 .../ThreadCountingOperationTrackerFactory.java  |   4 +-
 .../LSMInvertedIndexDataflowHelper.java         |   2 +-
 ...rtitionedLSMInvertedIndexDataflowHelper.java |   2 +-
 .../AbstractLSMRTreeDataflowHelper.java         |   2 +-
 .../hyracks/test/support/TestJobletContext.java |  14 +-
 .../test/support/TestNCApplicationContext.java  | 154 ---------
 .../test/support/TestNCServiceContext.java      | 149 +++++++++
 .../apache/hyracks/test/support/TestUtils.java  |  90 ++++-
 161 files changed, 2246 insertions(+), 2360 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-active/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-active/pom.xml b/asterixdb/asterix-active/pom.xml
index a816d19..6c4cb15 100644
--- a/asterixdb/asterix-active/pom.xml
+++ b/asterixdb/asterix-active/pom.xml
@@ -36,10 +36,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.hyracks</groupId>
-      <artifactId>hyracks-control-nc</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hyracks</groupId>
       <artifactId>hyracks-api</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveSourceOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveSourceOperatorNodePushable.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveSourceOperatorNodePushable.java
index b49ff72..12f28c5 100644
--- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveSourceOperatorNodePushable.java
+++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveSourceOperatorNodePushable.java
@@ -36,8 +36,8 @@ public abstract class ActiveSourceOperatorNodePushable extends AbstractUnaryOutp
 
     public ActiveSourceOperatorNodePushable(IHyracksTaskContext ctx, ActiveRuntimeId runtimeId) {
         this.ctx = ctx;
-        activeManager = (ActiveManager) ((IAppRuntimeContext) ctx.getJobletContext().getApplicationContext()
-                .getApplicationObject()).getActiveManager();
+        activeManager = (ActiveManager) ((IAppRuntimeContext) ctx.getJobletContext().getServiceContext()
+                .getApplicationContext()).getActiveManager();
         this.runtimeId = runtimeId;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java
index 241c932..da3ac1c 100644
--- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java
+++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/message/ActiveManagerMessage.java
@@ -25,7 +25,6 @@ import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.messaging.api.IApplicationMessage;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class ActiveManagerMessage implements IApplicationMessage {
     public static final byte STOP_ACTIVITY = 0x00;
@@ -55,9 +54,7 @@ public class ActiveManagerMessage implements IApplicationMessage {
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext =
-                (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         ((ActiveManager) appContext.getActiveManager()).submit(this);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index fbb2208..f3c9744 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -33,12 +33,12 @@ import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.config.PropertiesAccessor;
 import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.hyracks.bootstrap.CCApplicationEntryPoint;
-import org.apache.asterix.hyracks.bootstrap.NCApplicationEntryPoint;
+import org.apache.asterix.hyracks.bootstrap.CCApplication;
+import org.apache.asterix.hyracks.bootstrap.NCApplication;
 import org.apache.asterix.runtime.utils.ClusterStateManager;
 import org.apache.commons.io.FileUtils;
-import org.apache.hyracks.api.application.ICCApplicationEntryPoint;
-import org.apache.hyracks.api.application.INCApplicationEntryPoint;
+import org.apache.hyracks.api.application.ICCApplication;
+import org.apache.hyracks.api.application.INCApplication;
 import org.apache.hyracks.api.client.HyracksConnection;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.job.JobFlag;
@@ -70,11 +70,11 @@ public class AsterixHyracksIntegrationUtil {
 
     public void init(boolean deleteOldInstanceData) throws Exception {
         ncs = new NodeControllerService[0]; // ensure that ncs is not null
-        final ICCApplicationEntryPoint ccAppEntryPoint = createCCAppEntryPoint();
+        final ICCApplication ccApplication = createCCApplication();
         configManager = new ConfigManager();
-        ccAppEntryPoint.registerConfig(configManager);
+        ccApplication.registerConfig(configManager);
         final CCConfig ccConfig = createCCConfig(configManager);
-        cc = new ClusterControllerService(ccConfig, ccAppEntryPoint);
+        cc = new ClusterControllerService(ccConfig, ccApplication);
 
         nodeNames = ccConfig.getConfigManager().getNodeNames();
         if (deleteOldInstanceData) {
@@ -93,8 +93,8 @@ public class AsterixHyracksIntegrationUtil {
         List<NodeControllerService> nodeControllers = new ArrayList<>();
         List<Thread> startupThreads = new ArrayList<>();
         for (NCConfig ncConfig : ncConfigs) {
-            final INCApplicationEntryPoint ncAppEntryPoint = createNCAppEntryPoint();
-            NodeControllerService nodeControllerService = new NodeControllerService(ncConfig, ncAppEntryPoint);
+            final INCApplication ncApplication = createNCApplication();
+            NodeControllerService nodeControllerService = new NodeControllerService(ncConfig, ncApplication);
             nodeControllers.add(nodeControllerService);
             Thread ncStartThread = new Thread("IntegrationUtil-" + ncConfig.getNodeId()) {
                 @Override
@@ -141,8 +141,8 @@ public class AsterixHyracksIntegrationUtil {
         return ccConfig;
     }
 
-    protected ICCApplicationEntryPoint createCCAppEntryPoint() {
-        return new CCApplicationEntryPoint();
+    protected ICCApplication createCCApplication() {
+        return new CCApplication();
     }
 
     protected NCConfig createNCConfig(String ncName, ConfigManager configManager) {
@@ -159,8 +159,8 @@ public class AsterixHyracksIntegrationUtil {
         return ncConfig;
     }
 
-    protected INCApplicationEntryPoint createNCAppEntryPoint() {
-        return new NCApplicationEntryPoint();
+    protected INCApplication createNCApplication() {
+        return new NCApplication();
     }
 
     private NCConfig fixupIODevices(NCConfig ncConfig, PropertiesAccessor accessor) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
index c2b44c9..6b16be1 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
@@ -98,7 +98,7 @@ public class ClusterApiServlet extends AbstractServlet {
     protected ObjectNode getClusterStateJSON(IServletRequest request, String pathToNode) {
         ObjectNode json = ClusterStateManager.INSTANCE.getClusterStateDescription();
         AppContextInfo appConfig = (AppContextInfo) ctx.get(ASTERIX_APP_CONTEXT_INFO_ATTR);
-        json.putPOJO("config", ConfigUtils.getSectionOptionsForJSON(appConfig.getCCApplicationContext().getAppConfig(),
+        json.putPOJO("config", ConfigUtils.getSectionOptionsForJSON(appConfig.getCCServiceContext().getAppConfig(),
                 Section.COMMON, getConfigSelector()));
 
         ArrayNode ncs = (ArrayNode) json.get("ncs");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
index aacad8e..55ea971 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
@@ -75,7 +75,7 @@ import org.apache.asterix.replication.storage.ReplicaResourcesManager;
 import org.apache.asterix.runtime.transaction.GlobalResourceIdFactoryProvider;
 import org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepositoryFactory;
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IIOManager;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponent;
@@ -103,7 +103,7 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
     private static final Logger LOGGER = Logger.getLogger(NCAppRuntimeContext.class.getName());
 
     private ILSMMergePolicyFactory metadataMergePolicyFactory;
-    private final INCApplicationContext ncApplicationContext;
+    private final INCServiceContext ncServiceContext;
     private final IResourceIdFactory resourceIdFactory;
     private CompilerProperties compilerProperties;
     private ExternalProperties externalProperties;
@@ -137,12 +137,12 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
     private final NCExtensionManager ncExtensionManager;
     private final IStorageComponentProvider componentProvider;
 
-    public NCAppRuntimeContext(INCApplicationContext ncApplicationContext, List<AsterixExtension> extensions)
+    public NCAppRuntimeContext(INCServiceContext ncServiceContext, List<AsterixExtension> extensions)
             throws AsterixException, InstantiationException, IllegalAccessException, ClassNotFoundException,
             IOException {
         List<AsterixExtension> allExtensions = new ArrayList<>();
-        this.ncApplicationContext = ncApplicationContext;
-        PropertiesAccessor propertiesAccessor = PropertiesAccessor.getInstance(ncApplicationContext.getAppConfig());
+        this.ncServiceContext = ncServiceContext;
+        PropertiesAccessor propertiesAccessor = PropertiesAccessor.getInstance(ncServiceContext.getAppConfig());
         compilerProperties = new CompilerProperties(propertiesAccessor);
         externalProperties = new ExternalProperties(propertiesAccessor);
         metadataProperties = new MetadataProperties(propertiesAccessor);
@@ -160,7 +160,7 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
         allExtensions.addAll(new ExtensionProperties(propertiesAccessor).getExtensions());
         ncExtensionManager = new NCExtensionManager(allExtensions);
         componentProvider = new StorageComponentProvider();
-        resourceIdFactory = new GlobalResourceIdFactoryProvider(ncApplicationContext).createResourceIdFactory();
+        resourceIdFactory = new GlobalResourceIdFactoryProvider(ncServiceContext).createResourceIdFactory();
     }
 
     @Override
@@ -168,28 +168,28 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
         Logger.getLogger("org.apache.asterix").setLevel(externalProperties.getLogLevel());
         Logger.getLogger("org.apache.hyracks").setLevel(externalProperties.getLogLevel());
 
-        ioManager = ncApplicationContext.getIoManager();
-        threadExecutor = new ThreadExecutor(ncApplicationContext.getThreadFactory());
+        ioManager = ncServiceContext.getIoManager();
+        threadExecutor = new ThreadExecutor(ncServiceContext.getThreadFactory());
         fileMapManager = new FileMapManager(ioManager);
         ICacheMemoryAllocator allocator = new HeapBufferAllocator();
         IPageCleanerPolicy pcp = new DelayPageCleanerPolicy(600000);
         IPageReplacementStrategy prs = new ClockPageReplacementStrategy(allocator,
                 storageProperties.getBufferCachePageSize(), storageProperties.getBufferCacheNumPages());
 
-        AsynchronousScheduler.INSTANCE.init(ncApplicationContext.getThreadFactory());
+        AsynchronousScheduler.INSTANCE.init(ncServiceContext.getThreadFactory());
         lsmIOScheduler = AsynchronousScheduler.INSTANCE;
 
         metadataMergePolicyFactory = new PrefixMergePolicyFactory();
 
         ILocalResourceRepositoryFactory persistentLocalResourceRepositoryFactory =
-                new PersistentLocalResourceRepositoryFactory(ioManager, ncApplicationContext.getNodeId(),
+                new PersistentLocalResourceRepositoryFactory(ioManager, ncServiceContext.getNodeId(),
                         metadataProperties);
 
         localResourceRepository =
                 (PersistentLocalResourceRepository) persistentLocalResourceRepositoryFactory.createRepository();
 
         IAppRuntimeContextProvider asterixAppRuntimeContextProvider = new AppRuntimeContextProviderForRecovery(this);
-        txnSubsystem = new TransactionSubsystem(ncApplicationContext, ncApplicationContext.getNodeId(),
+        txnSubsystem = new TransactionSubsystem(ncServiceContext, ncServiceContext.getNodeId(),
                 asterixAppRuntimeContextProvider, txnProperties);
 
         IRecoveryManager recoveryMgr = txnSubsystem.getRecoveryManager();
@@ -205,11 +205,11 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
 
         isShuttingdown = false;
 
-        activeManager = new ActiveManager(threadExecutor, ncApplicationContext.getNodeId(),
+        activeManager = new ActiveManager(threadExecutor, ncServiceContext.getNodeId(),
                 activeProperties.getMemoryComponentGlobalBudget(), compilerProperties.getFrameSize());
 
-        if (replicationProperties.isParticipant(ncApplicationContext.getNodeId())) {
-            String nodeId = ncApplicationContext.getNodeId();
+        if (replicationProperties.isParticipant(ncServiceContext.getNodeId())) {
+            String nodeId = ncServiceContext.getNodeId();
 
             replicaResourcesManager = new ReplicaResourcesManager(localResourceRepository, metadataProperties);
 
@@ -238,24 +238,24 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
 
             //initialize replication channel
             replicationChannel = new ReplicationChannel(nodeId, replicationProperties, txnSubsystem.getLogManager(),
-                    replicaResourcesManager, replicationManager, ncApplicationContext,
+                    replicaResourcesManager, replicationManager, ncServiceContext,
                     asterixAppRuntimeContextProvider);
 
             remoteRecoveryManager = new RemoteRecoveryManager(replicationManager, this, replicationProperties);
 
             bufferCache = new BufferCache(ioManager, prs, pcp, fileMapManager,
-                    storageProperties.getBufferCacheMaxOpenFiles(), ncApplicationContext.getThreadFactory(),
+                    storageProperties.getBufferCacheMaxOpenFiles(), ncServiceContext.getThreadFactory(),
                     replicationManager);
         } else {
             bufferCache = new BufferCache(ioManager, prs, pcp, fileMapManager,
-                    storageProperties.getBufferCacheMaxOpenFiles(), ncApplicationContext.getThreadFactory());
+                    storageProperties.getBufferCacheMaxOpenFiles(), ncServiceContext.getThreadFactory());
         }
 
         /*
          * The order of registration is important. The buffer cache must registered before recovery and transaction
          * managers. Notes: registered components are stopped in reversed order
          */
-        ILifeCycleComponentManager lccm = ncApplicationContext.getLifeCycleComponentManager();
+        ILifeCycleComponentManager lccm = ncServiceContext.getLifeCycleComponentManager();
         lccm.register((ILifeCycleComponent) bufferCache);
         /*
          * LogManager must be stopped after RecoveryManager, DatasetLifeCycleManager, and ReplicationManager
@@ -442,7 +442,7 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
         MetadataNode.INSTANCE.initialize(this, ncExtensionManager.getMetadataTupleTranslatorProvider(),
                 ncExtensionManager.getMetadataExtensions());
 
-        proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
+        proxy = (IAsterixStateProxy) ncServiceContext.getDistributedState();
         if (proxy == null) {
             throw new IllegalStateException("Metadata node cannot access distributed state");
         }
@@ -451,9 +451,9 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
         // This way we can delay the registration of the metadataNode until
         // it is completely initialized.
         MetadataManager.initialize(proxy, MetadataNode.INSTANCE);
-        MetadataBootstrap.startUniverse(ncApplicationContext, newUniverse);
+        MetadataBootstrap.startUniverse(ncServiceContext, newUniverse);
         MetadataBootstrap.startDDLRecovery();
-        ncExtensionManager.initializeMetadata(ncApplicationContext);
+        ncExtensionManager.initializeMetadata(ncServiceContext);
 
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Metadata node bound");
@@ -464,7 +464,7 @@ public class NCAppRuntimeContext implements IAppRuntimeContext {
     public void exportMetadataNodeStub() throws RemoteException {
         IMetadataNode stub = (IMetadataNode) UnicastRemoteObject.exportObject(MetadataNode.INSTANCE,
                 getMetadataProperties().getMetadataPort());
-        ((IAsterixStateProxy) ncApplicationContext.getDistributedState()).setMetadataNode(stub);
+        ((IAsterixStateProxy) ncServiceContext.getDistributedState()).setMetadataNode(stub);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
index 9937479..6ea97d3 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
@@ -29,7 +29,7 @@ import org.apache.asterix.metadata.api.IMetadataExtension;
 import org.apache.asterix.metadata.api.INCExtensionManager;
 import org.apache.asterix.metadata.entitytupletranslators.MetadataTupleTranslatorProvider;
 import org.apache.asterix.utils.ExtensionUtil;
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 /**
@@ -91,17 +91,17 @@ public class NCExtensionManager implements INCExtensionManager {
     /**
      * Called on bootstrap of metadata node allowing extensions to instantiate their Metadata artifacts
      *
-     * @param ncApplicationContext
-     *            the node controller application context
+     * @param ncServiceCtx
+     *            the node controller service context
      * @throws HyracksDataException
      */
-    public void initializeMetadata(INCApplicationContext appCtx) throws HyracksDataException {
+    public void initializeMetadata(INCServiceContext ncServiceCtx) throws HyracksDataException {
         if (mdExtensions != null) {
             for (IMetadataExtension mdExtension : mdExtensions) {
                 try {
-                    mdExtension.initializeMetadata(appCtx);
+                    mdExtension.initializeMetadata(ncServiceCtx);
                 } catch (RemoteException | ACIDException e) {
-                    throw new HyracksDataException(e);
+                    throw HyracksDataException.create(e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
index 4ee1122..6e4e4cb 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
@@ -43,7 +43,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.asterix.common.api.IDatasetLifecycleManager;
-import org.apache.asterix.common.config.IPropertiesProvider;
 import org.apache.asterix.common.config.ReplicationProperties;
 import org.apache.asterix.common.exceptions.ACIDException;
 import org.apache.asterix.common.ioopcallbacks.AbstractLSMIOOperationCallback;
@@ -64,7 +63,7 @@ import org.apache.asterix.transaction.management.service.recovery.AbstractCheckp
 import org.apache.asterix.transaction.management.service.recovery.TxnId;
 import org.apache.asterix.transaction.management.service.transaction.TransactionManagementConstants;
 import org.apache.commons.io.FileUtils;
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponent;
 import org.apache.hyracks.storage.am.common.api.IIndex;
@@ -92,14 +91,14 @@ public class RecoveryManager implements IRecoveryManager, ILifeCycleComponent {
     private final PersistentLocalResourceRepository localResourceRepository;
     private final ICheckpointManager checkpointManager;
     private SystemState state;
-    private final INCApplicationContext appCtx;
+    private final INCServiceContext serviceCtx;
 
-    public RecoveryManager(ITransactionSubsystem txnSubsystem, INCApplicationContext appCtx) {
-        this.appCtx = appCtx;
+    public RecoveryManager(ITransactionSubsystem txnSubsystem, INCServiceContext serviceCtx) {
+        this.serviceCtx = serviceCtx;
         this.txnSubsystem = txnSubsystem;
         logMgr = (LogManager) txnSubsystem.getLogManager();
-        ReplicationProperties repProperties = ((IPropertiesProvider) txnSubsystem.getAsterixAppRuntimeContextProvider()
-                .getAppContext()).getReplicationProperties();
+        ReplicationProperties repProperties =
+                txnSubsystem.getAsterixAppRuntimeContextProvider().getAppContext().getReplicationProperties();
         replicationEnabled = repProperties.isParticipant(txnSubsystem.getId());
         localResourceRepository = (PersistentLocalResourceRepository) txnSubsystem.getAsterixAppRuntimeContextProvider()
                 .getLocalResourceRepository();
@@ -374,7 +373,7 @@ public class RecoveryManager implements IRecoveryManager, ILifeCycleComponent {
                                 index = (ILSMIndex) datasetLifecycleManager.get(localResource.getPath());
                                 if (index == null) {
                                     //#. create index instance and register to indexLifeCycleManager
-                                    index = localResourceMetadata.createIndexInstance(appCtx, localResource);
+                                    index = localResourceMetadata.createIndexInstance(serviceCtx, localResource);
                                     datasetLifecycleManager.register(localResource.getPath(), index);
                                     datasetLifecycleManager.open(localResource.getPath());
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/TransactionSubsystem.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/TransactionSubsystem.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/TransactionSubsystem.java
index 8e9463b..88311c5 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/TransactionSubsystem.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/TransactionSubsystem.java
@@ -42,7 +42,7 @@ import org.apache.asterix.transaction.management.service.logging.LogManager;
 import org.apache.asterix.transaction.management.service.logging.LogManagerWithReplication;
 import org.apache.asterix.transaction.management.service.recovery.CheckpointManagerFactory;
 import org.apache.asterix.transaction.management.service.transaction.TransactionManager;
-import org.apache.hyracks.api.application.INCApplicationContext;
+import org.apache.hyracks.api.application.INCServiceContext;
 
 /**
  * Provider for all the sub-systems (transaction/lock/log/recovery) managers.
@@ -62,7 +62,7 @@ public class TransactionSubsystem implements ITransactionSubsystem {
     private long profilerEntityCommitLogCount = 0;
     private EntityCommitProfiler ecp;
 
-    public TransactionSubsystem(INCApplicationContext appCtx, String id,
+    public TransactionSubsystem(INCServiceContext serviceCtx, String id,
             IAppRuntimeContextProvider asterixAppRuntimeContextProvider, TransactionProperties txnProperties)
             throws ACIDException {
         this.asterixAppRuntimeContextProvider = asterixAppRuntimeContextProvider;
@@ -89,7 +89,7 @@ public class TransactionSubsystem implements ITransactionSubsystem {
         } else {
             this.logManager = new LogManager(this);
         }
-        this.recoveryManager = new RecoveryManager(this, appCtx);
+        this.recoveryManager = new RecoveryManager(this, serviceCtx);
 
         if (TransactionUtil.PROFILE_MODE) {
             ecp = new EntityCommitProfiler(this, this.txnProperties.getCommitProfilerReportInterval());

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/BindMetadataNodeTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/BindMetadataNodeTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/BindMetadataNodeTask.java
index 99f641b..91f3524 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/BindMetadataNodeTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/BindMetadataNodeTask.java
@@ -22,7 +22,6 @@ import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class BindMetadataNodeTask implements INCLifecycleTask {
 
@@ -35,13 +34,12 @@ public class BindMetadataNodeTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         try {
             if (exportStub) {
-                runtimeContext.exportMetadataNodeStub();
+                appContext.exportMetadataNodeStub();
             } else {
-                runtimeContext.unexportMetadataNodeStub();
+                appContext.unexportMetadataNodeStub();
             }
         } catch (Exception e) {
             throw HyracksDataException.create(e);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CheckpointTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CheckpointTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CheckpointTask.java
index 8ef6ae3..e77346a 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CheckpointTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CheckpointTask.java
@@ -23,7 +23,6 @@ import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.asterix.common.transactions.ICheckpointManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class CheckpointTask implements INCLifecycleTask {
 
@@ -31,9 +30,8 @@ public class CheckpointTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        ICheckpointManager checkpointMgr = runtimeContext.getTransactionSubsystem().getCheckpointManager();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        ICheckpointManager checkpointMgr = appContext.getTransactionSubsystem().getCheckpointManager();
         checkpointMgr.doSharpCheckpoint();
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/ExternalLibrarySetupTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/ExternalLibrarySetupTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/ExternalLibrarySetupTask.java
index 8604364..ad9b28a 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/ExternalLibrarySetupTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/ExternalLibrarySetupTask.java
@@ -23,7 +23,6 @@ import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class ExternalLibrarySetupTask implements INCLifecycleTask {
 
@@ -36,8 +35,7 @@ public class ExternalLibrarySetupTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         try {
             ExternalLibraryUtils.setUpExternaLibraries(appContext.getLibraryManager(), metadataNode);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalRecoveryTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalRecoveryTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalRecoveryTask.java
index bca39b0..777097d 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalRecoveryTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/LocalRecoveryTask.java
@@ -26,7 +26,6 @@ import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.asterix.common.exceptions.ACIDException;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class LocalRecoveryTask implements INCLifecycleTask {
 
@@ -39,10 +38,9 @@ public class LocalRecoveryTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         try {
-            runtimeContext.getTransactionSubsystem().getRecoveryManager().startLocalRecovery(partitions);
+            appContext.getTransactionSubsystem().getRecoveryManager().startLocalRecovery(partitions);
         } catch (IOException | ACIDException e) {
             throw HyracksDataException.create(e);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/MetadataBootstrapTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/MetadataBootstrapTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/MetadataBootstrapTask.java
index f7c33a4..65004b8 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/MetadataBootstrapTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/MetadataBootstrapTask.java
@@ -23,7 +23,6 @@ import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.asterix.common.transactions.IRecoveryManager.SystemState;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class MetadataBootstrapTask implements INCLifecycleTask {
 
@@ -31,8 +30,7 @@ public class MetadataBootstrapTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         try {
             SystemState state = appContext.getTransactionSubsystem().getRecoveryManager().getSystemState();
             appContext.initializeMetadata(state == SystemState.PERMANENT_DATA_LOSS);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/RemoteRecoveryTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/RemoteRecoveryTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/RemoteRecoveryTask.java
index 4574304..48479c5 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/RemoteRecoveryTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/RemoteRecoveryTask.java
@@ -26,7 +26,6 @@ import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class RemoteRecoveryTask implements INCLifecycleTask {
 
@@ -39,9 +38,8 @@ public class RemoteRecoveryTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        runtimeContext.getRemoteRecoveryManager().doRemoteRecoveryPlan(recoveryPlan);
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        appContext.getRemoteRecoveryManager().doRemoteRecoveryPlan(recoveryPlan);
     }
 
     private void writeObject(java.io.ObjectOutputStream out) throws IOException {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartFailbackTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartFailbackTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartFailbackTask.java
index 6ae4487..9f04b10 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartFailbackTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartFailbackTask.java
@@ -22,7 +22,6 @@ import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class StartFailbackTask implements INCLifecycleTask {
 
@@ -30,8 +29,7 @@ public class StartFailbackTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        runtimeContext.getRemoteRecoveryManager().startFailbackProcess();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        appContext.getRemoteRecoveryManager().startFailbackProcess();
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartLifecycleComponentsTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartLifecycleComponentsTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartLifecycleComponentsTask.java
index 3beb573..d1754dd 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartLifecycleComponentsTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartLifecycleComponentsTask.java
@@ -25,15 +25,13 @@ import java.util.logging.Logger;
 
 import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.api.INCLifecycleTask;
-import org.apache.asterix.common.config.IPropertiesProvider;
 import org.apache.asterix.common.config.MetadataProperties;
 import org.apache.asterix.hyracks.bootstrap.AsterixStateDumpHandler;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
 import org.apache.hyracks.api.lifecycle.LifeCycleComponentManager;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
-import org.apache.hyracks.control.nc.application.NCApplicationContext;
+import org.apache.hyracks.control.nc.application.NCServiceContext;
 
 public class StartLifecycleComponentsTask implements INCLifecycleTask {
 
@@ -42,26 +40,25 @@ public class StartLifecycleComponentsTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        NCApplicationContext appContext = ncs.getApplicationContext();
-        MetadataProperties metadataProperties = ((IPropertiesProvider) runtimeContext).getMetadataProperties();
+        IAppRuntimeContext applicationContext = (IAppRuntimeContext) cs.getApplicationContext();
+        NCServiceContext serviceCtx = (NCServiceContext) cs.getContext();
+        MetadataProperties metadataProperties = applicationContext.getMetadataProperties();
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Starting lifecycle components");
         }
         Map<String, String> lifecycleMgmtConfiguration = new HashMap<>();
         String dumpPathKey = LifeCycleComponentManager.Config.DUMP_PATH_KEY;
-        String dumpPath = metadataProperties.getCoredumpPath(appContext.getNodeId());
+        String dumpPath = metadataProperties.getCoredumpPath(serviceCtx.getNodeId());
         lifecycleMgmtConfiguration.put(dumpPathKey, dumpPath);
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Coredump directory for NC is: " + dumpPath);
         }
-        ILifeCycleComponentManager lccm = appContext.getLifeCycleComponentManager();
+        ILifeCycleComponentManager lccm = serviceCtx.getLifeCycleComponentManager();
         lccm.configure(lifecycleMgmtConfiguration);
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Configured:" + lccm);
         }
-        appContext.setStateDumpHandler(new AsterixStateDumpHandler(appContext.getNodeId(), lccm.getDumpPath(), lccm));
+        serviceCtx.setStateDumpHandler(new AsterixStateDumpHandler(serviceCtx.getNodeId(), lccm.getDumpPath(), lccm));
         lccm.startAll();
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartReplicationServiceTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartReplicationServiceTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartReplicationServiceTask.java
index 17fde86..93e5b50 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartReplicationServiceTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/StartReplicationServiceTask.java
@@ -23,7 +23,6 @@ import org.apache.asterix.common.api.INCLifecycleTask;
 import org.apache.asterix.common.replication.IReplicationManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class StartReplicationServiceTask implements INCLifecycleTask {
 
@@ -31,12 +30,11 @@ public class StartReplicationServiceTask implements INCLifecycleTask {
 
     @Override
     public void perform(IControllerService cs) throws HyracksDataException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext runtimeContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
         try {
             //Open replication channel
-            runtimeContext.getReplicationChannel().start();
-            final IReplicationManager replicationManager = runtimeContext.getReplicationManager();
+            appContext.getReplicationChannel().start();
+            final IReplicationManager replicationManager = appContext.getReplicationManager();
             //Check the state of remote replicas
             replicationManager.initializeReplicasState();
             //Start replication after the state of remote replicas has been initialized.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/CompleteFailbackRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/CompleteFailbackRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/CompleteFailbackRequestMessage.java
index 16a800b..0924838 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/CompleteFailbackRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/CompleteFailbackRequestMessage.java
@@ -29,7 +29,6 @@ import org.apache.asterix.common.replication.IRemoteRecoveryManager;
 import org.apache.asterix.runtime.message.AbstractFailbackPlanMessage;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class CompleteFailbackRequestMessage extends AbstractFailbackPlanMessage {
 
@@ -64,10 +63,8 @@ public class CompleteFailbackRequestMessage extends AbstractFailbackPlanMessage
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext =
-                (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        INCMessageBroker broker = (INCMessageBroker) cs.getContext().getMessageBroker();
         HyracksDataException hde = null;
         try {
             IRemoteRecoveryManager remoteRecoeryManager = appContext.getRemoteRecoveryManager();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/PreparePartitionsFailbackRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/PreparePartitionsFailbackRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/PreparePartitionsFailbackRequestMessage.java
index 8188c44..abfd6b2 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/PreparePartitionsFailbackRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/PreparePartitionsFailbackRequestMessage.java
@@ -29,7 +29,6 @@ import org.apache.asterix.runtime.message.AbstractFailbackPlanMessage;
 import org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class PreparePartitionsFailbackRequestMessage extends AbstractFailbackPlanMessage {
 
@@ -73,10 +72,8 @@ public class PreparePartitionsFailbackRequestMessage extends AbstractFailbackPla
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext =
-                (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        INCMessageBroker broker = (INCMessageBroker) cs.getContext().getMessageBroker();
         /**
          * if the metadata partition will be failed back
          * we need to flush and close all datasets including metadata datasets
@@ -100,15 +97,15 @@ public class PreparePartitionsFailbackRequestMessage extends AbstractFailbackPla
         }
 
         //mark the partitions to be closed as inactive
-        PersistentLocalResourceRepository localResourceRepo = (PersistentLocalResourceRepository) appContext
-                .getLocalResourceRepository();
+        PersistentLocalResourceRepository localResourceRepo =
+                (PersistentLocalResourceRepository) appContext.getLocalResourceRepository();
         for (Integer partitionId : partitions) {
             localResourceRepo.addInactivePartition(partitionId);
         }
 
         //send response after partitions prepared for failback
-        PreparePartitionsFailbackResponseMessage reponse = new PreparePartitionsFailbackResponseMessage(planId,
-                requestId, partitions);
+        PreparePartitionsFailbackResponseMessage reponse =
+                new PreparePartitionsFailbackResponseMessage(planId, requestId, partitions);
         try {
             broker.sendMessageToCC(reponse);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/ReplayPartitionLogsRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/ReplayPartitionLogsRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/ReplayPartitionLogsRequestMessage.java
index e0bc49d..5a73543 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/ReplayPartitionLogsRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/ReplayPartitionLogsRequestMessage.java
@@ -42,11 +42,11 @@ public class ReplayPartitionLogsRequestMessage implements INCLifecycleMessage {
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
         NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) ncs.getApplicationContext();
         // Replay the logs for these partitions and flush any impacted dataset
         appContext.getRemoteRecoveryManager().replayReplicaPartitionLogs(partitions, true);
 
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        INCMessageBroker broker = (INCMessageBroker) ncs.getContext().getMessageBroker();
         ReplayPartitionLogsResponseMessage reponse = new ReplayPartitionLogsResponseMessage(ncs.getId(), partitions);
         try {
             broker.sendMessageToCC(reponse);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskRequestMessage.java
index 472a89c..6a313f0 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskRequestMessage.java
@@ -44,7 +44,7 @@ public class StartupTaskRequestMessage implements INCLifecycleMessage {
     public static void send(NodeControllerService cs, SystemState systemState) throws HyracksDataException {
         try {
             StartupTaskRequestMessage msg = new StartupTaskRequestMessage(cs.getId(), systemState);
-            ((INCMessageBroker) cs.getApplicationContext().getMessageBroker()).sendMessageToCC(msg);
+            ((INCMessageBroker) cs.getContext().getMessageBroker()).sendMessageToCC(msg);
         } catch (Exception e) {
             LOGGER.log(Level.SEVERE, "Unable to send StartupTaskRequestMessage to CC", e);
             throw HyracksDataException.create(e);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskResponseMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskResponseMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskResponseMessage.java
index 922ac89..92abf5b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskResponseMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/StartupTaskResponseMessage.java
@@ -27,7 +27,6 @@ import org.apache.asterix.common.messaging.api.INCMessageBroker;
 import org.apache.asterix.common.replication.INCLifecycleMessage;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class StartupTaskResponseMessage implements INCLifecycleMessage {
 
@@ -43,8 +42,7 @@ public class StartupTaskResponseMessage implements INCLifecycleMessage {
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        INCMessageBroker broker = (INCMessageBroker) cs.getContext().getMessageBroker();
         boolean success = true;
         HyracksDataException exception = null;
         try {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverMetadataNodeRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverMetadataNodeRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverMetadataNodeRequestMessage.java
index 3be3eab..fbc0a4d 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverMetadataNodeRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverMetadataNodeRequestMessage.java
@@ -26,7 +26,6 @@ import org.apache.asterix.common.messaging.api.INCMessageBroker;
 import org.apache.asterix.common.replication.INCLifecycleMessage;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class TakeoverMetadataNodeRequestMessage implements INCLifecycleMessage {
 
@@ -35,10 +34,8 @@ public class TakeoverMetadataNodeRequestMessage implements INCLifecycleMessage {
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext =
-                (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        INCMessageBroker broker = (INCMessageBroker) cs.getContext().getMessageBroker();
         HyracksDataException hde = null;
         try {
             appContext.initializeMetadata(false);
@@ -47,8 +44,8 @@ public class TakeoverMetadataNodeRequestMessage implements INCLifecycleMessage {
             LOGGER.log(Level.SEVERE, "Failed taking over metadata", e);
             hde = HyracksDataException.create(e);
         } finally {
-            TakeoverMetadataNodeResponseMessage reponse = new TakeoverMetadataNodeResponseMessage(
-                    appContext.getTransactionSubsystem().getId());
+            TakeoverMetadataNodeResponseMessage reponse =
+                    new TakeoverMetadataNodeResponseMessage(appContext.getTransactionSubsystem().getId());
             try {
                 broker.sendMessageToCC(reponse);
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverPartitionsRequestMessage.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverPartitionsRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverPartitionsRequestMessage.java
index 7f9cc2b..09bb051 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverPartitionsRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/replication/message/TakeoverPartitionsRequestMessage.java
@@ -29,7 +29,6 @@ import org.apache.asterix.common.replication.INCLifecycleMessage;
 import org.apache.asterix.common.replication.IRemoteRecoveryManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
-import org.apache.hyracks.control.nc.NodeControllerService;
 
 public class TakeoverPartitionsRequestMessage implements INCLifecycleMessage {
 
@@ -74,9 +73,8 @@ public class TakeoverPartitionsRequestMessage implements INCLifecycleMessage {
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException, InterruptedException {
-        NodeControllerService ncs = (NodeControllerService) cs;
-        IAppRuntimeContext appContext = (IAppRuntimeContext) ncs.getApplicationContext().getApplicationObject();
-        INCMessageBroker broker = (INCMessageBroker) ncs.getApplicationContext().getMessageBroker();
+        IAppRuntimeContext appContext = (IAppRuntimeContext) cs.getApplicationContext();
+        INCMessageBroker broker = (INCMessageBroker) cs.getContext().getMessageBroker();
         //if the NC is shutting down, it should ignore takeover partitions request
         if (!appContext.isShuttingdown()) {
             HyracksDataException hde = null;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationClassHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationClassHelper.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationClassHelper.java
new file mode 100644
index 0000000..e276be1
--- /dev/null
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationClassHelper.java
@@ -0,0 +1,39 @@
+/*
+ * 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.asterix.hyracks.bootstrap;
+
+import org.apache.asterix.common.config.AsterixProperties;
+import org.apache.hyracks.api.config.IConfigManager;
+import org.apache.hyracks.control.common.controllers.CCConfig;
+import org.apache.hyracks.control.common.controllers.ControllerConfig;
+import org.apache.hyracks.control.common.controllers.NCConfig;
+import org.apache.hyracks.util.file.FileUtil;
+
+class ApplicationClassHelper {
+    private ApplicationClassHelper() {
+    }
+
+    static void registerConfigOptions(IConfigManager configManager) {
+        AsterixProperties.registerConfigOptions(configManager);
+
+        ControllerConfig.defaultDir = FileUtil.joinPath(System.getProperty("java.io.tmpdir"), "asterixdb");
+        NCConfig.defaultAppClass = NCApplication.class.getName();
+        CCConfig.defaultAppClass = CCApplication.class.getName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/953eb966/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationEntryPointHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationEntryPointHelper.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationEntryPointHelper.java
deleted file mode 100644
index 8c3861a..0000000
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ApplicationEntryPointHelper.java
+++ /dev/null
@@ -1,39 +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.asterix.hyracks.bootstrap;
-
-import org.apache.asterix.common.config.AsterixProperties;
-import org.apache.hyracks.api.config.IConfigManager;
-import org.apache.hyracks.control.common.controllers.CCConfig;
-import org.apache.hyracks.control.common.controllers.ControllerConfig;
-import org.apache.hyracks.control.common.controllers.NCConfig;
-import org.apache.hyracks.util.file.FileUtil;
-
-class ApplicationEntryPointHelper {
-    private ApplicationEntryPointHelper() {
-    }
-
-    static void registerConfigOptions(IConfigManager configManager) {
-        AsterixProperties.registerConfigOptions(configManager);
-
-        ControllerConfig.defaultDir = FileUtil.joinPath(System.getProperty("java.io.tmpdir"), "asterixdb");
-        NCConfig.defaultAppClass = NCApplicationEntryPoint.class.getName();
-        CCConfig.defaultAppClass = CCApplicationEntryPoint.class.getName();
-    }
-}


Mime
View raw message