public void assignedTablet(KeyExtent extent) { if (extent.isMeta()) { if (getMasterState().equals(MasterState.UNLOAD_ROOT_TABLET)) { setMasterState(MasterState.UNLOAD_METADATA_TABLETS); } } if (extent.isRootTablet()) { // probably too late, but try anyhow if (getMasterState().equals(MasterState.STOP)) { setMasterState(MasterState.UNLOAD_ROOT_TABLET); } } }
synchronized void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from {} to {}", state, newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance(getConfiguration()).schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100L, 1000L); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false;
public void assignedTablet(KeyExtent extent) { if (extent.isMeta()) { if (getMasterState().equals(MasterState.UNLOAD_ROOT_TABLET)) { setMasterState(MasterState.UNLOAD_METADATA_TABLETS); } } if (extent.isRootTablet()) { // probably too late, but try anyhow if (getMasterState().equals(MasterState.STOP)) { setMasterState(MasterState.UNLOAD_ROOT_TABLET); } } }
synchronized private void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from " + state + " to " + newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance().schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100l, 1000l); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
synchronized void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from " + state + " to " + newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance(getConfiguration()).schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100l, 1000l); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false;