You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by rb...@apache.org on 2014/09/03 02:20:51 UTC
git commit: TEZ-1515. DAGAppMaster : Thread contentions due to
org.apache.tez.common.counters.ResourceBundles (Rajesh Balamohan)
Repository: tez
Updated Branches:
refs/heads/branch-0.5 523d6a87d -> ff359ff35
TEZ-1515. DAGAppMaster : Thread contentions due to org.apache.tez.common.counters.ResourceBundles (Rajesh Balamohan)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/ff359ff3
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/ff359ff3
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/ff359ff3
Branch: refs/heads/branch-0.5
Commit: ff359ff353cd95962d093113edd4a479796af59f
Parents: 523d6a8
Author: Rajesh Balamohan <rb...@apache.org>
Authored: Wed Sep 3 05:50:26 2014 +0530
Committer: Rajesh Balamohan <rb...@apache.org>
Committed: Wed Sep 3 05:50:26 2014 +0530
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../common/counters/AbstractCounterGroup.java | 4 +-
.../common/counters/CounterGroupFactory.java | 3 +-
.../common/counters/FileSystemCounterGroup.java | 14 +--
.../common/counters/FrameworkCounterGroup.java | 5 +-
.../tez/common/counters/ResourceBundles.java | 96 --------------------
6 files changed, 8 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8153574..63ff707 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -89,6 +89,7 @@ INCOMPATIBLE CHANGES
ALL CHANGES
+ TEZ-1515. DAGAppMaster : Thread contentions due to org.apache.tez.common.counters.ResourceBundles (Rajesh Balamohan)
TEZ-1516. Log transfer rates for broadcast fetch. (sseth)
TEZ-1511. MROutputConfigBuilder sets OutputFormat as String class if OutputFormat is not provided (bikas)
TEZ-1509. Set a useful default value for java opts (bikas)
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/tez-api/src/main/java/org/apache/tez/common/counters/AbstractCounterGroup.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/counters/AbstractCounterGroup.java b/tez-api/src/main/java/org/apache/tez/common/counters/AbstractCounterGroup.java
index e9a291b..7e791d7 100644
--- a/tez-api/src/main/java/org/apache/tez/common/counters/AbstractCounterGroup.java
+++ b/tez-api/src/main/java/org/apache/tez/common/counters/AbstractCounterGroup.java
@@ -115,9 +115,7 @@ public abstract class AbstractCounterGroup<T extends TezCounter>
private synchronized T findCounterImpl(String counterName, boolean create) {
T counter = counters.get(counterName);
if (counter == null && create) {
- String localized =
- ResourceBundles.getCounterName(getName(), counterName, counterName);
- return addCounterImpl(counterName, localized, 0);
+ return addCounterImpl(counterName, counterName, 0);
}
return counter;
}
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/tez-api/src/main/java/org/apache/tez/common/counters/CounterGroupFactory.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/counters/CounterGroupFactory.java b/tez-api/src/main/java/org/apache/tez/common/counters/CounterGroupFactory.java
index 45da0dd..ee9b45f 100644
--- a/tez-api/src/main/java/org/apache/tez/common/counters/CounterGroupFactory.java
+++ b/tez-api/src/main/java/org/apache/tez/common/counters/CounterGroupFactory.java
@@ -87,8 +87,7 @@ public abstract class CounterGroupFactory<C extends TezCounter,
* @return a new counter group
*/
public G newGroup(String name, Limits limits) {
- return newGroup(name, ResourceBundles.getCounterGroupName(name, name),
- limits);
+ return newGroup(name, name, limits);
}
/**
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/tez-api/src/main/java/org/apache/tez/common/counters/FileSystemCounterGroup.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/counters/FileSystemCounterGroup.java b/tez-api/src/main/java/org/apache/tez/common/counters/FileSystemCounterGroup.java
index bb2dc8b..2186c2c 100644
--- a/tez-api/src/main/java/org/apache/tez/common/counters/FileSystemCounterGroup.java
+++ b/tez-api/src/main/java/org/apache/tez/common/counters/FileSystemCounterGroup.java
@@ -54,10 +54,9 @@ public abstract class FileSystemCounterGroup<C extends TezCounter>
// Just a few local casts probably worth not having to carry it around.
private final Map<String, Object[]> map =
new ConcurrentSkipListMap<String, Object[]>();
- private String displayName;
+ private String displayName = "File System Counters";
private static final Joiner NAME_JOINER = Joiner.on('_');
- private static final Joiner DISP_JOINER = Joiner.on(": ");
@InterfaceAudience.Private
public static class FSCounter extends AbstractCounter {
@@ -77,12 +76,7 @@ public abstract class FileSystemCounterGroup<C extends TezCounter>
@Override
public String getDisplayName() {
- return DISP_JOINER.join(scheme, localizeCounterName(key.name()));
- }
-
- protected String localizeCounterName(String counterName) {
- return ResourceBundles.getCounterName(FileSystemCounter.class.getName(),
- counterName, counterName);
+ return key.name();
}
@Override
@@ -123,10 +117,6 @@ public abstract class FileSystemCounterGroup<C extends TezCounter>
@Override
public String getDisplayName() {
- if (displayName == null) {
- displayName = ResourceBundles.getCounterGroupName(getName(),
- "File System Counters");
- }
return displayName;
}
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/tez-api/src/main/java/org/apache/tez/common/counters/FrameworkCounterGroup.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/counters/FrameworkCounterGroup.java b/tez-api/src/main/java/org/apache/tez/common/counters/FrameworkCounterGroup.java
index a99e5a4..66b6e33 100644
--- a/tez-api/src/main/java/org/apache/tez/common/counters/FrameworkCounterGroup.java
+++ b/tez-api/src/main/java/org/apache/tez/common/counters/FrameworkCounterGroup.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
+import com.google.common.base.Joiner;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.io.WritableUtils;
@@ -69,7 +70,7 @@ public abstract class FrameworkCounterGroup<T extends Enum<T>,
@Override
public String getDisplayName() {
- return ResourceBundles.getCounterName(groupName, getName(), getName());
+ return getName();
}
@Override
@@ -117,7 +118,7 @@ public abstract class FrameworkCounterGroup<T extends Enum<T>,
@Override
public String getDisplayName() {
if (displayName == null) {
- displayName = ResourceBundles.getCounterGroupName(getName(), getName());
+ displayName = getName();
}
return displayName;
}
http://git-wip-us.apache.org/repos/asf/tez/blob/ff359ff3/tez-api/src/main/java/org/apache/tez/common/counters/ResourceBundles.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/counters/ResourceBundles.java b/tez-api/src/main/java/org/apache/tez/common/counters/ResourceBundles.java
deleted file mode 100644
index 1742645..0000000
--- a/tez-api/src/main/java/org/apache/tez/common/counters/ResourceBundles.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.tez.common.counters;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.apache.hadoop.classification.InterfaceAudience.Private;
-
-/**
- * Helper class to handle resource bundles in a saner way
- */
-@Private
-public class ResourceBundles {
-
- /**
- * Get a resource bundle
- * @param bundleName of the resource
- * @return the resource bundle
- * @throws MissingResourceException
- */
- public static ResourceBundle getBundle(String bundleName) {
- return ResourceBundle.getBundle(bundleName.replace('$', '_'),
- Locale.getDefault(), Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Get a resource given bundle name and key
- * @param <T> type of the resource
- * @param bundleName name of the resource bundle
- * @param key to lookup the resource
- * @param suffix for the key to lookup
- * @param defaultValue of the resource
- * @return the resource or the defaultValue
- * @throws ClassCastException if the resource found doesn't match T
- */
- @SuppressWarnings("unchecked")
- public static synchronized <T> T getValue(String bundleName, String key,
- String suffix, T defaultValue) {
- T value;
- try {
- ResourceBundle bundle = getBundle(bundleName);
- value = (T) bundle.getObject(getLookupKey(key, suffix));
- if (value != null) {
- return value;
- }
- }
- catch (Exception e) {
- // Ignore
- }
- return defaultValue;
- }
-
- private static String getLookupKey(String key, String suffix) {
- if (suffix == null || suffix.isEmpty()) return key;
- return key + suffix;
- }
-
- /**
- * Get the counter group display name
- * @param group the group name to lookup
- * @param defaultValue of the group
- * @return the group display name
- */
- public static String getCounterGroupName(String group, String defaultValue) {
- return getValue(group, "CounterGroupName", "", defaultValue);
- }
-
- /**
- * Get the counter display name
- * @param group the counter group name for the counter
- * @param counter the counter name to lookup
- * @param defaultValue of the counter
- * @return the counter display name
- */
- public static String getCounterName(String group, String counter,
- String defaultValue) {
- return getValue(group, counter, ".name", defaultValue);
- }
-}