protected void complete(final State completionState) { LOG.trace("Program {} completed with state {}", programId, completionState); if (!state.compareAndSet(State.STARTING, completionState) && !state.compareAndSet(State.ALIVE, completionState) && !state.compareAndSet(State.SUSPENDED, completionState)) { LOG.warn("Cannot transit to COMPLETED state from {} state: {}", state.get(), name); return; } executor.execute(() -> { state.set(completionState); if (State.KILLED.equals(completionState)) { caller.killed(); } else { caller.completed(); } }); }
protected void complete(final State completionState) { LOG.trace("Program {} completed with state {}", programId, completionState); if (!state.compareAndSet(State.STARTING, completionState) && !state.compareAndSet(State.ALIVE, completionState) && !state.compareAndSet(State.SUSPENDED, completionState)) { LOG.warn("Cannot transit to COMPLETED state from {} state: {}", state.get(), name); return; } executor.execute(() -> { state.set(completionState); if (State.KILLED.equals(completionState)) { caller.killed(); } else { caller.completed(); } }); }
while (!controller.getState().equals(ProgramController.State.COMPLETED)) { TimeUnit.MILLISECONDS.sleep(100);