Examples of currentState()


Examples of org.apache.helix.PropertyKey.Builder.currentState()

    }

    // check partition is in ERROR state
    String sessionId = liveInstance.getSessionId();
    CurrentState curState =
        accessor.getProperty(keyBuilder.currentState(instanceName, sessionId, resourceName));
    for (String partitionName : resetPartitionNames) {
      if (!curState.getState(partitionName).equals(HelixDefinedState.ERROR.toString())) {
        throw new HelixException("Can't reset state for " + resourceName + "/" + partitionNames
            + " on " + instanceName + ", because not all " + partitionNames + " are in ERROR state");
      }
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

    }

    // check partition is in ERROR state
    SessionId sessionId = liveInstance.getTypedSessionId();
    CurrentState curState =
        accessor.getProperty(keyBuilder.currentState(instanceName, sessionId.stringify(),
            resourceName));
    for (String partitionName : resetPartitionNames) {
      if (!curState.getState(partitionName).equals(HelixDefinedState.ERROR.toString())) {
        throw new HelixException("Can't reset state for " + resourceName + "/" + partitionNames
            + " on " + instanceName + ", because not all " + partitionNames + " are in ERROR state");
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

    }

    try {
      // Update the ZK current state of the node
      PropertyKey key =
          keyBuilder.currentState(instanceName, sessionId.stringify(), resource.stringify(),
              bucketizer.getBucketName(partitionId.stringify()));
      if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
        // normal message
        accessor.updateProperty(key, _currentStateDelta);
      } else {
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

        // if transit from ERROR state, disable the partition
        if (_message.getTypedFromState().toString()
            .equalsIgnoreCase(HelixDefinedState.ERROR.toString())) {
          disablePartition();
        }
        accessor.updateProperty(keyBuilder.currentState(instanceName, _message
            .getTypedTgtSessionId().stringify(), resourceId.stringify()), currentStateDelta);
      }
    } finally {
      StateTransitionError error = new StateTransitionError(type, code, e);
      _stateModel.rollbackOnError(_message, _notificationContext, error);
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

          && message.getMsgType().equals(Message.MessageType.STATE_TRANSITION.toString())) {
        ResourceId resourceId = message.getResourceId();
        if (!curResourceNames.contains(resourceId.stringify())
            && !createCurStateNames.contains(resourceId.stringify())) {
          createCurStateNames.add(resourceId.stringify());
          createCurStateKeys.add(keyBuilder.currentState(instanceName, sessionId,
              resourceId.stringify()));

          CurrentState metaCurState = new CurrentState(resourceId.stringify());
          metaCurState.setBucketSize(message.getBucketSize());
          metaCurState.setStateModelDefRef(message.getStateModelDef());
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

      for (String instanceName : instanceNames) {
        List<String> sessionIds = accessor.getChildNames(keyBuilder.sessions(instanceName));

        for (String sessionId : sessionIds) {
          CurrentState curState =
              accessor.getProperty(keyBuilder.currentState(instanceName, sessionId, resourceName));

          if (curState != null && curState.getRecord().getMapFields().size() != 0) {
            return false;
          }
        }
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

      // get resource name from partition key: "PARTICIPANT_LEADER_XXX_0"
      String resourceName = _partitionKey.stringify().substring(0, _partitionKey.stringify().lastIndexOf('_'));

      CurrentState curState =
          accessor.getProperty(keyBuilder.currentState(instance, sessionId, resourceName));
      if (curState == null) {
        return;
      }

      String state = curState.getState(_partitionKey.stringify());
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

    CurrentState curState = new CurrentState(resourceGroupName);
    curState.setState(PartitionId.from(resourceKey), State.from(state));
    curState.setSessionId(SessionId.from(sessionId));
    curState.setStateModelDefRef("MasterSlave");
    accessor.setProperty(keyBuilder.currentState(instance, sessionId, resourceGroupName), curState);
  }

}
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

    testListener.Reset();

    CurrentState curState = new CurrentState("db-12345");
    curState.setSessionId(SessionId.from("sessionId"));
    curState.setStateModelDefRef("StateModelDef");
    accessor.setProperty(keyBuilder.currentState("localhost_8900", testHelixManager.getSessionId(),
        curState.getId()), curState);
    Thread.sleep(100);
    AssertJUnit.assertTrue(testListener.currentStateChangeReceived);
    testListener.Reset();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.currentState()

    CurrentState currentState = new CurrentState(oldResource);
    currentState.setState(PartitionId.from("testResourceOld_0"), State.from("OFFLINE"));
    currentState.setState(PartitionId.from("testResourceOld_1"), State.from("SLAVE"));
    currentState.setState(PartitionId.from("testResourceOld_2"), State.from("MASTER"));
    currentState.setStateModelDefRef("MasterSlave");
    accessor.setProperty(keyBuilder.currentState(instanceName, sessionId, oldResource),
        currentState);

    ResourceComputationStage stage = new ResourceComputationStage();
    runStage(event, new ReadClusterDataStage());
    runStage(event, stage);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.