From 8e9b683d1ce8c7efa5641cf2179e2cc9983bfea1 Mon Sep 17 00:00:00 2001 From: "congcong.han@qunar.com" Date: Sat, 28 Sep 2019 20:27:37 +0800 Subject: [PATCH] fix undefined constants --- .../hbase/trace/HBaseHTraceConfiguration.java | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java index 03d03d9fe4..ab496049a5 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java @@ -27,13 +27,23 @@ import org.slf4j.LoggerFactory; @InterfaceAudience.Private public class HBaseHTraceConfiguration extends HTraceConfiguration { private static final Logger LOG = LoggerFactory.getLogger(HBaseHTraceConfiguration.class); + private static final String LOCAL_FILE_SPAN_RECEIVER_PATH = "local-file-span-receiver.path"; + private static final String LOCAL_FILE_SPAN_RECEIVER_CAPACITY = "local-file-span-receiver.capacity"; + private static final String SAMPLER_FREQUENCY = "sampler.frequency"; + private static final String SAMPLER_FRACTION = "sampler.fraction"; + private static final String ZIPKIN_COLLECTOR_HOSTNAME = "zipkin.collector-hostname"; + private static final String ZIPKIN_COLLECTOR_PORT = "zipkin.collector-port"; + private static final String ZIPKIN_NUM_THREADS = "zipkin.num-threads"; + private static final String ZIPKIN_TRACED_SERVICE_HOSTNAME = "zipkin.traced-service-hostname"; + private static final String ZIPKIN_TRACED_SERVICE_PORT = "zipkin.traced-service-port"; + private static final String KEY_PREFIX_OLD = "hbase."; public static final String KEY_PREFIX = "hbase.htrace."; private Configuration conf; private void handleDeprecation(String key) { - String oldKey = "hbase." + key; + String oldKey = KEY_PREFIX_OLD + key; String newKey = KEY_PREFIX + key; String oldValue = conf.get(oldKey); if (oldValue != null) { @@ -51,15 +61,15 @@ public class HBaseHTraceConfiguration extends HTraceConfiguration { public HBaseHTraceConfiguration(Configuration conf) { this.conf = conf; - handleDeprecation("local-file-span-receiver.path"); - handleDeprecation("local-file-span-receiver.capacity"); - handleDeprecation("sampler.frequency"); - handleDeprecation("sampler.fraction"); - handleDeprecation("zipkin.collector-hostname"); - handleDeprecation("zipkin.collector-port"); - handleDeprecation("zipkin.num-threads"); - handleDeprecation("zipkin.traced-service-hostname"); - handleDeprecation("zipkin.traced-service-port"); + handleDeprecation(LOCAL_FILE_SPAN_RECEIVER_PATH); + handleDeprecation(LOCAL_FILE_SPAN_RECEIVER_CAPACITY); + handleDeprecation(SAMPLER_FREQUENCY); + handleDeprecation(SAMPLER_FRACTION); + handleDeprecation(ZIPKIN_COLLECTOR_HOSTNAME); + handleDeprecation(ZIPKIN_COLLECTOR_PORT); + handleDeprecation(ZIPKIN_NUM_THREADS); + handleDeprecation(ZIPKIN_TRACED_SERVICE_HOSTNAME); + handleDeprecation(ZIPKIN_TRACED_SERVICE_PORT); } @Override -- 2.11.1.windows.1