### Question:
DefaultExecutor extends AbstractOffloaderAwareExecutor implements Consumer<Runnable> { @Override public Cancellable execute(Runnable task) { return executor.apply(task); } DefaultExecutor(int coreSize, int maxSize, ThreadFactory threadFactory);   DefaultExecutor(java.util.concurrent.Executor jdkExecutor);   DefaultExecutor(java.util.concurrent.Executor jdkExecutor, boolean interruptOnCancel);   DefaultExecutor(java.util.concurrent.Executor jdkExecutor, ScheduledExecutorService scheduler);   DefaultExecutor(java.util.concurrent.Executor jdkExecutor, ScheduledExecutorService scheduler,
                    boolean interruptOnCancel); private  DefaultExecutor(@Nullable java.util.concurrent.Executor jdkExecutor, @Nullable InternalScheduler scheduler,
                            boolean interruptOnCancel); @Override Cancellable execute(Runnable task); @Override Cancellable schedule(final Runnable task, final long duration, final TimeUnit unit); @Override SignalOffloader newSignalOffloader(final io.servicetalk.concurrent.Executor executor); @Override boolean hasThreadAffinity(); @Override void accept(final Runnable runnable);  }### Answer:
@Test public void execution() throws Throwable { Task task = new Task(); executor.execute(task); task.awaitDone(); }
@Test public void longRunningTasksDoesNotHaltOthers() throws Throwable { Task awaitForever = Task.newAwaitForeverTask(); executor.execute(awaitForever); Task task = new Task(); executor.execute(task); task.awaitDone(); }
@Test public void interDependentTasksCanRun() throws Throwable { Task first = new Task(); Task second = new Task(() -> { try { first.awaitDone(); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }); executor.execute(first); executor.execute(second); second.awaitDone(); }
@Test public void cancelExecute() throws Throwable { assumeTrue("Ignoring executor: " + name + ", it does not support cancellation.", supportsCancellation); CountDownLatch latch = new CountDownLatch(1); Task awaitTillCancelled = Task.awaitFor(latch); Cancellable cancellable = executor.execute(awaitTillCancelled); awaitTillCancelled.awaitStart(); cancellable.cancel(); expected.expectCause(instanceOf(InterruptedException.class)); awaitTillCancelled.awaitDone(); }
@Test public void executeRejection() { assumeTrue("Ignoring executor: " + name + ", it has an unbounded thread pool.", size > 0); for (int i = 0; i < size; i++) { executor.execute(Task.newAwaitForeverTask()); } Task reject = new Task(); expected.expect(RejectedExecutionException.class); executor.execute(reject); }