### Question:
SystemProcessingTimeService extends ProcessingTimeService { @Override public boolean shutdownServiceUninterruptible(long timeoutMs) { final Deadline deadline = Deadline.fromNow(Duration.ofMillis(timeoutMs)); boolean shutdownComplete = false; boolean receivedInterrupt = false; do { try { shutdownComplete = shutdownAndAwaitPending(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException iex) { receivedInterrupt = true; LOG.trace("Intercepted attempt to interrupt timer service shutdown.", iex); } } while (deadline.hasTimeLeft() && !shutdownComplete); if (receivedInterrupt) { Thread.currentThread().interrupt(); } return shutdownComplete; } SystemProcessingTimeService(AsyncExceptionHandler failureHandler, Object checkpointLock);  SystemProcessingTimeService(
			AsyncExceptionHandler task,
			Object checkpointLock,
			ThreadFactory threadFactory); @Override long getCurrentProcessingTime(); @Override ScheduledFuture<?> registerTimer(long timestamp, ProcessingTimeCallback target); @Override ScheduledFuture<?> scheduleAtFixedRate(ProcessingTimeCallback callback, long initialDelay, long period); @Override boolean isTerminated(); @Override void quiesce(); @Override void awaitPendingAfterQuiesce(); @Override void shutdownService(); @Override boolean shutdownAndAwaitPending(long time, TimeUnit timeUnit); @Override boolean shutdownServiceUninterruptible(long timeoutMs);  }### Answer:
@Test public void testShutdownServiceUninterruptible() { final Object lock = new Object(); final OneShotLatch blockUntilTriggered = new OneShotLatch(); final AtomicBoolean timerFinished = new AtomicBoolean(false); final SystemProcessingTimeService timeService = createBlockingSystemProcessingTimeService(lock, blockUntilTriggered, timerFinished); Assert.assertFalse(timeService.isTerminated()); final Thread interruptTarget = Thread.currentThread(); final AtomicBoolean runInterrupts = new AtomicBoolean(true); final Thread interruptCallerThread = new Thread(() -> { while (runInterrupts.get()) { interruptTarget.interrupt(); try { Thread.sleep(1); } catch (InterruptedException ignore) { } } }); interruptCallerThread.start(); final long timeoutMs = 50L; final long startTime = System.nanoTime(); Assert.assertFalse(timeService.isTerminated()); Assert.assertFalse(timeService.shutdownServiceUninterruptible(timeoutMs)); Assert.assertTrue(timeService.isTerminated()); Assert.assertFalse(timerFinished.get()); Assert.assertTrue((System.nanoTime() - startTime) >= (1_000_000L * timeoutMs)); runInterrupts.set(false); do { try { interruptCallerThread.join(); } catch (InterruptedException ignore) { } } while (interruptCallerThread.isAlive()); blockUntilTriggered.trigger(); Assert.assertTrue(timeService.shutdownServiceUninterruptible(timeoutMs)); Assert.assertTrue(timerFinished.get()); }