hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject hadoop git commit: HADOOP-13387 users always get told off for using S3 —even when not using it. Contributed by stevel.
Date Wed, 20 Jul 2016 13:02:18 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 5490ed5f8 -> d3df810dc


HADOOP-13387 users always get told off for using S3 —even when not using it. Contributed
by stevel.


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

Branch: refs/heads/branch-2
Commit: d3df810dce5d2813b98ca3f3ebac79f4d4d6cc0e
Parents: 5490ed5
Author: Steve Loughran <stevel@apache.org>
Authored: Wed Jul 20 14:01:17 2016 +0100
Committer: Steve Loughran <stevel@apache.org>
Committed: Wed Jul 20 14:01:30 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/s3/S3FileSystem.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d3df810d/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java
index b681555..0b8dcf8 100644
--- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java
+++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -58,7 +59,8 @@ import org.apache.hadoop.util.Progressable;
 @Deprecated
 public class S3FileSystem extends FileSystem {
 
-  private static boolean hasWarnedDeprecation = false;
+  private static final AtomicBoolean hasWarnedDeprecation
+      = new AtomicBoolean(false);
 
   private URI uri;
 
@@ -67,23 +69,20 @@ public class S3FileSystem extends FileSystem {
   private Path workingDir;
 
   public S3FileSystem() {
-    warnDeprecation();
     // set store in initialize()
   }
 
   public S3FileSystem(FileSystemStore store) {
-    warnDeprecation();
     this.store = store;
   }
 
   /**
    * This is to warn the first time in a JVM that an S3FileSystem is created.
    */
-  private static synchronized void warnDeprecation() {
-    if (!hasWarnedDeprecation) {
-      System.err.println("S3FileSystem is deprecated and will be removed in " +
+  private static void warnDeprecation() {
+    if (!hasWarnedDeprecation.getAndSet(true)) {
+      LOG.warn("S3FileSystem is deprecated and will be removed in " +
           "future releases. Use NativeS3FileSystem or S3AFileSystem instead.");
-      hasWarnedDeprecation = true;
     }
   }
 
@@ -105,6 +104,7 @@ public class S3FileSystem extends FileSystem {
   @Override
   public void initialize(URI uri, Configuration conf) throws IOException {
     super.initialize(uri, conf);
+    warnDeprecation();
     if (store == null) {
       store = createDefaultStore(conf);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message