Skip to content

Commit

Permalink
Ensure regularly gets shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Jan 22, 2019
1 parent 63fc629 commit 997f445
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public class Regularly {
public Regularly(String name) {
Objects.requireNonNull(name, "Name must be set");

this.executor = Executors.newScheduledThreadPool(1, r -> new Thread(r, name));
this.executor = Executors.newScheduledThreadPool(1, r -> {
Thread thread = new Thread(r, name);
thread.setDaemon(true);
return thread;
});
}

public void submit(Runnable task, Duration successPeriod, Duration retryPeriod) {
Expand Down

0 comments on commit 997f445

Please sign in to comment.