HDFS-7202. Should be able to omit package name of SpanReceiver on "hadoop trace -add" (iwasakims via cmccabe)

This commit is contained in:
Colin Patrick Mccabe 2014-10-08 17:55:46 -07:00
parent df3becf080
commit d996235285
3 changed files with 15 additions and 4 deletions

View File

@ -137,10 +137,6 @@ public class SpanReceiverHost implements TraceAdminProtocol {
getUniqueLocalTraceFileName());
}
for (String className : receiverNames) {
className = className.trim();
if (!className.contains(".")) {
className = "org.htrace.impl." + className;
}
try {
SpanReceiver rcvr = loadInstance(className, EMPTY);
Trace.addReceiver(rcvr);
@ -154,6 +150,10 @@ public class SpanReceiverHost implements TraceAdminProtocol {
private synchronized SpanReceiver loadInstance(String className,
List<ConfigurationPair> extraConfig) throws IOException {
className = className.trim();
if (!className.contains(".")) {
className = "org.htrace.impl." + className;
}
Class<?> implClass = null;
SpanReceiver impl;
try {

View File

@ -373,6 +373,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7186. Document the "hadoop trace" command. (Masatake Iwasaki via Colin
P. McCabe)
HDFS-7202. Should be able to omit package name of SpanReceiver on "hadoop
trace -add" (iwasakims via cmccabe)
OPTIMIZATIONS
BUG FIXES

View File

@ -82,6 +82,14 @@ public class TestTraceAdmin {
getHostPortForNN(cluster)));
Assert.assertEquals("ret:0, [no span receivers found]\n",
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
Assert.assertEquals("ret:0, Added trace span receiver 2 with " +
"configuration local-file-span-receiver.path = " + tracePath + "\n",
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
"-class", "LocalFileSpanReceiver",
"-Clocal-file-span-receiver.path=" + tracePath));
Assert.assertEquals("ret:0, Removed trace span receiver 2\n",
runTraceCommand(trace, "-remove", "2", "-host",
getHostPortForNN(cluster)));
} finally {
cluster.shutdown();
tempDir.close();