Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Run RemoteReporter's flush timer in daemon thread. #124

Merged
merged 2 commits into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Uber Technologies, Inc
* Copyright (c) 2017, Uber Technologies, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -60,11 +60,11 @@ public RemoteReporter(final Sender sender, int flushInterval, int maxQueueSize,

// start a thread to append spans
queueProcessor = new QueueProcessor();
queueProcessorThread = new Thread(queueProcessor);
queueProcessorThread = new Thread(queueProcessor, "jaeger.RemoteReporter-QueueProcessor");
queueProcessorThread.setDaemon(true);
queueProcessorThread.start();

flushTimer = new Timer();
flushTimer = new Timer("jaeger.RemoteReporter-FlushTimer", true /* isDaemon */);
flushTimer.schedule(
new TimerTask() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Uber Technologies, Inc
* Copyright (c) 2017, Uber Technologies, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,6 +34,8 @@
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class RemoteReporterTest {
private Reporter reporter;
Expand Down Expand Up @@ -89,4 +91,17 @@ public void testRemoteReporterFlushesOnClose() throws Exception {
assertEquals(
100L, metricsReporter.counters.get("jaeger.traces.sampled=y.state=started").longValue());
}

@Test
public void testRemoteReporterFlushTimerThread() throws Exception {
int flushTimerThreadCount = 0;
for (Thread thread : Thread.getAllStackTraces().keySet()) {
if (!thread.getName().equals("jaeger.RemoteReporter-FlushTimer")) {
continue;
}
++flushTimerThreadCount;
assertTrue(thread.isDaemon());
}
assertFalse(flushTimerThreadCount == 0);
}
}