Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaExecutorService usageSingle-choice MCQ

Why can this scheduled task silently stop repeating?

ScheduledExecutorService s = Executors.newScheduledThreadPool(1); s.scheduleAtFixedRate(() -> { if (Math.random() < 0.1) throw new RuntimeException("glitch"); doWork(); }, 0, 1, TimeUnit.SECONDS);