GCDExecutorService extends AbstractExecutorService { public void execute(Runnable command) { if ( command == null ) { throw new NullPointerException("Tasks may not be null"); } try { shutdownLock.lock(); if ( state != State.RUNNING ) { throw new RejectedExecutionException("Executor is not running"); } else { InvocationFutureTask<?> task = command instanceof InvocationFutureTask<?> ? (InvocationFutureTask<?>) command : (InvocationFutureTask<?>) newTaskFor(command, null); queue.addOperation(task.getInvocationOperation()); } } finally { shutdownLock.unlock(); } } GCDExecutorService(); void shutdown(); List<Runnable> shutdownNow(); boolean isShutdown(); boolean isTerminated(); boolean awaitTermination(long timeout, TimeUnit unit); void execute(Runnable command);  }
@Test public void testExecute() throws InterruptedException { final boolean[] done = { false }; fixture.execute(new Runnable() { public void run() { done[0]=true; } }); Thread.sleep(1000); assertTrue(done[0]); }