Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 0f1e02a29 -> c177823eb


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/c177823e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c177823e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c177823e

Branch: refs/heads/branch-2.8
Commit: c177823ebee8ec49e666c4bbbceb8bdca2a01ad9
Parents: 0f1e02a
Author: Steve Loughran <[email protected]>
Authored: Wed Jul 20 14:01:17 2016 +0100
Committer: Steve Loughran <[email protected]>
Committed: Wed Jul 20 14:01:17 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/c177823e/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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to