asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject asterixdb git commit: Remove HyracksRootContext
Date Sun, 30 Oct 2016 23:13:52 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 4fac5d19d -> 9fbff0185


Remove HyracksRootContext

Change-Id: I24f9d7b1fc5bdcf9d09abdac107001ff6b70bf02
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1321
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


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

Branch: refs/heads/master
Commit: 9fbff0185951cbe139be733fdee3fdc11d317137
Parents: 4fac5d1
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Sun Oct 30 10:25:28 2016 -0700
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Sun Oct 30 16:13:27 2016 -0700

----------------------------------------------------------------------
 .../app/nc/AsterixNCAppRuntimeContext.java      |  2 +-
 .../app/bootstrap/TestNodeController.java       |  2 +-
 .../metadata/bootstrap/MetadataBootstrap.java   |  8 +--
 .../api/application/INCApplicationContext.java  |  8 ++-
 .../api/context/IHyracksRootContext.java        | 30 -----------
 .../org/apache/hyracks/control/nc/Joblet.java   | 15 +++---
 .../control/nc/NodeControllerService.java       | 14 +++---
 .../nc/application/NCApplicationContext.java    | 12 ++---
 .../nc/dataset/DatasetPartitionManager.java     |  6 +--
 .../control/nc/partitions/PartitionManager.java | 10 ++--
 .../control/nc/runtime/RootHyracksContext.java  | 47 ------------------
 .../examples/btree/helper/RuntimeContext.java   |  3 +-
 .../hyracks/test/support/TestJobletContext.java |  2 +-
 .../test/support/TestNCApplicationContext.java  | 13 ++---
 .../hyracks/test/support/TestRootContext.java   | 52 --------------------
 .../apache/hyracks/test/support/TestUtils.java  | 18 +++++--
 16 files changed, 60 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
index c2c214c..3447648 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
@@ -171,7 +171,7 @@ public class AsterixNCAppRuntimeContext implements IAsterixAppRuntimeContext,
IA
         fileMapManager = new AsterixFileMapManager();
         ICacheMemoryAllocator allocator = new HeapBufferAllocator();
         IPageCleanerPolicy pcp = new DelayPageCleanerPolicy(600000);
-        ioManager = ncApplicationContext.getRootContext().getIOManager();
+        ioManager = ncApplicationContext.getIoManager();
         IPageReplacementStrategy prs = new ClockPageReplacementStrategy(allocator,
                 storageProperties.getBufferCachePageSize(), storageProperties.getBufferCacheNumPages());
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/asterixdb/asterix-app/src/test/java/org/apache/asterix/app/bootstrap/TestNodeController.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/app/bootstrap/TestNodeController.java
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/app/bootstrap/TestNodeController.java
index 88ca736..df8d22e 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/app/bootstrap/TestNodeController.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/app/bootstrap/TestNodeController.java
@@ -370,7 +370,7 @@ public class TestNodeController {
         ctx = Mockito.spy(ctx);
         Mockito.when(ctx.getJobletContext()).thenReturn(jobletCtx);
         Mockito.when(ctx.getIOManager())
-                .thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getRootContext().getIOManager());
+                .thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getIoManager());
         return ctx;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index cf014d5..0990998 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -32,9 +32,9 @@ import org.apache.asterix.common.api.ILocalResourceMetadata;
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
 import org.apache.asterix.common.config.ClusterProperties;
+import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
-import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.context.BaseOperationTracker;
 import org.apache.asterix.common.context.CorrelatedPrefixMergePolicyFactory;
 import org.apache.asterix.common.exceptions.ACIDException;
@@ -60,10 +60,10 @@ import org.apache.asterix.metadata.entities.Dataverse;
 import org.apache.asterix.metadata.entities.FeedPolicyEntity;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.metadata.entities.Node;
-import org.apache.asterix.metadata.entities.NodeGroup;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails.FileStructure;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails.PartitioningStrategy;
+import org.apache.asterix.metadata.entities.Node;
+import org.apache.asterix.metadata.entities.NodeGroup;
 import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies;
 import org.apache.asterix.metadata.utils.MetadataConstants;
 import org.apache.asterix.om.types.IAType;
