Skip to content

Commit c458153

Browse files
committed
ReactiveX#351 - this change should fix bug that prevents JVM shutdown
1 parent 347c302 commit c458153

File tree

1 file changed

+10
-3
lines changed
  • resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal

1 file changed

+10
-3
lines changed

resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/AutoTransitioner.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
*/
1414
public class AutoTransitioner {
1515

16-
private static final Lazy<ScheduledExecutorService> executorService = Lazy.of(
17-
Executors::newSingleThreadScheduledExecutor);
16+
private static final Lazy<ScheduledExecutorService> executorService = Lazy.of(AutoTransitioner::autoTransitionerSchedulerFactory);
1817

1918
private AutoTransitioner() {
2019
}
@@ -25,4 +24,12 @@ public static void scheduleAutoTransition(Runnable transition, Duration waitDura
2524
waitDurationInOpenState.toMillis(),
2625
TimeUnit.MILLISECONDS);
2726
}
28-
}
27+
28+
private static ScheduledExecutorService autoTransitionerSchedulerFactory() {
29+
return Executors.newSingleThreadScheduledExecutor(threadTask -> {
30+
Thread thread = new Thread(threadTask, "AutomaticTransitionerFromOpenToHalfOpen");
31+
thread.setDaemon(true);
32+
return thread;
33+
});
34+
}
35+
}

0 commit comments

Comments
 (0)