소스 검색

HADOOP-18808. LogExactlyOnce to add a debug() method (#5850)

Contributed by Steve Loughran
Steve Loughran 1 년 전
부모
커밋
b3130056f5
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/store/LogExactlyOnce.java

+ 11 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/store/LogExactlyOnce.java

@@ -49,4 +49,15 @@ public class LogExactlyOnce {
       log.error(format, args);
     }
   }
+
+  /**
+   * Log at DEBUG if nothing has been logged yet.
+   * @param format format string
+   * @param args arguments
+   */
+  public void debug(String format, Object...args) {
+    if (!logged.getAndSet(true)) {
+      log.debug(format, args);
+    }
+  }
 }