private Map<String, CurrentState> generateCurrentStateMap( Map<String, CurrentStateInfo> currentStateRawData) { Map<String, CurrentState> currentStateMap = new HashMap<String, CurrentState>(); for (String instanceName : currentStateRawData.keySet()) { CurrentStateInfo info = currentStateRawData.get(instanceName); CurrentState currentState = new CurrentState(TEST_RESOURCE); currentState.setSessionId(SESSION_PREFIX + instanceName.split("_")[1]); currentState.setState(PARTITION, info.currentState); currentState.setPreviousState(PARTITION, info.previousState); currentState.setStartTime(PARTITION, info.startTime); currentState.setEndTime(PARTITION, info.endTime); currentStateMap.put(instanceName, currentState); } return currentStateMap; }
@Override public ZNRecord update(ZNRecord currentData) { CurrentState curState = null; if (currentData == null) { curState = new CurrentState(_lastCurState.getId()); // copy all simple fields settings and overwrite session-id to current session curState.getRecord().setSimpleFields(_lastCurState.getRecord().getSimpleFields()); curState.setSessionId(_curSessionId); } else { curState = new CurrentState(currentData); } for (String partitionName : _lastCurState.getPartitionStateMap().keySet()) { // carry-over only when current-state not exist if (curState.getState(partitionName) == null) { curState.setState(partitionName, _initState); } } return curState.getRecord(); }
@Override public ZNRecord update(ZNRecord currentData) { CurrentState curState = null; if (currentData == null) { curState = new CurrentState(_lastCurState.getId()); // copy all simple fields settings and overwrite session-id to current session curState.getRecord().setSimpleFields(_lastCurState.getRecord().getSimpleFields()); curState.setSessionId(_curSessionId); } else { curState = new CurrentState(currentData); } for (String partitionName : _lastCurState.getPartitionStateMap().keySet()) { // carry-over only when current-state not exist if (curState.getState(partitionName) == null) { curState.setState(partitionName, _initState); } } return curState.getRecord(); }
metaCurState.setBucketSize(message.getBucketSize()); metaCurState.setStateModelDefRef(message.getStateModelDef()); metaCurState.setSessionId(sessionId); metaCurState.setBatchMessageMode(message.getBatchMessageMode()); String ftyName = message.getStateModelFactoryName();
metaCurState.setBucketSize(message.getBucketSize()); metaCurState.setStateModelDefRef(message.getStateModelDef()); metaCurState.setSessionId(sessionId); metaCurState.setBatchMessageMode(message.getBatchMessageMode()); String ftyName = message.getStateModelFactoryName();
private void setCurrentState(String clusterName, String instance, String resourceGroupName, String resourceKey, String sessionId, String state, boolean updateTimestamp) { ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient)); Builder keyBuilder = accessor.keyBuilder(); CurrentState curState = new CurrentState(resourceGroupName); curState.setState(resourceKey, state); curState.setSessionId(sessionId); curState.setStateModelDefRef("MasterSlave"); if (updateTimestamp) { curState.setEndTime(resourceKey, System.currentTimeMillis()); } accessor.setProperty(keyBuilder.currentState(instance, sessionId, resourceGroupName), curState); }
currentStateDelta.setSessionId(sessionId); currentStateDelta.setStateModelDefRef(stateModelName); currentStateDelta.setStateModelFactoryName(factoryName);
currentStateDelta.setSessionId(sessionId); currentStateDelta.setStateModelDefRef(stateModelName); currentStateDelta.setStateModelFactoryName(factoryName);
curState.setSessionId("sessionId"); curState.setStateModelDefRef("StateModelDef"); accessor.setProperty(keyBuilder.currentState("localhost_8900", testHelixManager.getSessionId(),
stateWithLiveSession.setSessionId("session_3"); stateWithLiveSession.setStateModelDefRef("MasterSlave"); stateWithLiveSession.setState("testResourceName_1", "OFFLINE"); ZNRecord record2 = new ZNRecord("testResourceName"); CurrentState stateWithDeadSession = new CurrentState(record2); stateWithDeadSession.setSessionId("session_dead"); stateWithDeadSession.setStateModelDefRef("MasterSlave"); stateWithDeadSession.setState("testResourceName_1", "MASTER");