Skip to content

Commit

Permalink
ReactiveX#351 - this change should fix bug that prevents JVM shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
storozhukBM committed Mar 6, 2019
1 parent 347c302 commit c458153
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
*/
public class AutoTransitioner {

private static final Lazy<ScheduledExecutorService> executorService = Lazy.of(
Executors::newSingleThreadScheduledExecutor);
private static final Lazy<ScheduledExecutorService> executorService = Lazy.of(AutoTransitioner::autoTransitionerSchedulerFactory);

private AutoTransitioner() {
}
Expand All @@ -25,4 +24,12 @@ public static void scheduleAutoTransition(Runnable transition, Duration waitDura
waitDurationInOpenState.toMillis(),
TimeUnit.MILLISECONDS);
}
}

private static ScheduledExecutorService autoTransitionerSchedulerFactory() {
return Executors.newSingleThreadScheduledExecutor(threadTask -> {
Thread thread = new Thread(threadTask, "AutomaticTransitionerFromOpenToHalfOpen");
thread.setDaemon(true);
return thread;
});
}
}

0 comments on commit c458153

Please sign in to comment.