当前位置: 首页>>代码示例>>Java>>正文


Java StateModel类代码示例

本文整理汇总了Java中org.apache.helix.participant.statemachine.StateModel的典型用法代码示例。如果您正苦于以下问题:Java StateModel类的具体用法?Java StateModel怎么用?Java StateModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StateModel类属于org.apache.helix.participant.statemachine包,在下文中一共展示了StateModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerStateModelFactory

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public boolean registerStateModelFactory(String stateModelName,
    StateModelFactory<? extends StateModel> factory, String factoryName) {
  if (stateModelName == null || factory == null || factoryName == null) {
    throw new HelixException("stateModelDef|stateModelFactory|factoryName cannot be null");
  }

  logger.info("Register state model factory for state model " + stateModelName
      + " using factory name " + factoryName + " with " + factory);

  if (!_stateModelFactoryMap.containsKey(stateModelName)) {
    _stateModelFactoryMap.put(stateModelName,
        new ConcurrentHashMap<String, StateModelFactory<? extends StateModel>>());
  }

  if (_stateModelFactoryMap.get(stateModelName).containsKey(factoryName)) {
    logger.warn("stateModelFactory for " + stateModelName + " using factoryName " + factoryName
        + " has already been registered.");
    return false;
  }

  _stateModelFactoryMap.get(stateModelName).put(factoryName, factory);
  sendNopMessage();
  return true;
}
 
开发者ID:apache,项目名称:helix,代码行数:26,代码来源:HelixStateMachineEngine.java

示例2: reset

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public void reset() {
  for (Map<String, StateModelFactory<? extends StateModel>> ftyMap : _stateModelFactoryMap
      .values()) {
    for (StateModelFactory<? extends StateModel> stateModelFactory : ftyMap.values()) {
      for (String resourceName : stateModelFactory.getResourceSet()) {
        for (String partitionKey : stateModelFactory.getPartitionSet(resourceName)) {
          StateModel stateModel = stateModelFactory.getStateModel(resourceName, partitionKey);
          stateModel.reset();
          String initialState = _stateModelParser.getInitialState(stateModel.getClass());
          stateModel.updateState(initialState);
          // TODO probably should update the state on ZK. Shi confirm what needs
          // to be done here.
        }
      }
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:19,代码来源:HelixStateMachineEngine.java

示例3: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resourceName, String partitionName) {
  MasterSlaveStateModel stateModel = new MasterSlaveStateModel();
  stateModel.setInstanceName(_instanceName);
  stateModel.setDelay(_delay);
  stateModel.setPartitionName(partitionName);
  return stateModel;
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:MasterSlaveStateModelFactory.java

示例4: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resourceName, String stateUnitKey) {
  OnlineOfflineStateModel stateModel = new OnlineOfflineStateModel();
  stateModel.setDelay(_delay);
  stateModel.setInstanceName(_instanceName);
  return stateModel;
}
 
开发者ID:apache,项目名称:helix,代码行数:8,代码来源:OnlineOfflineStateModelFactory.java

示例5: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override public StateModel createNewStateModel(String resourceName, String partitionName) {
  LeaderStandbyStateModel stateModel = new LeaderStandbyStateModel();
  stateModel.setDelay(_delay);
  stateModel.setInstanceName(_instanceName);
  stateModel.setPartitionName(partitionName);
  return stateModel;
}
 
开发者ID:apache,项目名称:helix,代码行数:8,代码来源:LeaderStandbyStateModelFactory.java

示例6: HelixStateMachineEngine

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
public HelixStateMachineEngine(HelixManager manager) {
  _stateModelParser = new StateModelParser();
  _manager = manager;

  _stateModelFactoryMap =
      new ConcurrentHashMap<String, Map<String, StateModelFactory<? extends StateModel>>>();
  _stateModelDefs = new ConcurrentHashMap<String, StateModelDefinition>();
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:HelixStateMachineEngine.java

示例7: getStateModelFactory

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModelFactory<? extends StateModel> getStateModelFactory(String stateModelName,
    String factoryName) {
  if (!_stateModelFactoryMap.containsKey(stateModelName)) {
    return null;
  }
  return _stateModelFactoryMap.get(stateModelName).get(factoryName);
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:HelixStateMachineEngine.java

示例8: HelixStateTransitionHandler

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
public HelixStateTransitionHandler(StateModelFactory<? extends StateModel> stateModelFactory,
    StateModel stateModel, Message message, NotificationContext context,
    CurrentState currentStateDelta) {
  super(message, context);
  _stateModel = stateModel;
  _statusUpdateUtil = new StatusUpdateUtil();
  _transitionMethodFinder = new StateModelParser();
  _currentStateDelta = currentStateDelta;
  _manager = _notificationContext.getManager();
  _stateModelFactory = stateModelFactory;
}
 
开发者ID:apache,项目名称:helix,代码行数:12,代码来源:HelixStateTransitionHandler.java

示例9: checkStateModelMap

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
/**
 * check state-model factory contains state-models same as in expect-state-model map
 * @param fty
 * @param expectStateModelMap
 */
static void checkStateModelMap(StateModelFactory<? extends StateModel> fty,
    Map<String, String> expectStateModelMap) {
  Assert.assertEquals(fty.getPartitionSet("TestDB0").size(), expectStateModelMap.size());
  for (String partition : fty.getPartitionSet("TestDB0")) {
    StateModel stateModel = fty.getStateModel("TestDB0", partition);
    String actualState = stateModel.getCurrentState();
    String expectState = expectStateModelMap.get(partition);
    LOG.debug(partition + " actual state: " + actualState + ", expect state: " + expectState);
    Assert.assertEquals(actualState, expectState, "partition: " + partition
        + " should be in state: " + expectState + " but was " + actualState);
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:18,代码来源:TestStateModelLeak.java

示例10: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resourceName, String stateUnitKey) {
  TestOnlineOfflineStateModel stateModel = new TestOnlineOfflineStateModel(_instanceId);
  stateModel.setDelay(_delay);
  return stateModel;
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:7,代码来源:TestOnlineOfflineStateModelFactory.java

示例11: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resource, String stateModelUnit) {
  OnlineOfflineStateModel stateModel = new OnlineOfflineStateModel();
  return stateModel;
}
 
开发者ID:pinterest-attic,项目名称:terrapin,代码行数:6,代码来源:OnlineOfflineStateModelFactory.java

示例12: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String partitionName) {
  final EmptySegmentOnlineOfflineStateModel SegmentOnlineOfflineStateModel = new EmptySegmentOnlineOfflineStateModel();
  return SegmentOnlineOfflineStateModel;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:6,代码来源:EmptySegmentOnlineOfflineStateModelFactory.java

示例13: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String partitionName) {
  final EmptyBrokerOnlineOfflineStateModel SegmentOnlineOfflineStateModel = new EmptyBrokerOnlineOfflineStateModel();
  return SegmentOnlineOfflineStateModel;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:6,代码来源:EmptyBrokerOnlineOfflineStateModelFactory.java

示例14: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resourceName) {
  return new BrokerResourceOnlineOfflineStateModel();
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:5,代码来源:BrokerResourceOnlineOfflineStateModelFactory.java

示例15: createNewStateModel

import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String partitionName) {
  final SegmentOnlineOfflineStateModel SegmentOnlineOfflineStateModel =
      new SegmentOnlineOfflineStateModel(HELIX_CLUSTER_NAME, INSTANCE_ID);
  return SegmentOnlineOfflineStateModel;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:7,代码来源:SegmentOnlineOfflineStateModelFactory.java


注:本文中的org.apache.helix.participant.statemachine.StateModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。