public void doTestReleaseEvenIfErrorDuringStop(final Class<? extends SimulatedDriver> driver) throws Exception { MyService entity = app.addChild(EntitySpec.create(MyServiceWithCustomDriver.class) .configure(MyServiceWithCustomDriver.DRIVER_CLASS, driver)); entity.start(ImmutableList.of(loc)); Task<Void> t = entity.invoke(Startable.STOP, ImmutableMap.<String, Object>of()); t.blockUntilEnded(); assertFalse(t.isError(), "Expected parent to succeed, not fail with " + Tasks.getError(t)); Iterator<Task<?>> failures; failures = Tasks.failed(Tasks.descendants(t, true)).iterator(); Assert.assertTrue(failures.hasNext(), "Expected error in descendants"); Optional<Task<?>> stopping = Iterables.tryFind(Tasks.children(t), TaskPredicates.displayNameEqualTo("stopping")); Assert.assertTrue(stopping.isPresent(), "Could not find stopping task"); failures = Tasks.failed(Tasks.children(stopping.get())).iterator(); Assert.assertTrue(failures.hasNext(), "Expected error in child"); Throwable e = Tasks.getError(failures.next()); if (e == null || !e.toString().contains("Simulating stop error")) Assert.fail("Wrong error", e); Assert.assertEquals(loc.getAvailable(), ImmutableSet.of(machine), "Expected location to be available again"); Entities.unmanage(entity); }
+ (initialQuorumSize != initialSize ? " (initial quorum size is " + initialQuorumSize + ")" : ""); Throwable firstError = Tasks.getError(Maybe.next(failed.iterator()).orNull()); if (firstError==null && internalError!=null) {
DynamicTasks.queueIfPossible(task).orSubmitAndBlock(entity).asTask().blockUntilEnded(); if (task.asTask().isError()) { log.warn("ping could not be run, at "+entity+" / "+origin+": "+Tasks.getError(task.asTask())); return "";
if (verbosity >= 1) { rv += " after "+duration; Throwable error = Tasks.getError(this);