hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r725540 - in /hadoop/core/branches/branch-0.18: ./ src/core/org/apache/hadoop/util/ src/hdfs/org/apache/hadoop/dfs/ src/test/org/apache/hadoop/dfs/ src/test/org/apache/hadoop/util/
Date Thu, 11 Dec 2008 02:05:35 GMT
Author: szetszwo
Date: Wed Dec 10 18:05:35 2008
New Revision: 725540

URL: http://svn.apache.org/viewvc?rev=725540&view=rev
Log:
HADOOP-4823. Use SortedMap instead of NavigableMap in 0.18 due to the Java 5 requirement.
(szetszwo)

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/util/CyclicIteration.java
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/AppendTestUtil.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/util/TestCyclicIteration.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=725540&r1=725539&r2=725540&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Wed Dec 10 18:05:35 2008
@@ -94,6 +94,9 @@
     HADOOP-4795. Prevent lease monitor getting into an infinite loop when
     leases and the namespace tree does not match. (szetszwo)
 
+    HADOOP-4823. Use SortedMap instead of NavigableMap in 0.18 due to the
+    Java 5 requirement.  (szetszwo)
+
 Release 0.18.2 - 2008-11-03
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/util/CyclicIteration.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/util/CyclicIteration.java?rev=725540&r1=725539&r2=725540&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/util/CyclicIteration.java
(original)
+++ hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/util/CyclicIteration.java
Wed Dec 10 18:05:35 2008
@@ -19,8 +19,8 @@
 
 import java.util.Iterator;
 import java.util.Map;
-import java.util.NavigableMap;
 import java.util.NoSuchElementException;
+import java.util.SortedMap;
 
 /** Provide an cyclic {@link Iterator} for a {@link NavigableMap}.
  * The {@link Iterator} navigates the entries of the map
@@ -29,22 +29,24 @@
  * it will then continue from the first entry.
  */
 public class CyclicIteration<K, V> implements Iterable<Map.Entry<K, V>>
{
-  private final NavigableMap<K, V> navigablemap;
-  private final NavigableMap<K, V> tailmap;
+  private final SortedMap<K, V> navigablemap;
+  private final SortedMap<K, V> tailmap;
+  private final K startingkey;
 
   /** Construct an {@link Iterable} object,
    * so that an {@link Iterator} can be created  
    * for iterating the given {@link NavigableMap}.
    * The iteration begins from the starting key exclusively.
    */
-  public CyclicIteration(NavigableMap<K, V> navigablemap, K startingkey) {
+  public CyclicIteration(SortedMap<K, V> navigablemap, K startingkey) {
+    this.startingkey = startingkey;
     if (navigablemap == null || navigablemap.isEmpty()) {
       this.navigablemap = null;
       this.tailmap = null;
     }
     else {
       this.navigablemap = navigablemap;
-      this.tailmap = navigablemap.tailMap(startingkey, false); 
+      this.tailmap = navigablemap.tailMap(startingkey);
     }
   }
 
@@ -66,7 +68,13 @@
       hasnext = navigablemap != null;
       if (hasnext) {
         i = tailmap.entrySet().iterator();
-        first = nextEntry();
+        
+        Map.Entry<K, V> e = nextEntry();
+        if (e.getKey().equals(startingkey)) {
+          e = nextEntry();
+        }
+
+        first = e; 
         next = first;
       }
       else {

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java?rev=725540&r1=725539&r2=725540&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java Wed
Dec 10 18:05:35 2008
@@ -151,7 +151,7 @@
    * <p>
    * Mapping: StorageID -> DatanodeDescriptor
    */
-  NavigableMap<String, DatanodeDescriptor> datanodeMap = 
+  SortedMap<String, DatanodeDescriptor> datanodeMap = 
     new TreeMap<String, DatanodeDescriptor>();
 
   //

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/AppendTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/AppendTestUtil.java?rev=725540&r1=725539&r2=725540&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/AppendTestUtil.java (original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/AppendTestUtil.java Wed
Dec 10 18:05:35 2008
@@ -113,7 +113,7 @@
       TestCase.assertEquals(-1, in.read()); //EOF  
       in.close();
     } catch(IOException ioe) {
-      throw new IOException("p=" + p + ", length=" + length + ", i=" + i, ioe);
+      throw (IOException)new IOException("p=" + p + ", length=" + length + ", i=" + i).initCause(ioe);
     }
   }
 }

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/util/TestCyclicIteration.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/util/TestCyclicIteration.java?rev=725540&r1=725539&r2=725540&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/util/TestCyclicIteration.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/util/TestCyclicIteration.java
Wed Dec 10 18:05:35 2008
@@ -21,7 +21,7 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import java.util.NavigableMap;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 public class TestCyclicIteration extends junit.framework.TestCase {
@@ -33,7 +33,7 @@
 
   private static void checkCyclicIteration(int numOfElements) {
     //create a tree map
-    final NavigableMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
+    final SortedMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
     final Integer[] integers = new Integer[numOfElements];
     for(int i = 0; i < integers.length; i++) {
       integers[i] = 2*i;



Mime
View raw message