static DynamicState handleEmpty(DynamicState dynamicState, StaticState staticState) throws InterruptedException, IOException { assert dynamicState.changingBlobs.isEmpty(); assert dynamicState.pendingChangingBlobsAssignment == null; if (!equivalent(dynamicState.newAssignment, dynamicState.currentAssignment)) { return prepareForNewAssignmentNoWorkersRunning(dynamicState, staticState); } dynamicState = updateAssignmentIfNeeded(dynamicState); //Both assignments are null, just wait if (dynamicState.profileActions != null && !dynamicState.profileActions.isEmpty()) { //Nothing is scheduled here so throw away all of the profileActions LOG.warn("Dropping {} no topology is running", dynamicState.profileActions); dynamicState = dynamicState.withProfileActions(Collections.emptySet(), Collections.emptySet()); } //Drop the change notifications we are not running anything right now dynamicState = drainAllChangingBlobs(dynamicState); Time.sleep(1000); return dynamicState; }
.withProfileActions(origProfileActions, dynamicState.pendingStopProfileActions) .withChangingBlobs(changingResourcesToHandle), staticState);
dynamicState = dynamicState.withProfileActions(mod, modPending);
dynamicState = dynamicState.withProfileActions(mod, modPending);
.withProfileActions(origProfileActions, dynamicState.pendingStopProfileActions), staticState);
/** * Kill the current container and relaunch it. (Something odd happened) * PRECONDITION: container != null * @param dynamicState current state * @param staticState static data * @return the next state * @throws Exception */ static DynamicState killAndRelaunchContainer(DynamicState dynamicState, StaticState staticState) throws Exception { assert(dynamicState.container != null); dynamicState.container.kill(); Time.sleep(staticState.killSleepMs); //any stop profile actions that hadn't timed out yet, we should restart after the worker is running again. HashSet<TopoProfileAction> mod = new HashSet<>(dynamicState.profileActions); mod.addAll(dynamicState.pendingStopProfileActions); return dynamicState.withState(MachineState.KILL_AND_RELAUNCH).withProfileActions(mod, Collections.<TopoProfileAction> emptySet()); }
static DynamicState handleEmpty(DynamicState dynamicState, StaticState staticState) throws InterruptedException, IOException { if (!equivalent(dynamicState.newAssignment, dynamicState.currentAssignment)) { return prepareForNewAssignmentNoWorkersRunning(dynamicState, staticState); } //Both assignments are null, just wait if (dynamicState.profileActions != null && !dynamicState.profileActions.isEmpty()) { //Nothing is scheduled here so throw away all of the profileActions LOG.warn("Dropping {} no topology is running", dynamicState.profileActions); dynamicState = dynamicState.withProfileActions(Collections.<TopoProfileAction> emptySet(), Collections.<TopoProfileAction> emptySet()); } Time.sleep(1000); return dynamicState; }
.withProfileActions(profileActions, Collections.<TopoProfileAction>emptySet());
next = dynamicState.withState(MachineState.KILL_AND_RELAUNCH).withProfileActions(mod, Collections.emptySet()); break;