public void notifyThreadIdle() {
        this.occupiedWorkers.decrementAndGet();
        onboardNewWorkTask.runTaskThreadSafe();
    }
@Test
    void onThreadIdleNewWorkIsOnboardedAndThreadSafe() throws InterruptedException {
        final Job enqueuedJob = anEnqueuedJob().build();
        final List<Job> jobs = List.of(enqueuedJob);
        lenient().when(storageProvider.getJobsToProcess(eq(backgroundJobServer), any())).thenReturn(jobs);

        final List<Throwable> throwables = new CopyOnWriteArrayList<>();
        UncaughtExceptionHandler uncaughtExceptionHandler = (thread, throwable) -> throwables.add(throwable);

        Random random = new Random();

        final int concurrency = 10_000;
        CountDownLatch countDownLatch = new CountDownLatch(concurrency);

        List<Thread> threads = new ArrayList<>();
        for (int i = 0; i < concurrency; i++) {
            final Thread thread = new Thread(() -> {
                SleepUtils.sleep(random.nextInt(10));
                jobSteward.notifyThreadIdle();
                countDownLatch.countDown();
            });
            thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
            threads.add(thread);
        }

        try (TemporarilyLogLevelChange ignored = temporarilyChangeLogLevel(OnboardNewWorkTask.class, Level.INFO)) {
            threads.forEach(Thread::start);
            countDownLatch.await();
        }

        assertThat(throwables).isEmpty();
        verify(backgroundJobServer, times(concurrency)).isRunning();
        verify(backgroundJobServer, atLeast(1)).processJob(enqueuedJob); // due to ReentrantLock
    }