http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/ContainerStat.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/ContainerStat.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/ContainerStat.java
deleted file mode 100644
index b8e8998..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/ContainerStat.java
+++ /dev/null
@@ -1,165 +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.hadoop.hdds.scm.container.placement.metrics;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ozone.web.utils.JsonUtils;
-
-import java.io.IOException;
-
-/**
- * This class represents the SCM container stat.
- */
-public class ContainerStat {
-  /**
-   * The maximum container size.
-   */
-  @JsonProperty("Size")
-  private LongMetric size;
-
-  /**
-   * The number of bytes used by the container.
-   */
-  @JsonProperty("Used")
-  private LongMetric used;
-
-  /**
-   * The number of keys in the container.
-   */
-  @JsonProperty("KeyCount")
-  private LongMetric keyCount;
-
-  /**
-   * The number of bytes read from the container.
-   */
-  @JsonProperty("ReadBytes")
-  private LongMetric readBytes;
-
-  /**
-   * The number of bytes write into the container.
-   */
-  @JsonProperty("WriteBytes")
-  private LongMetric writeBytes;
-
-  /**
-   * The number of times the container is read.
-   */
-  @JsonProperty("ReadCount")
-  private LongMetric readCount;
-
-  /**
-   * The number of times the container is written into.
-   */
-  @JsonProperty("WriteCount")
-  private LongMetric writeCount;
-
-  public ContainerStat() {
-    this(0L, 0L, 0L, 0L, 0L, 0L, 0L);
-  }
-
-  public ContainerStat(long size, long used, long keyCount, long readBytes,
-      long writeBytes, long readCount, long writeCount) {
-    Preconditions.checkArgument(size >= 0,
-        "Container size cannot be " + "negative.");
-    Preconditions.checkArgument(used >= 0,
-        "Used space cannot be " + "negative.");
-    Preconditions.checkArgument(keyCount >= 0,
-        "Key count cannot be " + "negative");
-    Preconditions.checkArgument(readBytes >= 0,
-        "Read bytes read cannot be " + "negative.");
-    Preconditions.checkArgument(readBytes >= 0,
-        "Write bytes cannot be " + "negative.");
-    Preconditions.checkArgument(readCount >= 0,
-        "Read count cannot be " + "negative.");
-    Preconditions.checkArgument(writeCount >= 0,
-        "Write count cannot be " + "negative");
-
-    this.size = new LongMetric(size);
-    this.used = new LongMetric(used);
-    this.keyCount = new LongMetric(keyCount);
-    this.readBytes = new LongMetric(readBytes);
-    this.writeBytes = new LongMetric(writeBytes);
-    this.readCount = new LongMetric(readCount);
-    this.writeCount = new LongMetric(writeCount);
-  }
-
-  public LongMetric getSize() {
-    return size;
-  }
-
-  public LongMetric getUsed() {
-    return used;
-  }
-
-  public LongMetric getKeyCount() {
-    return keyCount;
-  }
-
-  public LongMetric getReadBytes() {
-    return readBytes;
-  }
-
-  public LongMetric getWriteBytes() {
-    return writeBytes;
-  }
-
-  public LongMetric getReadCount() {
-    return readCount;
-  }
-
-  public LongMetric getWriteCount() {
-    return writeCount;
-  }
-
-  public void add(ContainerStat stat) {
-    if (stat == null) {
-      return;
-    }
-
-    this.size.add(stat.getSize().get());
-    this.used.add(stat.getUsed().get());
-    this.keyCount.add(stat.getKeyCount().get());
-    this.readBytes.add(stat.getReadBytes().get());
-    this.writeBytes.add(stat.getWriteBytes().get());
-    this.readCount.add(stat.getReadCount().get());
-    this.writeCount.add(stat.getWriteCount().get());
-  }
-
-  public void subtract(ContainerStat stat) {
-    if (stat == null) {
-      return;
-    }
-
-    this.size.subtract(stat.getSize().get());
-    this.used.subtract(stat.getUsed().get());
-    this.keyCount.subtract(stat.getKeyCount().get());
-    this.readBytes.subtract(stat.getReadBytes().get());
-    this.writeBytes.subtract(stat.getWriteBytes().get());
-    this.readCount.subtract(stat.getReadCount().get());
-    this.writeCount.subtract(stat.getWriteCount().get());
-  }
-
-  public String toJsonString() {
-    try {
-      return JsonUtils.toJsonString(this);
-    } catch (IOException ignored) {
-      return null;
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/DatanodeMetric.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/DatanodeMetric.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/DatanodeMetric.java
deleted file mode 100644
index a6e732c..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/DatanodeMetric.java
+++ /dev/null
@@ -1,91 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement.metrics;
-
-import org.apache.hadoop.hdds.scm.exceptions.SCMException;
-
-/**
- * DatanodeMetric acts as the basis for all the metric that is used in
- * comparing 2 datanodes.
- */
-public interface DatanodeMetric<T, S> extends Comparable<T> {
-
-  /**
-   * Some syntactic sugar over Comparable interface. This makes code easier to
-   * read.
-   *
-   * @param o - Other Object
-   * @return - True if *this* object is greater than argument.
-   */
-  boolean isGreater(T o);
-
-  /**
-   * Inverse of isGreater.
-   *
-   * @param o - other object.
-   * @return True if *this* object is Lesser than argument.
-   */
-  boolean isLess(T o);
-
-  /**
-   * Returns true if the object has same values. Because of issues with
-   * equals, and loss of type information this interface supports isEqual.
-   *
-   * @param o object to compare.
-   * @return True, if the values match.
-   */
-  boolean isEqual(T o);
-
-  /**
-   * A resourceCheck, defined by resourceNeeded.
-   * For example, S could be bytes required
-   * and DatanodeMetric can reply by saying it can be met or not.
-   *
-   * @param resourceNeeded -  ResourceNeeded in its own metric.
-   * @return boolean, True if this resource requirement can be met.
-   */
-  boolean hasResources(S resourceNeeded) throws SCMException;
-
-  /**
-   * Returns the metric.
-   *
-   * @return T, the object that represents this metric.
-   */
-  T get();
-
-  /**
-   * Sets the value of this metric.
-   *
-   * @param value - value of the metric.
-   */
-  void set(T value);
-
-  /**
-   * Adds a value of to the base.
-   * @param value - value
-   */
-  void add(T value);
-
-  /**
-   * subtract a value.
-   * @param value value
-   */
-  void subtract(T value);
-
-
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/LongMetric.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/LongMetric.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/LongMetric.java
deleted file mode 100644
index 050d26b..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/LongMetric.java
+++ /dev/null
@@ -1,162 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement.metrics;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-
-/**
- * An helper class for all metrics based on Longs.
- */
-@JsonAutoDetect(fieldVisibility = Visibility.ANY)
-public class LongMetric implements DatanodeMetric<Long, Long> {
-  private Long value;
-
-  /**
-   * Constructs a long Metric.
-   *
-   * @param value Value for this metric.
-   */
-  public LongMetric(Long value) {
-    this.value = value;
-  }
-
-  /**
-   * Some syntactic sugar over Comparable interface. This makes code easier to
-   * read.
-   *
-   * @param o - Other Object
-   * @return - True if *this* object is greater than argument.
-   */
-  @Override
-  public boolean isGreater(Long o) {
-    return compareTo(o) > 0;
-  }
-
-  /**
-   * Inverse of isGreater.
-   *
-   * @param o - other object.
-   * @return True if *this* object is Lesser than argument.
-   */
-  @Override
-  public boolean isLess(Long o) {
-    return compareTo(o) < 0;
-  }
-
-  /**
-   * Returns true if the object has same values. Because of issues with
-   * equals, and loss of type information this interface supports isEqual.
-   *
-   * @param o object to compare.
-   * @return True, if the values match.
-   */
-  @Override
-  public boolean isEqual(Long o) {
-    return compareTo(o) == 0;
-  }
-
-  /**
-   * A resourceCheck, defined by resourceNeeded.
-   * For example, S could be bytes required
-   * and DatanodeMetric can reply by saying it can be met or not.
-   *
-   * @param resourceNeeded -  ResourceNeeded in its own metric.
-   * @return boolean, True if this resource requirement can be met.
-   */
-  @Override
-  public boolean hasResources(Long resourceNeeded) {
-    return isGreater(resourceNeeded);
-  }
-
-  /**
-   * Returns the metric.
-   *
-   * @return T, the object that represents this metric.
-   */
-  @Override
-  public Long get() {
-    return this.value;
-  }
-
-  /**
-   * Sets the value of this metric.
-   *
-   * @param setValue - value of the metric.
-   */
-  @Override
-  public void set(Long setValue) {
-    this.value = setValue;
-
-  }
-
-  /**
-   * Adds a value of to the base.
-   *
-   * @param addValue - value
-   */
-  @Override
-  public void add(Long addValue) {
-    this.value += addValue;
-  }
-
-  /**
-   * subtract a value.
-   *
-   * @param subValue value
-   */
-  @Override
-  public void subtract(Long subValue) {
-    this.value -= subValue;
-  }
-
-  /**
-   * Compares this object with the specified object for order.  Returns a
-   * negative integer, zero, or a positive integer as this object is less
-   * than, equal to, or greater than the specified object.
-   *
-   * @param o the object to be compared.
-   * @return a negative integer, zero, or a positive integer as this object is
-   * less than, equal to, or greater than the specified object.
-   * @throws NullPointerException if the specified object is null
-   * @throws ClassCastException   if the specified object's type prevents it
-   *                              from being compared to this object.
-   */
-  @Override
-  public int compareTo(Long o) {
-    return Long.compare(this.value, o);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    LongMetric that = (LongMetric) o;
-
-    return value != null ? value.equals(that.value) : that.value == null;
-  }
-
-  @Override
-  public int hashCode() {
-    return value != null ? value.hashCode() : 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/NodeStat.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/NodeStat.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/NodeStat.java
deleted file mode 100644
index d6857d3..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/NodeStat.java
+++ /dev/null
@@ -1,67 +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.hadoop.hdds.scm.container.placement.metrics;
-
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Interface that defines Node Stats.
- */
-interface NodeStat {
-  /**
-   * Get capacity of the node.
-   * @return capacity of the node.
-   */
-  LongMetric getCapacity();
-
-  /**
-   * Get the used space of the node.
-   * @return the used space of the node.
-   */
-  LongMetric getScmUsed();
-
-  /**
-   * Get the remaining space of the node.
-   * @return the remaining space of the node.
-   */
-  LongMetric getRemaining();
-
-  /**
-   * Set the total/used/remaining space.
-   * @param capacity - total space.
-   * @param used - used space.
-   * @param remain - remaining space.
-   */
-  @VisibleForTesting
-  void set(long capacity, long used, long remain);
-
-  /**
-   * Adding of the stat.
-   * @param stat - stat to be added.
-   * @return updated node stat.
-   */
-  NodeStat add(NodeStat stat);
-
-  /**
-   * Subtract of the stat.
-   * @param stat - stat to be subtracted.
-   * @return updated nodestat.
-   */
-  NodeStat subtract(NodeStat stat);
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
deleted file mode 100644
index e4dd9aa..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
+++ /dev/null
@@ -1,154 +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.hadoop.hdds.scm.container.placement.metrics;
-
-import org.apache.hadoop.metrics2.MetricsSystem;
-import org.apache.hadoop.metrics2.annotation.Metric;
-import org.apache.hadoop.metrics2.annotation.Metrics;
-import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
-import org.apache.hadoop.metrics2.lib.MutableCounterLong;
-import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
-
-/**
- * This class is for maintaining StorageContainerManager statistics.
- */
-@Metrics(about="Storage Container Manager Metrics", context="dfs")
-public class SCMMetrics {
-  public static final String SOURCE_NAME =
-      SCMMetrics.class.getSimpleName();
-
-  /**
-   * Container stat metrics, the meaning of following metrics
-   * can be found in {@link ContainerStat}.
-   */
-  @Metric private MutableGaugeLong lastContainerReportSize;
-  @Metric private MutableGaugeLong lastContainerReportUsed;
-  @Metric private MutableGaugeLong lastContainerReportKeyCount;
-  @Metric private MutableGaugeLong lastContainerReportReadBytes;
-  @Metric private MutableGaugeLong lastContainerReportWriteBytes;
-  @Metric private MutableGaugeLong lastContainerReportReadCount;
-  @Metric private MutableGaugeLong lastContainerReportWriteCount;
-
-  @Metric private MutableCounterLong containerReportSize;
-  @Metric private MutableCounterLong containerReportUsed;
-  @Metric private MutableCounterLong containerReportKeyCount;
-  @Metric private MutableCounterLong containerReportReadBytes;
-  @Metric private MutableCounterLong containerReportWriteBytes;
-  @Metric private MutableCounterLong containerReportReadCount;
-  @Metric private MutableCounterLong containerReportWriteCount;
-
-  public SCMMetrics() {
-  }
-
-  public static SCMMetrics create() {
-    MetricsSystem ms = DefaultMetricsSystem.instance();
-    return ms.register(SOURCE_NAME, "Storage Container Manager Metrics",
-        new SCMMetrics());
-  }
-
-  public void setLastContainerReportSize(long size) {
-    this.lastContainerReportSize.set(size);
-  }
-
-  public void setLastContainerReportUsed(long used) {
-    this.lastContainerReportUsed.set(used);
-  }
-
-  public void setLastContainerReportKeyCount(long keyCount) {
-    this.lastContainerReportKeyCount.set(keyCount);
-  }
-
-  public void setLastContainerReportReadBytes(long readBytes) {
-    this.lastContainerReportReadBytes.set(readBytes);
-  }
-
-  public void setLastContainerReportWriteBytes(long writeBytes) {
-    this.lastContainerReportWriteBytes.set(writeBytes);
-  }
-
-  public void setLastContainerReportReadCount(long readCount) {
-    this.lastContainerReportReadCount.set(readCount);
-  }
-
-  public void setLastContainerReportWriteCount(long writeCount) {
-    this.lastContainerReportWriteCount.set(writeCount);
-  }
-
-  public void incrContainerReportSize(long size) {
-    this.containerReportSize.incr(size);
-  }
-
-  public void incrContainerReportUsed(long used) {
-    this.containerReportUsed.incr(used);
-  }
-
-  public void incrContainerReportKeyCount(long keyCount) {
-    this.containerReportKeyCount.incr(keyCount);
-  }
-
-  public void incrContainerReportReadBytes(long readBytes) {
-    this.containerReportReadBytes.incr(readBytes);
-  }
-
-  public void incrContainerReportWriteBytes(long writeBytes) {
-    this.containerReportWriteBytes.incr(writeBytes);
-  }
-
-  public void incrContainerReportReadCount(long readCount) {
-    this.containerReportReadCount.incr(readCount);
-  }
-
-  public void incrContainerReportWriteCount(long writeCount) {
-    this.containerReportWriteCount.incr(writeCount);
-  }
-
-  public void setLastContainerStat(ContainerStat newStat) {
-    this.lastContainerReportSize.set(newStat.getSize().get());
-    this.lastContainerReportUsed.set(newStat.getUsed().get());
-    this.lastContainerReportKeyCount.set(newStat.getKeyCount().get());
-    this.lastContainerReportReadBytes.set(newStat.getReadBytes().get());
-    this.lastContainerReportWriteBytes.set(newStat.getWriteBytes().get());
-    this.lastContainerReportReadCount.set(newStat.getReadCount().get());
-    this.lastContainerReportWriteCount.set(newStat.getWriteCount().get());
-  }
-
-  public void incrContainerStat(ContainerStat deltaStat) {
-    this.containerReportSize.incr(deltaStat.getSize().get());
-    this.containerReportUsed.incr(deltaStat.getUsed().get());
-    this.containerReportKeyCount.incr(deltaStat.getKeyCount().get());
-    this.containerReportReadBytes.incr(deltaStat.getReadBytes().get());
-    this.containerReportWriteBytes.incr(deltaStat.getWriteBytes().get());
-    this.containerReportReadCount.incr(deltaStat.getReadCount().get());
-    this.containerReportWriteCount.incr(deltaStat.getWriteCount().get());
-  }
-
-  public void decrContainerStat(ContainerStat deltaStat) {
-    this.containerReportSize.incr(-1 * deltaStat.getSize().get());
-    this.containerReportUsed.incr(-1 * deltaStat.getUsed().get());
-    this.containerReportKeyCount.incr(-1 * deltaStat.getKeyCount().get());
-    this.containerReportReadBytes.incr(-1 * deltaStat.getReadBytes().get());
-    this.containerReportWriteBytes.incr(-1 * deltaStat.getWriteBytes().get());
-    this.containerReportReadCount.incr(-1 * deltaStat.getReadCount().get());
-    this.containerReportWriteCount.incr(-1 * deltaStat.getWriteCount().get());
-  }
-
-  public void unRegister() {
-    MetricsSystem ms = DefaultMetricsSystem.instance();
-    ms.unregisterSource(SOURCE_NAME);
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeMetric.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeMetric.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeMetric.java
deleted file mode 100644
index efd5fd6..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeMetric.java
+++ /dev/null
@@ -1,224 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement.metrics;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-/**
- * SCM Node Metric that is used in the placement classes.
- */
-public class SCMNodeMetric implements DatanodeMetric<SCMNodeStat, Long> {
-  private SCMNodeStat stat;
-
-  /**
-   * Constructs an SCMNode Metric.
-   *
-   * @param stat - SCMNodeStat.
-   */
-  public SCMNodeMetric(SCMNodeStat stat) {
-    this.stat = stat;
-  }
-
-  /**
-   * Set the capacity, used and remaining space on a datanode.
-   *
-   * @param capacity in bytes
-   * @param used in bytes
-   * @param remaining in bytes
-   */
-  @VisibleForTesting
-  public SCMNodeMetric(long capacity, long used, long remaining) {
-    this.stat = new SCMNodeStat();
-    this.stat.set(capacity, used, remaining);
-  }
-
-  /**
-   *
-   * @param o - Other Object
-   * @return - True if *this* object is greater than argument.
-   */
-  @Override
-  public boolean isGreater(SCMNodeStat o) {
-    Preconditions.checkNotNull(this.stat, "Argument cannot be null");
-    Preconditions.checkNotNull(o, "Argument cannot be null");
-
-    // if zero, replace with 1 for the division to work.
-    long thisDenominator = (this.stat.getCapacity().get() == 0)
-        ? 1 : this.stat.getCapacity().get();
-    long otherDenominator = (o.getCapacity().get() == 0)
-        ? 1 : o.getCapacity().get();
-
-    float thisNodeWeight =
-        stat.getScmUsed().get() / (float) thisDenominator;
-
-    float oNodeWeight =
-        o.getScmUsed().get() / (float) otherDenominator;
-
-    if (Math.abs(thisNodeWeight - oNodeWeight) > 0.000001) {
-      return thisNodeWeight > oNodeWeight;
-    }
-    // if these nodes are have similar weight then return the node with more
-    // free space as the greater node.
-    return stat.getRemaining().isGreater(o.getRemaining().get());
-  }
-
-  /**
-   * Inverse of isGreater.
-   *
-   * @param o - other object.
-   * @return True if *this* object is Lesser than argument.
-   */
-  @Override
-  public boolean isLess(SCMNodeStat o) {
-    Preconditions.checkNotNull(o, "Argument cannot be null");
-
-    // if zero, replace with 1 for the division to work.
-    long thisDenominator = (this.stat.getCapacity().get() == 0)
-        ? 1 : this.stat.getCapacity().get();
-    long otherDenominator = (o.getCapacity().get() == 0)
-        ? 1 : o.getCapacity().get();
-
-    float thisNodeWeight =
-        stat.getScmUsed().get() / (float) thisDenominator;
-
-    float oNodeWeight =
-        o.getScmUsed().get() / (float) otherDenominator;
-
-    if (Math.abs(thisNodeWeight - oNodeWeight) > 0.000001) {
-      return thisNodeWeight < oNodeWeight;
-    }
-
-    // if these nodes are have similar weight then return the node with less
-    // free space as the lesser node.
-    return stat.getRemaining().isLess(o.getRemaining().get());
-  }
-
-  /**
-   * Returns true if the object has same values. Because of issues with
-   * equals, and loss of type information this interface supports isEqual.
-   *
-   * @param o object to compare.
-   * @return True, if the values match.
-   * TODO : Consider if it makes sense to add remaining to this equation.
-   */
-  @Override
-  public boolean isEqual(SCMNodeStat o) {
-    float thisNodeWeight = stat.getScmUsed().get() / (float)
-        stat.getCapacity().get();
-    float oNodeWeight = o.getScmUsed().get() / (float) o.getCapacity().get();
-    return Math.abs(thisNodeWeight - oNodeWeight) < 0.000001;
-  }
-
-  /**
-   * A resourceCheck, defined by resourceNeeded.
-   * For example, S could be bytes required
-   * and DatanodeMetric can reply by saying it can be met or not.
-   *
-   * @param resourceNeeded -  ResourceNeeded in its own metric.
-   * @return boolean, True if this resource requirement can be met.
-   */
-  @Override
-  public boolean hasResources(Long resourceNeeded) {
-    return false;
-  }
-
-  /**
-   * Returns the metric.
-   *
-   * @return T, the object that represents this metric.
-   */
-  @Override
-  public SCMNodeStat get() {
-    return stat;
-  }
-
-  /**
-   * Sets the value of this metric.
-   *
-   * @param value - value of the metric.
-   */
-  @Override
-  public void set(SCMNodeStat value) {
-    stat.set(value.getCapacity().get(), value.getScmUsed().get(),
-        value.getRemaining().get());
-  }
-
-  /**
-   * Adds a value of to the base.
-   *
-   * @param value - value
-   */
-  @Override
-  public void add(SCMNodeStat value) {
-    stat.add(value);
-  }
-
-  /**
-   * subtract a value.
-   *
-   * @param value value
-   */
-  @Override
-  public void subtract(SCMNodeStat value) {
-    stat.subtract(value);
-  }
-
-  /**
-   * Compares this object with the specified object for order.  Returns a
-   * negative integer, zero, or a positive integer as this object is less
-   * than, equal to, or greater than the specified object.
-   *
-   * @param o the object to be compared.
-   * @return a negative integer, zero, or a positive integer as this object is
-   * less than, equal to, or greater than the specified object.
-   * @throws NullPointerException if the specified object is null
-   * @throws ClassCastException   if the specified object's type prevents it
-   *                              from being compared to this object.
-   */
-  @Override
-  public int compareTo(SCMNodeStat o) {
-    if (isEqual(o)) {
-      return 0;
-    }
-    if (isGreater(o)) {
-      return 1;
-    } else {
-      return -1;
-    }
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    SCMNodeMetric that = (SCMNodeMetric) o;
-
-    return stat != null ? stat.equals(that.stat) : that.stat == null;
-  }
-
-  @Override
-  public int hashCode() {
-    return stat != null ? stat.hashCode() : 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeStat.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeStat.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeStat.java
deleted file mode 100644
index 3c871d3..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMNodeStat.java
+++ /dev/null
@@ -1,139 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement.metrics;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-/**
- * This class represents the SCM node stat.
- */
-public class SCMNodeStat implements NodeStat {
-  private LongMetric capacity;
-  private LongMetric scmUsed;
-  private LongMetric remaining;
-
-  public SCMNodeStat() {
-    this(0L, 0L, 0L);
-  }
-
-  public SCMNodeStat(SCMNodeStat other) {
-    this(other.capacity.get(), other.scmUsed.get(), other.remaining.get());
-  }
-
-  public SCMNodeStat(long capacity, long used, long remaining) {
-    Preconditions.checkArgument(capacity >= 0, "Capacity cannot be " +
-        "negative.");
-    Preconditions.checkArgument(used >= 0, "used space cannot be " +
-        "negative.");
-    Preconditions.checkArgument(remaining >= 0, "remaining cannot be " +
-        "negative");
-    this.capacity = new LongMetric(capacity);
-    this.scmUsed = new LongMetric(used);
-    this.remaining = new LongMetric(remaining);
-  }
-
-  /**
-   * @return the total configured capacity of the node.
-   */
-  public LongMetric getCapacity() {
-    return capacity;
-  }
-
-  /**
-   * @return the total SCM used space on the node.
-   */
-  public LongMetric getScmUsed() {
-    return scmUsed;
-  }
-
-  /**
-   * @return the total remaining space available on the node.
-   */
-  public LongMetric getRemaining() {
-    return remaining;
-  }
-
-  /**
-   * Set the capacity, used and remaining space on a datanode.
-   *
-   * @param newCapacity in bytes
-   * @param newUsed in bytes
-   * @param newRemaining in bytes
-   */
-  @VisibleForTesting
-  public void set(long newCapacity, long newUsed, long newRemaining) {
-    Preconditions.checkNotNull(newCapacity, "Capacity cannot be null");
-    Preconditions.checkNotNull(newUsed, "used cannot be null");
-    Preconditions.checkNotNull(newRemaining, "remaining cannot be null");
-
-    Preconditions.checkArgument(newCapacity >= 0, "Capacity cannot be " +
-        "negative.");
-    Preconditions.checkArgument(newUsed >= 0, "used space cannot be " +
-        "negative.");
-    Preconditions.checkArgument(newRemaining >= 0, "remaining cannot be " +
-        "negative");
-
-    this.capacity = new LongMetric(newCapacity);
-    this.scmUsed = new LongMetric(newUsed);
-    this.remaining = new LongMetric(newRemaining);
-  }
-
-  /**
-   * Adds a new nodestat to existing values of the node.
-   *
-   * @param stat Nodestat.
-   * @return SCMNodeStat
-   */
-  public SCMNodeStat add(NodeStat stat) {
-    this.capacity.set(this.getCapacity().get() + stat.getCapacity().get());
-    this.scmUsed.set(this.getScmUsed().get() + stat.getScmUsed().get());
-    this.remaining.set(this.getRemaining().get() + stat.getRemaining().get());
-    return this;
-  }
-
-  /**
-   * Subtracts the stat values from the existing NodeStat.
-   *
-   * @param stat SCMNodeStat.
-   * @return Modified SCMNodeStat
-   */
-  public SCMNodeStat subtract(NodeStat stat) {
-    this.capacity.set(this.getCapacity().get() - stat.getCapacity().get());
-    this.scmUsed.set(this.getScmUsed().get() - stat.getScmUsed().get());
-    this.remaining.set(this.getRemaining().get() - stat.getRemaining().get());
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object to) {
-    if (to instanceof SCMNodeStat) {
-      SCMNodeStat tempStat = (SCMNodeStat) to;
-      return capacity.isEqual(tempStat.getCapacity().get()) &&
-          scmUsed.isEqual(tempStat.getScmUsed().get()) &&
-          remaining.isEqual(tempStat.getRemaining().get());
-    }
-    return false;
-  }
-
-  @Override
-  public int hashCode() {
-    return Long.hashCode(capacity.get() ^ scmUsed.get() ^ remaining.get());
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/package-info.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/package-info.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/package-info.java
deleted file mode 100644
index 4a81d69..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/package-info.java
+++ /dev/null
@@ -1,20 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement.metrics;
-
-// Various metrics supported by Datanode and used by SCM in the placement
-// strategy.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/package-info.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/package-info.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/package-info.java
deleted file mode 100644
index dc54d9b..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/package-info.java
+++ /dev/null
@@ -1,19 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.placement;
-// Classes related to container placement.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatus.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatus.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatus.java
deleted file mode 100644
index 993a986..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatus.java
+++ /dev/null
@@ -1,117 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.replication;
-
-import javax.management.ObjectName;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.hadoop.hdds.server.events.EventHandler;
-import org.apache.hadoop.hdds.server.events.EventPublisher;
-import org.apache.hadoop.metrics2.util.MBeans;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Event listener to track the current state of replication.
- */
-public class ReplicationActivityStatus implements
-    ReplicationActivityStatusMXBean, Closeable {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(ReplicationActivityStatus.class);
-
-  private AtomicBoolean replicationEnabled = new AtomicBoolean();
-  private AtomicBoolean replicationStatusSetExternally = new AtomicBoolean();
-  private ObjectName jmxObjectName;
-  private ReplicationStatusListener replicationStatusListener;
-  private ChillModeStatusListener chillModeStatusListener;
-
-  public ReplicationActivityStatus(){
-    replicationStatusListener = new ReplicationStatusListener();
-    chillModeStatusListener = new ChillModeStatusListener();
-  }
-
-  public boolean isReplicationEnabled() {
-    return replicationEnabled.get();
-  }
-
-  @VisibleForTesting
-  public void setReplicationEnabled(boolean enabled) {
-    replicationEnabled.set(enabled);
-  }
-
-  @VisibleForTesting
-  public void enableReplication() {
-    replicationEnabled.set(true);
-  }
-
-
-  public void start() {
-    try {
-      this.jmxObjectName =
-          MBeans.register(
-              "StorageContainerManager", "ReplicationActivityStatus", this);
-    } catch (Exception ex) {
-      LOG.error("JMX bean for ReplicationActivityStatus can't be registered",
-          ex);
-    }
-  }
-
-  @Override
-  public void close() throws IOException {
-    if (this.jmxObjectName != null) {
-      MBeans.unregister(jmxObjectName);
-    }
-  }
-
-  /**
-   * Replication status listener.
-   */
-  class ReplicationStatusListener implements EventHandler<Boolean> {
-    @Override
-    public void onMessage(Boolean status, EventPublisher publisher) {
-      replicationStatusSetExternally.set(true);
-      replicationEnabled.set(status);
-    }
-  }
-
-  /**
-   * Replication status is influenced by Chill mode status as well.
-   */
-  class ChillModeStatusListener implements EventHandler<Boolean> {
-
-    @Override
-    public void onMessage(Boolean inChillMode, EventPublisher publisher) {
-      if (!replicationStatusSetExternally.get()) {
-        replicationEnabled.set(!inChillMode);
-      }
-    }
-  }
-
-  public ReplicationStatusListener getReplicationStatusListener() {
-    return replicationStatusListener;
-  }
-
-  public ChillModeStatusListener getChillModeStatusListener() {
-    return chillModeStatusListener;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatusMXBean.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatusMXBean.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatusMXBean.java
deleted file mode 100644
index 164bd24..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationActivityStatusMXBean.java
+++ /dev/null
@@ -1,28 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.hdds.scm.container.replication;
-
-/**
- * JMX interface to monitor replication status.
- */
-public interface ReplicationActivityStatusMXBean {
-
-  boolean isReplicationEnabled();
-
-  void setReplicationEnabled(boolean enabled);
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationCommandWatcher.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationCommandWatcher.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationCommandWatcher.java
deleted file mode 100644
index 03a81a7..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationCommandWatcher.java
+++ /dev/null
@@ -1,56 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.hadoop.hdds.scm.container.replication;
-
-import org.apache.hadoop.hdds.scm.container.replication.ReplicationManager
-    .ReplicationCompleted;
-import org.apache.hadoop.hdds.scm.container.replication.ReplicationManager
-    .ReplicationRequestToRepeat;
-import org.apache.hadoop.hdds.scm.events.SCMEvents;
-import org.apache.hadoop.hdds.server.events.Event;
-import org.apache.hadoop.hdds.server.events.EventPublisher;
-import org.apache.hadoop.hdds.server.events.EventWatcher;
-import org.apache.hadoop.ozone.lease.LeaseManager;
-
-/**
- * Command watcher to track the replication commands.
- */
-public class ReplicationCommandWatcher
-    extends
-    EventWatcher<ReplicationManager.ReplicationRequestToRepeat,
-        ReplicationManager.ReplicationCompleted> {
-
-  public ReplicationCommandWatcher(Event<ReplicationRequestToRepeat> 
startEvent,
-      Event<ReplicationCompleted> completionEvent,
-      LeaseManager<Long> leaseManager) {
-    super(startEvent, completionEvent, leaseManager);
-  }
-
-  @Override
-  protected void onTimeout(EventPublisher publisher,
-      ReplicationRequestToRepeat payload) {
-    //put back to the original queue
-    publisher.fireEvent(SCMEvents.REPLICATE_CONTAINER,
-        payload.getRequest());
-  }
-
-  @Override
-  protected void onFinished(EventPublisher publisher,
-      ReplicationRequestToRepeat payload) {
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java
deleted file mode 100644
index ddecdbc..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java
+++ /dev/null
@@ -1,250 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.hadoop.hdds.scm.container.replication;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState;
-import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.container.ContainerStateManager;
-import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
-import org.apache.hadoop.hdds.scm.container.placement.algorithms
-    .ContainerPlacementPolicy;
-import org.apache.hadoop.hdds.scm.events.SCMEvents;
-import org.apache.hadoop.hdds.server.events.EventPublisher;
-import org.apache.hadoop.hdds.server.events.EventQueue;
-import org.apache.hadoop.hdds.server.events.IdentifiableEventPayload;
-import org.apache.hadoop.ozone.lease.LeaseManager;
-import org.apache.hadoop.ozone.protocol.commands.CommandForDatanode;
-import org.apache.hadoop.ozone.protocol.commands.ReplicateContainerCommand;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import static org.apache.hadoop.hdds.scm.events.SCMEvents
-    .TRACK_REPLICATE_COMMAND;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Replication Manager manages the replication of the closed container.
- */
-public class ReplicationManager implements Runnable {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(ReplicationManager.class);
-
-  private ReplicationQueue replicationQueue;
-
-  private ContainerPlacementPolicy containerPlacement;
-
-  private EventPublisher eventPublisher;
-
-  private ReplicationCommandWatcher replicationCommandWatcher;
-
-  private boolean running = true;
-
-  private ContainerStateManager containerStateManager;
-
-  public ReplicationManager(ContainerPlacementPolicy containerPlacement,
-      ContainerStateManager containerStateManager, EventQueue eventQueue,
-      LeaseManager<Long> commandWatcherLeaseManager) {
-
-    this.containerPlacement = containerPlacement;
-    this.containerStateManager = containerStateManager;
-    this.eventPublisher = eventQueue;
-
-    this.replicationCommandWatcher =
-        new ReplicationCommandWatcher(TRACK_REPLICATE_COMMAND,
-            SCMEvents.REPLICATION_COMPLETE, commandWatcherLeaseManager);
-
-    this.replicationQueue = new ReplicationQueue();
-
-    eventQueue.addHandler(SCMEvents.REPLICATE_CONTAINER,
-        (replicationRequest, publisher) -> replicationQueue
-            .add(replicationRequest));
-
-    this.replicationCommandWatcher.start(eventQueue);
-
-  }
-
-  public void start() {
-
-    ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true)
-        .setNameFormat("Replication Manager").build();
-
-    threadFactory.newThread(this).start();
-  }
-
-  public void run() {
-
-    while (running) {
-      ReplicationRequest request = null;
-      try {
-        //TODO: add throttling here
-        request = replicationQueue.take();
-
-        ContainerID containerID = new ContainerID(request.getContainerId());
-        ContainerInfo containerInfo =
-            containerStateManager.getContainer(containerID);
-
-        Preconditions.checkNotNull(containerInfo,
-            "No information about the container " + request.getContainerId());
-
-        Preconditions
-            .checkState(containerInfo.getState() == LifeCycleState.CLOSED,
-                "Container should be in closed state");
-
-        //check the current replication
-        List<DatanodeDetails> datanodesWithReplicas =
-            new ArrayList<>(getCurrentReplicas(request));
-
-        if (datanodesWithReplicas.size() == 0) {
-          LOG.warn(
-              "Container {} should be replicated but can't find any existing "
-                  + "replicas",
-              containerID);
-          return;
-        }
-
-        ReplicationRequest finalRequest = request;
-
-        int inFlightReplications = replicationCommandWatcher.getTimeoutEvents(
-            e -> e.request.getContainerId() == finalRequest.getContainerId())
-            .size();
-
-        int deficit =
-            request.getExpecReplicationCount() - datanodesWithReplicas.size()
-                - inFlightReplications;
-
-        if (deficit > 0) {
-
-          List<DatanodeDetails> selectedDatanodes = containerPlacement
-              .chooseDatanodes(datanodesWithReplicas, deficit,
-                  containerInfo.getUsedBytes());
-
-          //send the command
-          for (DatanodeDetails datanode : selectedDatanodes) {
-
-            ReplicateContainerCommand replicateCommand =
-                new ReplicateContainerCommand(containerID.getId(),
-                    datanodesWithReplicas);
-
-            eventPublisher.fireEvent(SCMEvents.DATANODE_COMMAND,
-                new CommandForDatanode<>(
-                    datanode.getUuid(), replicateCommand));
-
-            ReplicationRequestToRepeat timeoutEvent =
-                new ReplicationRequestToRepeat(replicateCommand.getId(),
-                    request);
-
-            eventPublisher.fireEvent(TRACK_REPLICATE_COMMAND, timeoutEvent);
-
-          }
-
-        } else if (deficit < 0) {
-          //TODO: too many replicas. Not handled yet.
-        }
-
-      } catch (Exception e) {
-        LOG.error("Can't replicate container {}", request, e);
-      }
-    }
-
-  }
-
-  @VisibleForTesting
-  protected Set<DatanodeDetails> getCurrentReplicas(ReplicationRequest request)
-      throws IOException {
-    return containerStateManager
-        .getContainerReplicas(new ContainerID(request.getContainerId()));
-  }
-
-  @VisibleForTesting
-  public ReplicationQueue getReplicationQueue() {
-    return replicationQueue;
-  }
-
-  public void stop() {
-    running = false;
-  }
-
-  /**
-   * Event for the ReplicationCommandWatcher to repeate the embedded request.
-   * in case fof timeout.
-   */
-  public static class ReplicationRequestToRepeat
-      implements IdentifiableEventPayload {
-
-    private final long commandId;
-
-    private final ReplicationRequest request;
-
-    public ReplicationRequestToRepeat(long commandId,
-        ReplicationRequest request) {
-      this.commandId = commandId;
-      this.request = request;
-    }
-
-    public ReplicationRequest getRequest() {
-      return request;
-    }
-
-    @Override
-    public long getId() {
-      return commandId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (this == o) {
-        return true;
-      }
-      if (o == null || getClass() != o.getClass()) {
-        return false;
-      }
-      ReplicationRequestToRepeat that = (ReplicationRequestToRepeat) o;
-      return Objects.equals(request, that.request);
-    }
-
-    @Override
-    public int hashCode() {
-
-      return Objects.hash(request);
-    }
-  }
-
-  public static class ReplicationCompleted implements IdentifiableEventPayload 
{
-
-    private final long uuid;
-
-    public ReplicationCompleted(long uuid) {
-      this.uuid = uuid;
-    }
-
-    @Override
-    public long getId() {
-      return uuid;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationQueue.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationQueue.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationQueue.java
deleted file mode 100644
index 4ca67be..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationQueue.java
+++ /dev/null
@@ -1,73 +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.hadoop.hdds.scm.container.replication;
-
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.PriorityBlockingQueue;
-
-/**
- * Priority queue to handle under-replicated and over replicated containers
- * in ozone. ReplicationManager will consume these messages and decide
- * accordingly.
- */
-public class ReplicationQueue {
-
-  private final BlockingQueue<ReplicationRequest> queue;
-
-  public ReplicationQueue() {
-    queue = new PriorityBlockingQueue<>();
-  }
-
-  public boolean add(ReplicationRequest repObj) {
-    if (this.queue.contains(repObj)) {
-      // Remove the earlier message and insert this one
-      this.queue.remove(repObj);
-    }
-    return this.queue.add(repObj);
-  }
-
-  public boolean remove(ReplicationRequest repObj) {
-    return queue.remove(repObj);
-  }
-
-  /**
-   * Retrieves, but does not remove, the head of this queue,
-   * or returns {@code null} if this queue is empty.
-   *
-   * @return the head of this queue, or {@code null} if this queue is empty
-   */
-  public ReplicationRequest peek() {
-    return queue.peek();
-  }
-
-  /**
-   * Retrieves and removes the head of this queue (blocking queue).
-   */
-  public ReplicationRequest take() throws InterruptedException {
-    return queue.take();
-  }
-
-  public boolean removeAll(List<ReplicationRequest> repObjs) {
-    return queue.removeAll(repObjs);
-  }
-
-  public int size() {
-    return queue.size();
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationRequest.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationRequest.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationRequest.java
deleted file mode 100644
index d40cd9c..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationRequest.java
+++ /dev/null
@@ -1,123 +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.hadoop.hdds.scm.container.replication;
-
-import java.io.Serializable;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-/**
- * Wrapper class for hdds replication queue. Implements its natural
- * ordering for priority queue.
- */
-public class ReplicationRequest implements Comparable<ReplicationRequest>,
-    Serializable {
-  private final long containerId;
-  private final int replicationCount;
-  private final int expecReplicationCount;
-  private final long timestamp;
-
-  public ReplicationRequest(long containerId, int replicationCount,
-      long timestamp, int expecReplicationCount) {
-    this.containerId = containerId;
-    this.replicationCount = replicationCount;
-    this.timestamp = timestamp;
-    this.expecReplicationCount = expecReplicationCount;
-  }
-
-  public ReplicationRequest(long containerId, int replicationCount,
-      int expecReplicationCount) {
-    this(containerId, replicationCount, System.currentTimeMillis(),
-        expecReplicationCount);
-  }
-
-  /**
-   * Compares this object with the specified object for order.  Returns a
-   * negative integer, zero, or a positive integer as this object is less
-   * than, equal to, or greater than the specified object.
-   * @param o the object to be compared.
-   * @return a negative integer, zero, or a positive integer as this object
-   * is less than, equal to, or greater than the specified object.
-   * @throws NullPointerException if the specified object is null
-   * @throws ClassCastException   if the specified object's type prevents it
-   *                              from being compared to this object.
-   */
-  @Override
-  public int compareTo(ReplicationRequest o) {
-    if (o == null) {
-      return 1;
-    }
-    if (this == o) {
-      return 0;
-    }
-    int retVal = Integer
-        .compare(getReplicationCount() - getExpecReplicationCount(),
-            o.getReplicationCount() - o.getExpecReplicationCount());
-    if (retVal != 0) {
-      return retVal;
-    }
-    return Long.compare(getTimestamp(), o.getTimestamp());
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(91, 1011)
-        .append(getContainerId())
-        .toHashCode();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    ReplicationRequest that = (ReplicationRequest) o;
-    return new EqualsBuilder().append(getContainerId(), that.getContainerId())
-        .isEquals();
-  }
-
-  public long getContainerId() {
-    return containerId;
-  }
-
-  public int getReplicationCount() {
-    return replicationCount;
-  }
-
-  public long getTimestamp() {
-    return timestamp;
-  }
-
-  public int getExpecReplicationCount() {
-    return expecReplicationCount;
-  }
-
-  @Override
-  public String toString() {
-    return "ReplicationRequest{" +
-        "containerId=" + containerId +
-        ", replicationCount=" + replicationCount +
-        ", expecReplicationCount=" + expecReplicationCount +
-        ", timestamp=" + timestamp +
-        '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/package-info.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/package-info.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/package-info.java
deleted file mode 100644
index 934b01e..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/package-info.java
+++ /dev/null
@@ -1,23 +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.hadoop.hdds.scm.container.replication;
-
-/**
- * HDDS (Closed) Container replicaton related classes.
- */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
deleted file mode 100644
index 288fa2d..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
+++ /dev/null
@@ -1,245 +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.hadoop.hdds.scm.container.states;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.exceptions.SCMException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.NavigableSet;
-import java.util.TreeSet;
-
-import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes
-    .FAILED_TO_CHANGE_CONTAINER_STATE;
-
-/**
- * Each Attribute that we manage for a container is maintained as a map.
- * <p>
- * Currently we manage the following attributes for a container.
- * <p>
- * 1. StateMap - LifeCycleState -> Set of ContainerIDs
- * 2. TypeMap  - ReplicationType -> Set of ContainerIDs
- * 3. OwnerMap - OwnerNames -> Set of ContainerIDs
- * 4. FactorMap - ReplicationFactor -> Set of ContainerIDs
- * <p>
- * This means that for a cluster size of 750 PB -- we will have around 150
- * Million containers, if we assume 5GB average container size.
- * <p>
- * That implies that these maps will take around 2/3 GB of RAM which will be
- * pinned down in the SCM. This is deemed acceptable since we can tune the
- * container size --say we make it 10GB average size, then we can deal with a
- * cluster size of 1.5 exa bytes with the same metadata in SCMs memory.
- * <p>
- * Please note: **This class is not thread safe**. This used to be thread safe,
- * while bench marking we found that ContainerStateMap would be taking 5
- * locks for a single container insert. If we remove locks in this class,
- * then we are able to perform about 540K operations per second, with the
- * locks in this class it goes down to 246K operations per second. Hence we
- * are going to rely on ContainerStateMap locks to maintain consistency of
- * data in these classes too, since ContainerAttribute is only used by
- * ContainerStateMap class.
- */
-public class ContainerAttribute<T> {
-  private static final Logger LOG =
-      LoggerFactory.getLogger(ContainerAttribute.class);
-
-  private final Map<T, NavigableSet<ContainerID>> attributeMap;
-  private static final NavigableSet<ContainerID> EMPTY_SET =  Collections
-      .unmodifiableNavigableSet(new TreeSet<>());
-
-  /**
-   * Creates a Container Attribute map from an existing Map.
-   *
-   * @param attributeMap - AttributeMap
-   */
-  public ContainerAttribute(Map<T, NavigableSet<ContainerID>> attributeMap) {
-    this.attributeMap = attributeMap;
-  }
-
-  /**
-   * Create an empty Container Attribute map.
-   */
-  public ContainerAttribute() {
-    this.attributeMap = new HashMap<>();
-  }
-
-  /**
-   * Insert or update the value in the Attribute map.
-   *
-   * @param key - The key to the set where the ContainerID should exist.
-   * @param value - Actual Container ID.
-   * @throws SCMException - on Error
-   */
-  public boolean insert(T key, ContainerID value) throws SCMException {
-    Preconditions.checkNotNull(key);
-    Preconditions.checkNotNull(value);
-
-    if (attributeMap.containsKey(key)) {
-      if (attributeMap.get(key).add(value)) {
-        return true; //we inserted the value as it doesn’t exist in the set.
-      } else { // Failure indicates that this ContainerID exists in the Set
-        if (!attributeMap.get(key).remove(value)) {
-          LOG.error("Failure to remove the object from the Map.Key:{}, " +
-              "ContainerID: {}", key, value);
-          throw new SCMException("Failure to remove the object from the Map",
-              FAILED_TO_CHANGE_CONTAINER_STATE);
-        }
-        attributeMap.get(key).add(value);
-        return true;
-      }
-    } else {
-      // This key does not exist, we need to allocate this key in the map.
-      // TODO: Replace TreeSet with FoldedTreeSet from HDFS Utils.
-      // Skipping for now, since FoldedTreeSet does not have implementations
-      // for headSet and TailSet. We need those calls.
-      this.attributeMap.put(key, new TreeSet<>());
-      // This should not fail, we just allocated this object.
-      attributeMap.get(key).add(value);
-      return true;
-    }
-  }
-
-  /**
-   * Returns true if have this bucket in the attribute map.
-   *
-   * @param key - Key to lookup
-   * @return true if we have the key
-   */
-  public boolean hasKey(T key) {
-    Preconditions.checkNotNull(key);
-    return this.attributeMap.containsKey(key);
-  }
-
-  /**
-   * Returns true if we have the key and the containerID in the bucket.
-   *
-   * @param key - Key to the bucket
-   * @param id - container ID that we want to lookup
-   * @return true or false
-   */
-  public boolean hasContainerID(T key, ContainerID id) {
-    Preconditions.checkNotNull(key);
-    Preconditions.checkNotNull(id);
-
-    return this.attributeMap.containsKey(key) &&
-        this.attributeMap.get(key).contains(id);
-  }
-
-  /**
-   * Returns true if we have the key and the containerID in the bucket.
-   *
-   * @param key - Key to the bucket
-   * @param id - container ID that we want to lookup
-   * @return true or false
-   */
-  public boolean hasContainerID(T key, int id) {
-    return hasContainerID(key, ContainerID.valueof(id));
-  }
-
-  /**
-   * Clears all entries for this key type.
-   *
-   * @param key - Key that identifies the Set.
-   */
-  public void clearSet(T key) {
-    Preconditions.checkNotNull(key);
-
-    if (attributeMap.containsKey(key)) {
-      attributeMap.get(key).clear();
-    } else {
-      LOG.debug("key: {} does not exist in the attributeMap", key);
-    }
-  }
-
-  /**
-   * Removes a container ID from the set pointed by the key.
-   *
-   * @param key - key to identify the set.
-   * @param value - Container ID
-   */
-  public boolean remove(T key, ContainerID value) {
-    Preconditions.checkNotNull(key);
-    Preconditions.checkNotNull(value);
-
-    if (attributeMap.containsKey(key)) {
-      if (!attributeMap.get(key).remove(value)) {
-        LOG.debug("ContainerID: {} does not exist in the set pointed by " +
-            "key:{}", value, key);
-        return false;
-      }
-      return true;
-    } else {
-      LOG.debug("key: {} does not exist in the attributeMap", key);
-      return false;
-    }
-  }
-
-  /**
-   * Returns the collection that maps to the given key.
-   *
-   * @param key - Key to the bucket.
-   * @return Underlying Set in immutable form.
-   */
-  public NavigableSet<ContainerID> getCollection(T key) {
-    Preconditions.checkNotNull(key);
-
-    if (this.attributeMap.containsKey(key)) {
-      return Collections.unmodifiableNavigableSet(this.attributeMap.get(key));
-    }
-    LOG.debug("No such Key. Key {}", key);
-    return EMPTY_SET;
-  }
-
-  /**
-   * Moves a ContainerID from one bucket to another.
-   *
-   * @param currentKey - Current Key
-   * @param newKey - newKey
-   * @param value - ContainerID
-   * @throws SCMException on Error
-   */
-  public void update(T currentKey, T newKey, ContainerID value)
-      throws SCMException {
-    Preconditions.checkNotNull(currentKey);
-    Preconditions.checkNotNull(newKey);
-
-    boolean removed = false;
-    try {
-      removed = remove(currentKey, value);
-      if (!removed) {
-        throw new SCMException("Unable to find key in the current key bucket",
-            FAILED_TO_CHANGE_CONTAINER_STATE);
-      }
-      insert(newKey, value);
-    } catch (SCMException ex) {
-      // if we removed the key, insert it back to original bucket, since the
-      // next insert failed.
-      LOG.error("error in update.", ex);
-      if (removed) {
-        insert(currentKey, value);
-        LOG.trace("reinserted the removed key. {}", currentKey);
-      }
-      throw ex;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerQueryKey.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerQueryKey.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerQueryKey.java
deleted file mode 100644
index cd49115..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerQueryKey.java
+++ /dev/null
@@ -1,110 +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.hadoop.hdds.scm.container.states;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-
-/**
- * Key for the Caching layer for Container Query.
- */
-public class ContainerQueryKey {
-  private final HddsProtos.LifeCycleState state;
-  private final String owner;
-  private final HddsProtos.ReplicationFactor factor;
-  private final HddsProtos.ReplicationType type;
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    ContainerQueryKey that = (ContainerQueryKey) o;
-
-    return new EqualsBuilder()
-        .append(getState(), that.getState())
-        .append(getOwner(), that.getOwner())
-        .append(getFactor(), that.getFactor())
-        .append(getType(), that.getType())
-        .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(61, 71)
-        .append(getState())
-        .append(getOwner())
-        .append(getFactor())
-        .append(getType())
-        .toHashCode();
-  }
-
-  /**
-   * Constructor for ContainerQueryKey.
-   * @param state LifeCycleState
-   * @param owner - Name of the Owner.
-   * @param factor Replication Factor.
-   * @param type - Replication Type.
-   */
-  public ContainerQueryKey(HddsProtos.LifeCycleState state, String owner,
-      HddsProtos.ReplicationFactor factor, HddsProtos.ReplicationType type) {
-    this.state = state;
-    this.owner = owner;
-    this.factor = factor;
-    this.type = type;
-  }
-
-  /**
-   * Returns the state of containers which this key represents.
-   * @return LifeCycleState
-   */
-  public HddsProtos.LifeCycleState getState() {
-    return state;
-  }
-
-  /**
-   * Returns the owner of containers which this key represents.
-   * @return Owner
-   */
-  public String getOwner() {
-    return owner;
-  }
-
-  /**
-   * Returns the replication factor of containers which this key represents.
-   * @return ReplicationFactor
-   */
-  public HddsProtos.ReplicationFactor getFactor() {
-    return factor;
-  }
-
-  /**
-   * Returns the replication type of containers which this key represents.
-   * @return ReplicationType
-   */
-  public HddsProtos.ReplicationType getType() {
-    return type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2c392da8/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerState.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerState.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerState.java
deleted file mode 100644
index 1dac36e..0000000
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerState.java
+++ /dev/null
@@ -1,96 +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.hadoop.hdds.scm.container.states;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-
-/**
- * Class that acts as the container state.
- */
-public class ContainerState {
-  private final HddsProtos.ReplicationType type;
-  private final String owner;
-  private final HddsProtos.ReplicationFactor replicationFactor;
-
-  /**
-   * Constructs a Container Key.
-   *
-   * @param owner - Container Owners
-   * @param type - Replication Type.
-   * @param factor - Replication Factors
-   */
-  public ContainerState(String owner, HddsProtos.ReplicationType type,
-      HddsProtos.ReplicationFactor factor) {
-    this.type = type;
-    this.owner = owner;
-    this.replicationFactor = factor;
-  }
-
-
-  public HddsProtos.ReplicationType getType() {
-    return type;
-  }
-
-  public String getOwner() {
-    return owner;
-  }
-
-  public HddsProtos.ReplicationFactor getFactor() {
-    return replicationFactor;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    ContainerState that = (ContainerState) o;
-
-    return new EqualsBuilder()
-        .append(type, that.type)
-        .append(owner, that.owner)
-        .append(replicationFactor, that.replicationFactor)
-        .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(137, 757)
-        .append(type)
-        .append(owner)
-        .append(replicationFactor)
-        .toHashCode();
-  }
-
-  @Override
-  public String toString() {
-    return "ContainerKey{" +
-        ", type=" + type +
-        ", owner=" + owner +
-        ", replicationFactor=" + replicationFactor +
-        '}';
-  }
-}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to