From d58e3efe9269efe00c309ed0e9726d2f94bcd03a Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Tue, 28 Jun 2011 23:57:02 +0000 Subject: [PATCH] Fix CHANGES.txt (HDFS-2106 should be HDFS-2107) and add NumberReplicas.java. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1140913 13f79535-47bb-0310-9956-ffa450edef68 --- hdfs/CHANGES.txt | 2 +- .../blockmanagement/NumberReplicas.java | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/NumberReplicas.java diff --git a/hdfs/CHANGES.txt b/hdfs/CHANGES.txt index bb763934f04..c98f7220512 100644 --- a/hdfs/CHANGES.txt +++ b/hdfs/CHANGES.txt @@ -534,7 +534,7 @@ Trunk (unreleased changes) HDFS-2110. StreamFile and ByteRangeInputStream cleanup. (eli) - HDFS-2106. Move block management code from o.a.h.h.s.namenode to a new + HDFS-2107. Move block management code from o.a.h.h.s.namenode to a new package o.a.h.h.s.blockmanagement. (szetszwo) OPTIMIZATIONS diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/NumberReplicas.java b/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/NumberReplicas.java new file mode 100644 index 00000000000..52f62587b1c --- /dev/null +++ b/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/NumberReplicas.java @@ -0,0 +1,57 @@ +/** + * 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.hdfs.server.blockmanagement; + +/** + * A immutable object that stores the number of live replicas and + * the number of decommissined Replicas. + */ +public class NumberReplicas { + private int liveReplicas; + private int decommissionedReplicas; + private int corruptReplicas; + private int excessReplicas; + + NumberReplicas() { + initialize(0, 0, 0, 0); + } + + NumberReplicas(int live, int decommissioned, int corrupt, int excess) { + initialize(live, decommissioned, corrupt, excess); + } + + void initialize(int live, int decommissioned, int corrupt, int excess) { + liveReplicas = live; + decommissionedReplicas = decommissioned; + corruptReplicas = corrupt; + excessReplicas = excess; + } + + public int liveReplicas() { + return liveReplicas; + } + public int decommissionedReplicas() { + return decommissionedReplicas; + } + public int corruptReplicas() { + return corruptReplicas; + } + public int excessReplicas() { + return excessReplicas; + } +}