Skip to content

Commit

Permalink
Merge pull request #18596 from chetankokil/CK-Change_Thread_name
Browse files Browse the repository at this point in the history
FSWatchUtil should assign a good name to the threads it starts
  • Loading branch information
gsmet authored Jul 12, 2021
2 parents e65847c + 946403f commit f00296d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.function.Consumer;
import java.util.stream.Collectors;

Expand All @@ -31,7 +32,8 @@ public class FSWatchUtil {
*/
public void observe(Collection<Watcher> watchers,
long intervalMs) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
ThreadFactory tf = (Runnable r) -> new Thread(r, "FSWatchUtil");
ExecutorService executorService = Executors.newSingleThreadExecutor(tf);
executorService.execute(
() -> doObserve(watchers, intervalMs));
executors.add(executorService);
Expand Down

0 comments on commit f00296d

Please sign in to comment.