hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1349982 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/conf/Configuration.java src/test/org/apache/hadoop/conf/TestConfiguration.java
Date Wed, 13 Jun 2012 18:26:41 GMT
Author: tucu
Date: Wed Jun 13 18:26:41 2012
New Revision: 1349982

URL: http://svn.apache.org/viewvc?rev=1349982&view=rev
Log:
HADOOP-8023. Add unset() method to Configuration (tucu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/conf/Configuration.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/conf/TestConfiguration.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1349982&r1=1349981&r2=1349982&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Jun 13 18:26:41 2012
@@ -6,6 +6,8 @@ Release 1.2.0 - unreleased
 
   NEW FEATURES
 
+    HADOOP-8023. Add unset() method to Configuration (tucu)
+
   IMPROVEMENTS
 
     HDFS-3515. Port HDFS-1457 to branch-1. (eli)

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/conf/Configuration.java?rev=1349982&r1=1349981&r2=1349982&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/conf/Configuration.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/conf/Configuration.java Wed
Jun 13 18:26:41 2012
@@ -438,7 +438,15 @@ public class Configuration implements It
     getOverlay().setProperty(name, value);
     getProps().setProperty(name, value);
   }
-  
+ 
+  /**
+   * Unset a previously set property.
+   */
+  public synchronized void unset(String name) {
+    getOverlay().remove(name);
+    getProps().remove(name);
+  }
+ 
   /**
    * Sets a property if it is currently unset.
    * @param name the property name

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/conf/TestConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/conf/TestConfiguration.java?rev=1349982&r1=1349981&r2=1349982&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/conf/TestConfiguration.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/conf/TestConfiguration.java
Wed Jun 13 18:26:41 2012
@@ -625,5 +625,14 @@ public class TestConfiguration extends T
     assertTrue("Picked out wrong key " + key3, !res.containsKey(key3));
     assertTrue("Picked out wrong key " + key4, !res.containsKey(key4));
   }
+
+  public void testUnset() {
+    Configuration conf = new Configuration();
+    conf.set("foo", "bar");
+    assertNotNull(conf.get("foo"));
+    conf.unset("foo");
+    assertNull(conf.get("foo"));
+  }
+
 }
 



Mime
View raw message