@@ -154,7 +154,7 @@ public class MetadataBootstrap {
         localResourceRepository = runtimeContext.getLocalResourceRepository();
         bufferCache = runtimeContext.getBufferCache();
         fileMapProvider = runtimeContext.getFileMapManager();
-        ioManager = ncApplicationContext.getRootContext().getIOManager();
+        ioManager = ncApplicationContext.getIoManager();
 
         MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
         try {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplicationContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplicationContext.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplicationContext.java
index b1aa45f..ae25f88 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplicationContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplicationContext.java
@@ -19,7 +19,7 @@
 package org.apache.hyracks.api.application;
 
 import org.apache.hyracks.api.comm.IChannelInterfaceFactory;
-import org.apache.hyracks.api.context.IHyracksRootContext;
+import org.apache.hyracks.api.io.IIOManager;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
 import org.apache.hyracks.api.resources.memory.IMemoryManager;
 
@@ -44,11 +44,9 @@ public interface INCApplicationContext extends IApplicationContext {
     public String getNodeId();
 
     /**
-     * Get the Hyracks Root Context.
-     *
-     * @return The Hyracks Root Context
+     * @return the IO Manager
      */
-    public IHyracksRootContext getRootContext();
+    public IIOManager getIoManager();
 
     /**
      * Set an object that can be later retrieved by the {@link #getApplicationObject()} call.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/context/IHyracksRootContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/context/IHyracksRootContext.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/context/IHyracksRootContext.java
deleted file mode 100644
index a1e57ff..0000000
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/context/IHyracksRootContext.java
+++ /dev/null
@@ -1,30 +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.api.context;
-
-import java.util.Map;
-
-import org.apache.hyracks.api.client.NodeControllerInfo;
-import org.apache.hyracks.api.io.IIOManager;
-
-public interface IHyracksRootContext {
-    public IIOManager getIOManager();
-
-    public Map<String, NodeControllerInfo> getNodeControllerInfos() throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/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 c91ebd4..98ae7c4 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
@@ -55,7 +55,6 @@ import org.apache.hyracks.control.common.job.PartitionRequest;
 import org.apache.hyracks.control.common.job.PartitionState;
 import org.apache.hyracks.control.common.job.profiling.counters.Counter;
 import org.apache.hyracks.control.common.job.profiling.om.JobletProfile;
-import org.apache.hyracks.control.common.job.profiling.om.PartitionProfile;
 import org.apache.hyracks.control.common.job.profiling.om.TaskProfile;
 import org.apache.hyracks.control.nc.io.IOManager;
 import org.apache.hyracks.control.nc.io.WorkspaceFileFactory;
@@ -110,13 +109,13 @@ public class Joblet implements IHyracksJobletContext, ICounterContext
{
         this.frameManager = new FrameManager(acg.getFrameSize());
         memoryAllocation = new AtomicLong();
         this.acg = acg;
-        partitionRequestMap = new HashMap<PartitionId, IPartitionCollector>();
+        partitionRequestMap = new HashMap<>();
         env = new OperatorEnvironmentImpl(nodeController.getId());
-        stateObjectMap = new HashMap<Object, IStateObject>();
-        taskMap = new HashMap<TaskAttemptId, Task>();
-        counterMap = new HashMap<String, Counter>();
+        stateObjectMap = new HashMap<>();
+        taskMap = new HashMap<>();
+        counterMap = new HashMap<>();
         deallocatableRegistry = new DefaultDeallocatableRegistry();
-        fileFactory = new WorkspaceFileFactory(this, (IOManager) appCtx.getRootContext().getIOManager());
+        fileFactory = new WorkspaceFileFactory(this, (IOManager) appCtx.getIoManager());
         cleanupPending = false;
         IJobletEventListenerFactory jelf = acg.getJobletEventListenerFactory();
         if (jelf != null) {
@@ -192,7 +191,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext
{
         }
         for (Task task : taskMap.values()) {
             TaskProfile taskProfile = new TaskProfile(task.getTaskAttemptId(),
-                    new Hashtable<PartitionId, PartitionProfile>(task.getPartitionSendProfile()));
+                    new Hashtable<>(task.getPartitionSendProfile()));
             task.dumpProfile(taskProfile);
             jProfile.getTaskProfiles().put(task.getTaskAttemptId(), taskProfile);
         }
@@ -255,7 +254,7 @@ public class Joblet implements IHyracksJobletContext, ICounterContext
{
     }
 
     public IIOManager getIOManager() {
-        return appCtx.getRootContext().getIOManager();
+        return appCtx.getIoManager();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/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 540b4d0..39a2554 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
@@ -46,7 +46,6 @@ import org.apache.commons.lang3.mutable.MutableObject;
 import org.apache.hyracks.api.application.INCApplicationEntryPoint;
 import org.apache.hyracks.api.client.NodeControllerInfo;
 import org.apache.hyracks.api.comm.NetworkAddress;
-import org.apache.hyracks.api.context.IHyracksRootContext;
 import org.apache.hyracks.api.dataset.IDatasetPartitionManager;
 import org.apache.hyracks.api.deployment.DeploymentId;
 import org.apache.hyracks.api.io.IODeviceHandle;
@@ -78,7 +77,6 @@ import org.apache.hyracks.control.nc.net.MessagingNetworkManager;
 import org.apache.hyracks.control.nc.net.NetworkManager;
 import org.apache.hyracks.control.nc.partitions.PartitionManager;
 import org.apache.hyracks.control.nc.resources.memory.MemoryManager;
-import org.apache.hyracks.control.nc.runtime.RootHyracksContext;
 import org.apache.hyracks.control.nc.task.ShutdownTask;
 import org.apache.hyracks.control.nc.task.ThreadDumpTask;
 import org.apache.hyracks.control.nc.work.AbortTasksWork;
@@ -106,7 +104,7 @@ public class NodeControllerService implements IControllerService {
 
     private final String id;
 
-    private final IHyracksRootContext ctx;
+    private final IOManager ioManager;
 
     private final IPCSystem ipc;
 
@@ -171,7 +169,7 @@ public class NodeControllerService implements IControllerService {
         ipc = new IPCSystem(new InetSocketAddress(ncConfig.clusterNetIPAddress, ncConfig.clusterNetPort),
ipci,
                 new CCNCFunctions.SerializerDeserializer());
 
-        this.ctx = new RootHyracksContext(this, new IOManager(getDevices(ncConfig.ioDevices)));
+        ioManager = new IOManager(getDevices(ncConfig.ioDevices));
         if (id == null) {
             throw new Exception("id not set");
         }
@@ -197,8 +195,8 @@ public class NodeControllerService implements IControllerService {
         ioCounter = new IOCounterFactory().getIOCounter();
     }
 
-    public IHyracksRootContext getRootContext() {
-        return ctx;
+    public IOManager getIoManager() {
+        return ioManager;
     }
 
     public NCApplicationContext getApplicationContext() {
@@ -249,7 +247,7 @@ public class NodeControllerService implements IControllerService {
     }
 
     private void init() throws Exception {
-        ctx.getIOManager().setExecutor(executor);
+        ioManager.setExecutor(executor);
         datasetPartitionManager = new DatasetPartitionManager(this, executor, ncConfig.resultManagerMemory,
                 ncConfig.resultTTL, ncConfig.resultSweepThreshold);
         datasetNetworkManager = new DatasetNetworkManager(ncConfig.resultIPAddress, ncConfig.resultPort,
@@ -332,7 +330,7 @@ public class NodeControllerService implements IControllerService {
     }
 
     private void startApplication() throws Exception {
-        appCtx = new NCApplicationContext(this, serverCtx, ctx, id, memoryManager, lccm,
ncConfig.getAppConfig());
+        appCtx = new NCApplicationContext(this, serverCtx, ioManager, id, memoryManager,
lccm, ncConfig.getAppConfig());
         String className = ncConfig.appNCMainClass;
         if (className != null) {
             Class<?> c = Class.forName(className);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/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
index 44549b4..f52099d 100644
--- 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
@@ -26,7 +26,6 @@ import org.apache.hyracks.api.application.IApplicationConfig;
 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.context.IHyracksRootContext;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
 import org.apache.hyracks.api.resources.memory.IMemoryManager;
 import org.apache.hyracks.api.service.IControllerService;
@@ -34,25 +33,26 @@ 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 IHyracksRootContext rootCtx;
+    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, IHyracksRootContext
rootCtx,
+    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.rootCtx = rootCtx;
+        this.ioManager = ioManager;
         this.memoryManager = memoryManager;
         this.ncs = ncs;
         sdh = new IStateDumpHandler() {
@@ -88,8 +88,8 @@ public class NCApplicationContext extends ApplicationContext implements
INCAppli
     }
 
     @Override
-    public IHyracksRootContext getRootContext() {
-        return rootCtx;
+    public IOManager getIoManager() {
+        return ioManager;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
index 55fa56e..a594f95 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/dataset/DatasetPartitionManager.java
@@ -36,7 +36,6 @@ import org.apache.hyracks.api.io.IWorkspaceFileFactory;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.common.dataset.ResultStateSweeper;
 import org.apache.hyracks.control.nc.NodeControllerService;
-import org.apache.hyracks.control.nc.io.IOManager;
 import org.apache.hyracks.control.nc.io.WorkspaceFileFactory;
 import org.apache.hyracks.control.nc.resources.DefaultDeallocatableRegistry;
 
@@ -60,13 +59,13 @@ public class DatasetPartitionManager implements IDatasetPartitionManager
{
         this.ncs = ncs;
         this.executor = executor;
         deallocatableRegistry = new DefaultDeallocatableRegistry();
-        fileFactory = new WorkspaceFileFactory(deallocatableRegistry, (IOManager) ncs.getRootContext().getIOManager());
+        fileFactory = new WorkspaceFileFactory(deallocatableRegistry, ncs.getIoManager());
         if (availableMemory >= DatasetMemoryManager.getPageSize()) {
             datasetMemoryManager = new DatasetMemoryManager(availableMemory);
         } else {
             datasetMemoryManager = null;
         }
-        partitionResultStateMap = new LinkedHashMap<JobId, IDatasetStateRecord>();
+        partitionResultStateMap = new LinkedHashMap<>();
         executor.execute(new ResultStateSweeper(this, resultTTL, resultSweepThreshold));
     }
 
@@ -265,6 +264,7 @@ public class DatasetPartitionManager implements IDatasetPartitionManager
{
             timestamp = System.currentTimeMillis();
         }
 
+        @Override
         public long getTimestamp() {
             return timestamp;
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PartitionManager.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PartitionManager.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PartitionManager.java
index 76eaad3..667cfa3 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PartitionManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PartitionManager.java
@@ -36,7 +36,6 @@ import org.apache.hyracks.comm.channels.NetworkOutputChannel;
 import org.apache.hyracks.control.common.job.PartitionDescriptor;
 import org.apache.hyracks.control.common.job.PartitionState;
 import org.apache.hyracks.control.nc.NodeControllerService;
-import org.apache.hyracks.control.nc.io.IOManager;
 import org.apache.hyracks.control.nc.io.WorkspaceFileFactory;
 import org.apache.hyracks.control.nc.resources.DefaultDeallocatableRegistry;
 
@@ -50,14 +49,13 @@ public class PartitionManager {
 
     private final IWorkspaceFileFactory fileFactory;
 
-    private final Map<PartitionId, NetworkOutputChannel> partitionRequests = new HashMap<PartitionId,
NetworkOutputChannel>();
+    private final Map<PartitionId, NetworkOutputChannel> partitionRequests = new HashMap<>();
 
     public PartitionManager(NodeControllerService ncs) {
         this.ncs = ncs;
-        this.availablePartitionMap = new HashMap<PartitionId, List<IPartition>>();
+        this.availablePartitionMap = new HashMap<>();
         this.deallocatableRegistry = new DefaultDeallocatableRegistry();
-        this.fileFactory = new WorkspaceFileFactory(deallocatableRegistry, (IOManager) ncs.getRootContext()
-                .getIOManager());
+        this.fileFactory = new WorkspaceFileFactory(deallocatableRegistry, ncs.getIoManager());
     }
 
     public synchronized void registerPartition(PartitionId pid, TaskAttemptId taId, IPartition
partition,
@@ -80,7 +78,7 @@ public class PartitionManager {
              */
             List<IPartition> pList = availablePartitionMap.get(pid);
             if (pList == null) {
-                pList = new ArrayList<IPartition>();
+                pList = new ArrayList<>();
                 availablePartitionMap.put(pid, pList);
             }
             pList.add(partition);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/runtime/RootHyracksContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/runtime/RootHyracksContext.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/runtime/RootHyracksContext.java
deleted file mode 100644
index 0610a35..0000000
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/runtime/RootHyracksContext.java
+++ /dev/null
@@ -1,47 +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.runtime;
-
-import java.util.Map;
-
-import org.apache.hyracks.api.client.NodeControllerInfo;
-import org.apache.hyracks.api.context.IHyracksRootContext;
-import org.apache.hyracks.api.io.IIOManager;
-import org.apache.hyracks.control.nc.NodeControllerService;
-
-public class RootHyracksContext implements IHyracksRootContext {
-    private final NodeControllerService ncs;
-
-    private final IIOManager ioManager;
-
-    public RootHyracksContext(NodeControllerService ncs, IIOManager ioManager) {
-        this.ncs = ncs;
-        this.ioManager = ioManager;
-    }
-
-    @Override
-    public IIOManager getIOManager() {
-        return ioManager;
-    }
-
-    @Override
-    public Map<String, NodeControllerInfo> getNodeControllerInfos() throws Exception
{
-        return ncs.getNodeControllersInfo();
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
index a4909ad..f055c70 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
@@ -49,6 +49,7 @@ public class RuntimeContext {
     private IResourceLifecycleManager lcManager;
     private ResourceIdFactory resourceIdFactory;
     private ThreadFactory threadFactory = new ThreadFactory() {
+        @Override
         public Thread newThread(Runnable r) {
             return new Thread(r);
         }
@@ -58,7 +59,7 @@ public class RuntimeContext {
         fileMapManager = new TransientFileMapManager();
         ICacheMemoryAllocator allocator = new HeapBufferAllocator();
         IPageReplacementStrategy prs = new ClockPageReplacementStrategy(allocator, 32768,
50);
-        bufferCache = new BufferCache(appCtx.getRootContext().getIOManager(), prs, new DelayPageCleanerPolicy(1000),
+        bufferCache = new BufferCache(appCtx.getIoManager(), prs, new DelayPageCleanerPolicy(1000),
                 fileMapManager, 100, threadFactory);
         ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
         localResourceRepository = localResourceRepositoryFactory.createRepository();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestJobletContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestJobletContext.java
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestJobletContext.java
index d7cbc9a..f2ac2bf 100644
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestJobletContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestJobletContext.java
@@ -69,7 +69,7 @@ public class TestJobletContext implements IHyracksJobletContext {
     }
 
     public IIOManager getIOManager() {
-        return appContext.getRootContext().getIOManager();
+        return appContext.getIoManager();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestNCApplicationContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestNCApplicationContext.java
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestNCApplicationContext.java
index e4470ee..a26fac0 100644
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestNCApplicationContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestNCApplicationContext.java
@@ -25,17 +25,18 @@ import org.apache.hyracks.api.application.IApplicationConfig;
 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.context.IHyracksRootContext;
+import org.apache.hyracks.api.io.IIOManager;
 import org.apache.hyracks.api.job.IJobSerializerDeserializerContainer;
 import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
 import org.apache.hyracks.api.lifecycle.LifeCycleComponentManager;
 import org.apache.hyracks.api.messages.IMessageBroker;
 import org.apache.hyracks.api.resources.memory.IMemoryManager;
 import org.apache.hyracks.api.service.IControllerService;
+import org.apache.hyracks.control.nc.io.IOManager;
 
 public class TestNCApplicationContext implements INCApplicationContext {
     private final ILifeCycleComponentManager lccm;
-    private final IHyracksRootContext rootCtx;
+    private final IOManager ioManager;
     private final String nodeId;
 
     private Serializable distributedState;
@@ -43,9 +44,9 @@ public class TestNCApplicationContext implements INCApplicationContext {
 
     private final IMemoryManager mm;
 
-    public TestNCApplicationContext(IHyracksRootContext rootCtx, String nodeId) {
+    public TestNCApplicationContext(IOManager ioManager, String nodeId) {
         this.lccm = new LifeCycleComponentManager();
-        this.rootCtx = rootCtx;
+        this.ioManager = ioManager;
         this.nodeId = nodeId;
         mm = new IMemoryManager() {
             @Override
@@ -81,8 +82,8 @@ public class TestNCApplicationContext implements INCApplicationContext {
     }
 
     @Override
-    public IHyracksRootContext getRootContext() {
-        return rootCtx;
+    public IIOManager getIoManager() {
+        return ioManager;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestRootContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestRootContext.java
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestRootContext.java
deleted file mode 100644
index 3a5a6a8..0000000
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestRootContext.java
+++ /dev/null
@@ -1,52 +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.test.support;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Executors;
-
-import org.apache.hyracks.api.client.NodeControllerInfo;
-import org.apache.hyracks.api.context.IHyracksRootContext;
-import org.apache.hyracks.api.exceptions.HyracksException;
-import org.apache.hyracks.api.io.IIOManager;
-import org.apache.hyracks.api.io.IODeviceHandle;
-import org.apache.hyracks.control.nc.io.IOManager;
-
-public class TestRootContext implements IHyracksRootContext {
-    private IOManager ioManager;
-
-    public TestRootContext() throws HyracksException {
-        List<IODeviceHandle> devices = new ArrayList<IODeviceHandle>();
-        devices.add(new IODeviceHandle(new File(System.getProperty("java.io.tmpdir")), "."));
-        ioManager = new IOManager(devices, Executors.newCachedThreadPool());
-    }
-
-    @Override
-    public IIOManager getIOManager() {
-        return ioManager;
-    }
-
-    @Override
-    public Map<String, NodeControllerInfo> getNodeControllerInfos() throws Exception
{
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9fbff018/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
index 2a78e8b..ab87f93 100644
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
@@ -18,21 +18,27 @@
  */
 package org.apache.hyracks.test.support;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Executors;
+
 import org.apache.hyracks.api.application.INCApplicationContext;
-import org.apache.hyracks.api.context.IHyracksRootContext;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.ActivityId;
 import org.apache.hyracks.api.dataflow.OperatorDescriptorId;
 import org.apache.hyracks.api.dataflow.TaskAttemptId;
 import org.apache.hyracks.api.dataflow.TaskId;
 import org.apache.hyracks.api.exceptions.HyracksException;
+import org.apache.hyracks.api.io.IODeviceHandle;
 import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.control.nc.io.IOManager;
 
 public class TestUtils {
     public static IHyracksTaskContext create(int frameSize) {
         try {
-            IHyracksRootContext rootCtx = new TestRootContext();
-            INCApplicationContext appCtx = new TestNCApplicationContext(rootCtx, null);
+            IOManager ioManager = createIoManager();
+            INCApplicationContext appCtx = new TestNCApplicationContext(ioManager, null);
             TestJobletContext jobletCtx = new TestJobletContext(frameSize, appCtx, new JobId(0));
             TaskAttemptId tid = new TaskAttemptId(new TaskId(new ActivityId(new OperatorDescriptorId(0),
0), 0), 0);
             IHyracksTaskContext taskCtx = new TestTaskContext(jobletCtx, tid);
@@ -41,4 +47,10 @@ public class TestUtils {
             throw new RuntimeException(e);
         }
     }
+
+    private static IOManager createIoManager() throws HyracksException {
+        List<IODeviceHandle> devices = new ArrayList<>();
+        devices.add(new IODeviceHandle(new File(System.getProperty("java.io.tmpdir")), "."));
+        return new IOManager(devices, Executors.newCachedThreadPool());
+    }
 }


Mime
View raw message