Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ void registerSource(String name, String desc, MetricsSource source) {
T register(final String name, final String description, final T sink) {
LOG.debug(name +", "+ description);
if (allSinks.containsKey(name)) {
LOG.warn("Sink "+ name +" already exists!");
if(sinks.get(name) == null) {
registerSink(name, description, sink);
} else {
LOG.warn("Sink "+ name +" already exists!");
}
return sink;
}
allSinks.put(name, sink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,23 @@ private static class TestSource2 {
private static String getPluginUrlsAsString() {
return "file:metrics2-test-plugin.jar";
}

@Test
public void testMetricSystemRestart() {
MetricsSystemImpl ms = new MetricsSystemImpl("msRestartTestSystem");
TestSink ts = new TestSink();
String sinkName = "restartTestSink";

try {
ms.start();
ms.register(sinkName, "", ts);
assertNotNull("an adapter should exist for each sink", ms.getSinkAdapter(sinkName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're generally still 80 chars wide, I'm afraid...put the actual probe on a new line.
nice to see some text for the assertion tnough -appreciated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it, please review (added more info to the message)

ms.stop();

ms.start();
assertNotNull("an adapter should exist for each sink", ms.getSinkAdapter(sinkName));
} finally {
ms.stop();
}
}
}