Package com.linkedin.helix.model

Examples of com.linkedin.helix.model.CurrentState


    Builder keyBuilder = accessor.keyBuilder();

    String instanceName = manager.getInstanceName();
    String partition = _message.getPartitionName();
    String resourceName = _message.getResourceName();
    CurrentState currentStateDelta = new CurrentState(resourceName);

    StateTransitionError error = new StateTransitionError(type, code, e);
    _stateModel.rollbackOnError(_message, _notificationContext, error);
    // if the transition is not canceled, it should go into error state
    if (code == ErrorCode.ERROR)
    {
      currentStateDelta.setState(partition, "ERROR");
      _stateModel.updateState("ERROR");

      accessor.updateProperty(keyBuilder.currentState(instanceName,
                                                      _message.getTgtSessionId(),
                                                      resourceName),
View Full Code Here


  {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient));
    Builder keyBuilder = accessor.keyBuilder();

    CurrentState curState = new CurrentState(resourceGroupName);
    curState.setState(resourceKey, state);
    curState.setSessionId(sessionId);
    curState.setStateModelDefRef("MasterSlave");
    accessor.setProperty(keyBuilder.currentState(instance, sessionId, resourceGroupName),
                         curState);
  }
View Full Code Here

    accessor.setProperty(keyBuilder.externalView("db-12345"), extView);
    Thread.sleep(100);
    AssertJUnit.assertTrue(testListener.externalViewChangeReceived);
    testListener.Reset();

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

    IdealState idealState = new IdealState("db-1234");
View Full Code Here

        generator.generateConfigForMasterSlave());
    Builder keyBuilder = accessor.keyBuilder();
    accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);

    context = new NotificationContext(manager);
    CurrentState currentStateDelta = new CurrentState("TestDB");
    currentStateDelta.setState("TestDB_0", "OFFLINE");

    HelixStateTransitionHandler stHandler = new HelixStateTransitionHandler(stateModel, message,
        context, currentStateDelta, executor);
    HelixTask handler;
    handler = new HelixTask(message, context, stHandler, executor);
View Full Code Here

    accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);


    context = new NotificationContext(manager);
   
    CurrentState currentStateDelta = new CurrentState("TestDB");
    currentStateDelta.setState("TestDB_0", "OFFLINE");

    HelixStateTransitionHandler stHandler = new HelixStateTransitionHandler(stateModel, message,
        context, currentStateDelta, executor);

    HelixTask handler = new HelixTask(message, context, stHandler, executor);
View Full Code Here

    Set<String> orphanedPartitions = new HashSet<String>();
    orphanedPartitions.addAll(idealState.getPartitionSet());
    // Go through all current states and fill the assignments
    for (String liveInstanceName : liveInstances)
    {
      CurrentState currentState =
          cache.getCurrentState(liveInstanceName,
                                cache.getLiveInstances()
                                     .get(liveInstanceName)
                                     .getSessionId()).get(idealState.getId());
      if (currentState != null)
      {
        Map<String, String> partitionStates = currentState.getPartitionStateMap();
        for (String partitionName : partitionStates.keySet())
        {
          String state = partitionStates.get(partitionName);
          if (state.equals(topStateValue))
          {
View Full Code Here

      for (String previousSessionId : subPaths)
      {
        if (filePropertyStore.exists(path + "/" + previousSessionId + "/" + resourceName))
        {
          CurrentState previousCurrentState =
              accessor.getProperty(CurrentState.class,
                                   PropertyType.CURRENTSTATES,
                                   instanceName,
                                   previousSessionId,
                                   resourceName);

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

        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

      stateModelFactory.createAndAddStateModel(partitionKey);
      stateModel = stateModelFactory.getStateModel(partitionKey);
      stateModel.updateState(initState);
    }

    CurrentState currentStateDelta = new CurrentState(resourceName);
    currentStateDelta.setSessionId(sessionId);
    currentStateDelta.setStateModelDefRef(stateModelName);
    currentStateDelta.setStateModelFactoryName(factoryName);
    currentStateDelta.setBucketSize(bucketSize);

    currentStateDelta.setState(partitionKey, (stateModel.getCurrentState() == null)
        ? initState : stateModel.getCurrentState());

    HelixTaskExecutor executor = (HelixTaskExecutor) context.get(NotificationContext.TASK_EXECUTOR_KEY);
   
    return new HelixStateTransitionHandler(stateModel,
View Full Code Here

    NotificationContext context;
    executor.registerMessageHandlerFactory(MessageType.TASK_REPLY.toString(),
                                           new AsyncCallbackService());
    // String clusterName =" testcluster";
    context = new NotificationContext(manager);
    CurrentState currentStateDelta = new CurrentState("TestDB");
    currentStateDelta.setState("TestDB_0", "OFFLINE");
    HelixStateTransitionHandler handler =
        new HelixStateTransitionHandler(stateModel,
                                        message,
                                        context,
                                        currentStateDelta,
View Full Code Here

TOP

Related Classes of com.linkedin.helix.model.CurrentState

Copyright © 2018 www.massapicom. 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.