### Question:
ScheduledSingleThreadExecutor extends AbstractExecutorService implements ScheduledExecutorService { @Override public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { if (command == null || unit == null) throw new NullPointerException(); RunnableScheduledFuture<?> t = decorateTask(command, new ScheduledFutureTask<Void>(command, null, triggerTime(delay, unit))); delayedExecute(t); return t; } ScheduledSingleThreadExecutor(ThreadFactory threadFactory);  ScheduledSingleThreadExecutor(); @Override ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit); @Override ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit); @Override ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); @Override ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit); @Override void execute(Runnable command); @Override Future<?> submit(Runnable task); @Override Future<T> submit(Runnable task, T result); @Override Future<T> submit(Callable<T> task); void setContinueExistingPeriodicTasksAfterShutdownPolicy(boolean value); boolean getContinueExistingPeriodicTasksAfterShutdownPolicy(); void setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean value); boolean getExecuteExistingDelayedTasksAfterShutdownPolicy(); void setRemoveOnCancelPolicy(boolean value); boolean getRemoveOnCancelPolicy(); @Override void shutdown(); @Override List<Runnable> shutdownNow(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isShutdown(); @Override boolean isTerminated(); int getPoolSize(); int getActiveCount();  }### Answer:
@Test public void testMultipleProducers() throws Exception { final int nThread = 5; final int nSchedules = 50000; final AtomicInteger counter2 = new AtomicInteger(); final AtomicInteger counter = new AtomicInteger(); for (int t = 0; t < nThread; t++) { new Thread(new Runnable() { @Override public void run() { try { for (int i = 0; i < nSchedules; i++) { counter2.incrementAndGet(); exec.schedule(new Runnable() { @Override public void run() { counter.incrementAndGet(); } }, 0, TimeUnit.MILLISECONDS); } } catch (Throwable t) { t.printStackTrace(); } } }).start(); } Thread.sleep(3000); assertThat(counter2.get(), is(nThread * nSchedules)); assertThat(counter.get(), is(nThread * nSchedules)); }