Skip to content

Commit

Permalink
Added Thread Factory with default name to thread as as suggedted by @…
Browse files Browse the repository at this point in the history
  • Loading branch information
chetankokil committed Jul 11, 2021
1 parent bd3cf79 commit 946403f
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 946403f

Please sign in to comment.