DynamicSequentialTask extends BasicTask<T> implements HasTaskChildren, TaskQueueingContext { @Override public void swallowChildrenFailures() { setFailureHandlingConfig(FailureHandlingConfig.SWALLOWING_CHILDREN_FAILURES); } DynamicSequentialTask();  DynamicSequentialTask(Callable<T> mainJob);  DynamicSequentialTask(Map<?,?> flags, Callable<T> mainJob); @Override void queue(Task<?> t); @Override boolean cancel(TaskCancellationMode mode); @Override synchronized boolean uncancel(); @Override Iterable<Task<?>> getChildren(); void setFailureHandlingConfig(FailureHandlingConfig failureHandlingConfig); @Override void swallowChildrenFailures(); @Override List<Task<?>> getQueue(); void handleException(Throwable throwable, boolean fromChild); void handleException(Throwable throwable); @Override void drain(Duration optionalTimeout, boolean includePrimary, boolean throwFirstError);  }
@Test public void testWhenSwallowingChildrenFailureDoesNotAbortSecondaryOrFailPrimary() { Task<String> t1 = monitorableTask(null, "1", new FailCallable()); Task<String> t = Tasks.<String>builder().dynamic(true) .body(monitorableJob("main")) .add(t1).add(monitorableTask("2")).swallowChildrenFailures(true).build(); ec.submit(t); releaseAndWaitForMonitorableJob("1"); Assert.assertFalse(t.blockUntilEnded(TINY_TIME)); releaseAndWaitForMonitorableJob("2"); Assert.assertFalse(t.blockUntilEnded(TINY_TIME)); releaseMonitorableJob("main"); Assert.assertTrue(t.blockUntilEnded(TIMEOUT)); Assert.assertEquals(messages, MutableList.of("1", "2", "main")); Assert.assertTrue(stopwatch.elapsed(TimeUnit.MILLISECONDS) < TIMEOUT.toMilliseconds(), "took too long: "+stopwatch); Assert.assertFalse(t.isError()); Assert.assertTrue(t1.isError()); }