org.apache.helix.model.Message.setStateModelDef()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.helix.model.Message.setStateModelDef()方法的一些代码示例,展示了Message.setStateModelDef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setStateModelDef()方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:setStateModelDef

Message.setStateModelDef介绍

[英]Set the state model definition name
[中]设置状态模型定义名称

代码示例

代码示例来源:origin: apache/helix

public static Message createMessage(String msgId, String fromState, String toState,
  String tgtName, String resourceName, String partitionName) {
 Message msg = new Message(MessageType.STATE_TRANSITION, msgId);
 msg.setFromState(fromState);
 msg.setToState(toState);
 msg.setTgtName(tgtName);
 msg.setResourceName(resourceName);
 msg.setPartitionName(partitionName);
 msg.setStateModelDef("MasterSlave");
 return msg;
}

代码示例来源:origin: org.apache.helix/helix-core

message.setResourceName(resourceName);
message.setTgtSessionId(sessionId);
message.setStateModelDef(stateModelDef);
message.setFromState(HelixDefinedState.ERROR.toString());
message.setToState(stateModel.getInitialState());

代码示例来源:origin: apache/helix

message.setResourceName(resourceName);
message.setTgtSessionId(sessionId);
message.setStateModelDef(stateModelDef);
message.setFromState(HelixDefinedState.ERROR.toString());
message.setToState(stateModel.getInitialState());

代码示例来源:origin: org.apache.helix/helix-core

private Message createStateTransitionCancellationMessage(HelixManager manager, Resource resource,
  String partitionName, String instanceName, String sessionId, String stateModelDefName,
  String fromState, String toState, String nextState, Message cancellationMessage, boolean isCancellationEnabled,
  String currentState) {
 if (isCancellationEnabled && cancellationMessage == null) {
  LogUtil.logInfo(logger, _eventId,
    "Send cancellation message of the state transition for " + resource.getResourceName()
      + "." + partitionName + " on " + instanceName + ", currentState: " + currentState
      + ", nextState: " + (nextState == null ? "N/A" : nextState));
  String uuid = UUID.randomUUID().toString();
  Message message = new Message(MessageType.STATE_TRANSITION_CANCELLATION, uuid);
  message.setSrcName(manager.getInstanceName());
  message.setTgtName(instanceName);
  message.setMsgState(MessageState.NEW);
  message.setPartitionName(partitionName);
  message.setResourceName(resource.getResourceName());
  message.setFromState(fromState);
  message.setToState(toState);
  message.setTgtSessionId(sessionId);
  message.setSrcSessionId(manager.getSessionId());
  message.setStateModelDef(stateModelDefName);
  message.setStateModelFactoryName(resource.getStateModelFactoryname());
  message.setBucketSize(resource.getBucketSize());
  return message;
 }
 return null;
}

代码示例来源:origin: apache/helix

private Message createStateTransitionCancellationMessage(HelixManager manager, Resource resource,
  String partitionName, String instanceName, String sessionId, String stateModelDefName,
  String fromState, String toState, String nextState, Message cancellationMessage,
  boolean isCancellationEnabled, String currentState) {
 if (isCancellationEnabled && cancellationMessage == null) {
  LogUtil.logInfo(logger, _eventId,
    "Send cancellation message of the state transition for " + resource.getResourceName()
      + "." + partitionName + " on " + instanceName + ", currentState: " + currentState
      + ", nextState: " + (nextState == null ? "N/A" : nextState));
  String uuid = UUID.randomUUID().toString();
  Message message = new Message(MessageType.STATE_TRANSITION_CANCELLATION, uuid);
  message.setSrcName(manager.getInstanceName());
  message.setTgtName(instanceName);
  message.setMsgState(MessageState.NEW);
  message.setPartitionName(partitionName);
  message.setResourceName(resource.getResourceName());
  message.setFromState(fromState);
  message.setToState(toState);
  message.setTgtSessionId(sessionId);
  message.setSrcSessionId(manager.getSessionId());
  message.setStateModelDef(stateModelDefName);
  message.setStateModelFactoryName(resource.getStateModelFactoryname());
  message.setBucketSize(resource.getBucketSize());
  return message;
 }
 return null;
}

代码示例来源:origin: apache/helix

msg.setPartitionName("Partition");
msg.setResourceName("Resource");
msg.setStateModelDef("DummyMasterSlave");
msg.setFromState("SLAVE");
msg.setToState("MASTER");

代码示例来源:origin: apache/helix

