[45/50] [abbrv] hadoop git commit: YARN-7115. Move BoundedAppender to org.hadoop.yarn.util pacakge (Contributed by Jian He via Daniel Templeton)

2017-08-31 Thread stevel
YARN-7115. Move BoundedAppender to org.hadoop.yarn.util pacakge
(Contributed by Jian He via Daniel Templeton)


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

Branch: refs/heads/HADOOP-13345
Commit: cc23514abacb4d6589e731cc5ce5d8e6f19c955d
Parents: 3e0e203
Author: Daniel Templeton 
Authored: Wed Aug 30 17:26:13 2017 -0700
Committer: Daniel Templeton 
Committed: Wed Aug 30 17:26:13 2017 -0700

--
 .../hadoop-yarn/hadoop-yarn-common/pom.xml  |  14 +-
 .../hadoop/yarn/util/BoundedAppender.java   | 142 +++
 .../hadoop/yarn/util/TestBoundedAppender.java   | 115 +++
 .../rmapp/attempt/RMAppAttemptImpl.java | 114 +--
 .../rmapp/attempt/TestBoundedAppender.java  | 116 ---
 .../TestRMAppAttemptImplDiagnostics.java|   3 +-
 6 files changed, 270 insertions(+), 234 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc23514a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
--
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
index f17cf8c..c2a5c67 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
@@ -108,6 +108,15 @@
   org.apache.hadoop
   hadoop-annotations
 
+
+
+  junit
+  junit
+  test
+
 
   org.mockito
   mockito-all
@@ -129,11 +138,6 @@
   protobuf-java
 
 
-  junit
-  junit
-  test
-
-
   org.bouncycastle
   bcprov-jdk16
   test

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc23514a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
new file mode 100644
index 000..917d696
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
@@ -0,0 +1,142 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.util;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * A {@link CharSequence} appender that considers its {@link #limit} as upper
+ * bound.
+ * 
+ * When {@link #limit} would be reached on append, past messages will be
+ * truncated from head, and a header telling the user about truncation will be
+ * prepended, with ellipses in between header and messages.
+ * 
+ * Note that header and ellipses are not counted against {@link #limit}.
+ * 
+ * An example:
+ *
+ * 
+ * {@code
+ *   // At the beginning it's an empty string
+ *   final Appendable shortAppender = new BoundedAppender(80);
+ *   // The whole message fits into limit
+ *   shortAppender.append(
+ *   "message1 this is a very long message but fitting into limit\n");
+ *   // The first message is truncated, the second not
+ *   shortAppender.append("message2 this is shorter than the previous one\n");
+ *   // The first message is deleted, the second truncated, the third
+ *   // preserved
+ *   shortAppender.append("message3 this is even shorter message, maybe.\n");
+ *   // The first two are deleted, the third one truncated, the last preserved
+ *   shortAppender.append("message4 the shortest one, yet 

hadoop git commit: YARN-7115. Move BoundedAppender to org.hadoop.yarn.util pacakge (Contributed by Jian He via Daniel Templeton)

2017-08-30 Thread templedf
Repository: hadoop
Updated Branches:
  refs/heads/trunk 3e0e2033c -> cc23514ab


YARN-7115. Move BoundedAppender to org.hadoop.yarn.util pacakge
(Contributed by Jian He via Daniel Templeton)


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

Branch: refs/heads/trunk
Commit: cc23514abacb4d6589e731cc5ce5d8e6f19c955d
Parents: 3e0e203
Author: Daniel Templeton 
Authored: Wed Aug 30 17:26:13 2017 -0700
Committer: Daniel Templeton 
Committed: Wed Aug 30 17:26:13 2017 -0700

--
 .../hadoop-yarn/hadoop-yarn-common/pom.xml  |  14 +-
 .../hadoop/yarn/util/BoundedAppender.java   | 142 +++
 .../hadoop/yarn/util/TestBoundedAppender.java   | 115 +++
 .../rmapp/attempt/RMAppAttemptImpl.java | 114 +--
 .../rmapp/attempt/TestBoundedAppender.java  | 116 ---
 .../TestRMAppAttemptImplDiagnostics.java|   3 +-
 6 files changed, 270 insertions(+), 234 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc23514a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
--
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
index f17cf8c..c2a5c67 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
@@ -108,6 +108,15 @@
   org.apache.hadoop
   hadoop-annotations
 
+
+
+  junit
+  junit
+  test
+
 
   org.mockito
   mockito-all
@@ -129,11 +138,6 @@
   protobuf-java
 
 
-  junit
-  junit
-  test
-
-
   org.bouncycastle
   bcprov-jdk16
   test

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc23514a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
new file mode 100644
index 000..917d696
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BoundedAppender.java
@@ -0,0 +1,142 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.util;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * A {@link CharSequence} appender that considers its {@link #limit} as upper
+ * bound.
+ * 
+ * When {@link #limit} would be reached on append, past messages will be
+ * truncated from head, and a header telling the user about truncation will be
+ * prepended, with ellipses in between header and messages.
+ * 
+ * Note that header and ellipses are not counted against {@link #limit}.
+ * 
+ * An example:
+ *
+ * 
+ * {@code
+ *   // At the beginning it's an empty string
+ *   final Appendable shortAppender = new BoundedAppender(80);
+ *   // The whole message fits into limit
+ *   shortAppender.append(
+ *   "message1 this is a very long message but fitting into limit\n");
+ *   // The first message is truncated, the second not
+ *   shortAppender.append("message2 this is shorter than the previous one\n");
+ *   // The first message is deleted, the second truncated, the third
+ *   // preserved
+ *   shortAppender.append("message3 this is even shorter message, maybe.\n");
+ *   // The first two are deleted, the third one truncated, the