WorkflowExecutorService extends AbstractService { public void execute(Runnable runnable) { getExecutor().execute(runnable); } WorkflowExecutorService(String name);  WorkflowExecutorService(String name,
      E executor); synchronized E getExecutor(); synchronized void setExecutor(E executor); void execute(Runnable runnable); Future<V> submit(Callable<V> callable);  }
@Test public void testAsyncRun() throws Throwable { ExecutorSvc svc = run(new ExecutorSvc()); ServiceTerminatingRunnable runnable = new ServiceTerminatingRunnable(svc, new SimpleRunnable()); svc.execute(runnable); Thread.sleep(1000); assertStopped(svc); }
@Test public void testFailureRun() throws Throwable { ExecutorSvc svc = run(new ExecutorSvc()); ServiceTerminatingRunnable runnable = new ServiceTerminatingRunnable(svc, new SimpleRunnable(true)); svc.execute(runnable); Thread.sleep(1000); assertStopped(svc); assertNotNull(runnable.getException()); }