private Message createStateTransitionMessage(HelixManager manager, Resource resource,
  String partitionName, String instanceName, String currentState, String nextState,
  String sessionId, String stateModelDefName) {
 String uuid = UUID.randomUUID().toString();
 Message message = new Message(MessageType.STATE_TRANSITION, uuid);
 message.setSrcName(manager.getInstanceName());
 message.setTgtName(instanceName);
 message.setMsgState(MessageState.NEW);
 message.setPartitionName(partitionName);
 message.setResourceName(resource.getResourceName());
 message.setFromState(currentState);
 message.setToState(nextState);
 message.setTgtSessionId(sessionId);
 message.setSrcSessionId(manager.getSessionId());
 message.setStateModelDef(stateModelDefName);
 message.setStateModelFactoryName(resource.getStateModelFactoryname());
 message.setBucketSize(resource.getBucketSize());
 if (resource.getResourceGroupName() != null) {
  message.setResourceGroupName(resource.getResourceGroupName());
 }
 if (resource.getResourceTag() != null) {
  message.setResourceTag(resource.getResourceTag());
 }
 return message;
}

代码示例来源:origin: org.apache.helix/helix-core

private Message createStateTransitionMessage(HelixManager manager, Resource resource, String partitionName,
  String instanceName, String currentState, String nextState, String sessionId,
  String stateModelDefName) {
 String uuid = UUID.randomUUID().toString();
 Message message = new Message(MessageType.STATE_TRANSITION, uuid);
 message.setSrcName(manager.getInstanceName());
 message.setTgtName(instanceName);
 message.setMsgState(MessageState.NEW);
 message.setPartitionName(partitionName);
 message.setResourceName(resource.getResourceName());
 message.setFromState(currentState);
 message.setToState(nextState);
 message.setTgtSessionId(sessionId);
 message.setSrcSessionId(manager.getSessionId());
 message.setStateModelDef(stateModelDefName);
 message.setStateModelFactoryName(resource.getStateModelFactoryname());
 message.setBucketSize(resource.getBucketSize());
 if (resource.getResourceGroupName() != null) {
  message.setResourceGroupName(resource.getResourceGroupName());
 }
 if (resource.getResourceTag() != null) {
  message.setResourceTag(resource.getResourceTag());
 }
 return message;
}

代码示例来源:origin: apache/helix

private Message newMessage(String resourceName, String partitionName, String instanceName,
  String fromState, String toState) {
 String uuid = UUID.randomUUID().toString();
 Message message = new Message(MessageType.STATE_TRANSITION, uuid);
 message.setSrcName("controller");
 message.setTgtName(instanceName);
 message.setMsgState(MessageState.NEW);
 message.setResourceName(resourceName);
 message.setPartitionName(partitionName);
 message.setFromState(fromState);
 message.setToState(toState);
 message.setTgtSessionId("sessionId");
 message.setSrcSessionId("sessionId");
 message.setStateModelDef("MasterSlave");
 message.setStateModelFactoryName("DEFAULT");
 message.setBucketSize(0);
 return message;
}

代码示例来源:origin: apache/helix

private Message generateMessage(String from, String to) {
 String uuid = UUID.randomUUID().toString();
 Message message = new Message(Message.MessageType.STATE_TRANSITION, uuid);
 message.setSrcName("ADMIN");
 message.setTgtName(_participant.getInstanceName());
 message.setMsgState(Message.MessageState.NEW);
 message.setPartitionName("P");
 message.setResourceName(WorkflowGenerator.DEFAULT_TGT_DB);
 message.setFromState(from);
 message.setToState(to);
 message.setTgtSessionId(_participant.getSessionId());
 message.setSrcSessionId(_manager.getSessionId());
 message.setStateModelDef("OnlineOffline");
 message.setStateModelFactoryName("DEFAULT");
 return message;
}

代码示例来源:origin: apache/helix

message.setTgtSessionId(sessionid);
 message.setSrcSessionId(manager.getSessionId());
 message.setStateModelDef("MasterSlave");
 message.setStateModelFactoryName("DEFAULT");
} else if (ev.getStateMap(partition).get(instanceName).equals("SLAVE")) {
 message.setTgtSessionId(sessionid);
 message.setSrcSessionId(manager.getSessionId());
 message.setStateModelDef("MasterSlave");
 message.setStateModelFactoryName("DEFAULT");

代码示例来源:origin: apache/helix

message.setResourceName("TestDB");
message.setTgtName("localhost");
message.setStateModelDef("MasterSlave");
message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
MockStateModelAnnotated stateModel = new MockStateModelAnnotated();

代码示例来源:origin: apache/helix

message.setResourceName("TestDB");
message.setTgtName("localhost");
message.setStateModelDef("MasterSlave");
message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
MockMasterSlaveStateModel stateModel = new MockMasterSlaveStateModel();

代码示例来源:origin: apache/helix

message.setResourceName("testResource");
message.setPartitionName("testPartitionKey");
message.setStateModelDef("MasterSlave");
message.setToState("toState");
message.setFromState("fromState");

代码示例来源:origin: apache/helix

message.setPartitionName("TestDB_0");
message.setResourceName("TestDB");
message.setStateModelDef("MasterSlave");

相关文章