@Test public void firstExecuteThrows() { final RuntimeException ex = new RuntimeException(); ForwardingExecutor forwardingExecutor = new ForwardingExecutor(new Executor() { @Override public void execute(Runnable r) { throw ex; } }); executor = new SerializingExecutor(forwardingExecutor); try { executor.execute(new AddToRuns(1)); fail("expected exception"); } catch (RuntimeException e) { assertSame(ex, e); } assertEquals(Collections.<Integer>emptyList(), runs); forwardingExecutor.executor = singleExecutor; executor.execute(new AddToRuns(2)); executor.execute(new AddToRuns(3)); assertEquals(Collections.<Integer>emptyList(), runs); singleExecutor.drain(); assertEquals(Arrays.asList(2, 3), runs); }
@Override public void execute(Runnable r) { runQueue.add(checkNotNull(r, "'r' must not be null.")); schedule(r); }
SerializingExecutor implements Executor, Runnable { @Override public void execute(Runnable r) { runQueue.add(checkNotNull(r, "'r' must not be null.")); schedule(r); } }
SerializingExecutor implements Executor, Runnable { @Override public void execute(Runnable r) { runQueue.add(checkNotNull(r, "'r' must not be null.")); schedule(r); } SerializingExecutor(Executor executor); }
SerializingExecutor implements Executor, Runnable { @Override public void execute(Runnable r) { runQueue.add(checkNotNull(r, "'r' must not be null.")); schedule(r); } SerializingExecutor(Executor executor); @Override void execute(Runnable r); @Override void run(); }
SerializingExecutor implements Executor, Runnable { @Override public void execute(Runnable r) { runQueue.add(checkNotNull(r, "'r' must not be null.")); schedule(r); } SerializingExecutor(Executor executor); @Override void execute(Runnable r); @Override void run();  }