本文整理汇总了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;
}
示例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.
}
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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>();
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例11: createNewStateModel
import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resource, String stateModelUnit) {
OnlineOfflineStateModel stateModel = new OnlineOfflineStateModel();
return stateModel;
}
示例12: createNewStateModel
import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String partitionName) {
final EmptySegmentOnlineOfflineStateModel SegmentOnlineOfflineStateModel = new EmptySegmentOnlineOfflineStateModel();
return SegmentOnlineOfflineStateModel;
}
示例13: createNewStateModel
import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String partitionName) {
final EmptyBrokerOnlineOfflineStateModel SegmentOnlineOfflineStateModel = new EmptyBrokerOnlineOfflineStateModel();
return SegmentOnlineOfflineStateModel;
}
示例14: createNewStateModel
import org.apache.helix.participant.statemachine.StateModel; //导入依赖的package包/类
@Override
public StateModel createNewStateModel(String resourceName) {
return new BrokerResourceOnlineOfflineStateModel();
}
示例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;
}