@Override public String call() { DynamicTasks.markInessential(); stopProcessesAtMachine(); DynamicTasks.waitForLast(); return "Stop processes completed with no errors."; } }
@Override public String call() { DynamicTasks.markInessential(); stop(ConfigBag.newInstance().configure(StopSoftwareParameters.STOP_MACHINE_MODE, StopMode.IF_NOT_STOPPED)); DynamicTasks.waitForLast(); return "Stop of machine completed with no errors."; } }
@Override public void run() { DynamicTasks.markInessential(); boolean cleanExit = Repeater.create() .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return !getDriver().isRunning(); } }) .backoffTo(Duration.ONE_SECOND) .limitTimeTo(Duration.ONE_MINUTE) .run(); if (!cleanExit) { log.warn("Tenant " + this + " didn't stop cleanly after shutdown. Timeout waiting for process exit."); } } }).build());
@Override public String call() { DynamicTasks.markInessential(); for (Feed feed : entity().feeds().getFeeds()) { if (feed.isActivated()) feed.stop(); } DynamicTasks.waitForLast(); return "Stop feeds completed with no errors."; } }
@Override public void run() { DynamicTasks.markInessential(); boolean previouslyRunning = isRunning(); try { ServiceStateLogic.setExpectedState(getEntity(), Lifecycle.STOPPING); stop(); } catch (Exception e) { // queue a failed task so that there is visual indication that this task had a failure, // without interrupting the parent if (previouslyRunning) { log.warn(getEntity() + " restart: stop failed, when was previously running (ignoring)", e); DynamicTasks.queue(Tasks.fail("Primary job failure (when previously running)", e)); } else { log.debug(getEntity() + " restart: stop failed (but was not previously running, so not a surprise)", e); DynamicTasks.queue(Tasks.fail("Primary job failure (when not previously running)", e)); } // the above queued tasks will cause this task to be indicated as failed, with an indication of severity } } });