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

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

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

Message.setSrcSessionId介绍

[英]Set the session identifier of the source node
[中]设置源节点的会话标识符

代码示例

代码示例来源: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

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.setToState(rand ? "MASTER" : "SLAVE");
message.setTgtSessionId(sessionid);
message.setSrcSessionId(manager.getSessionId());
message.setStateModelDef("MasterSlave");
message.setStateModelFactoryName("DEFAULT");
message.setToState(rand ? "SLAVE" : "SLAVE");
message.setTgtSessionId(sessionid);
message.setSrcSessionId(manager.getSessionId());
message.setStateModelDef("MasterSlave");
message.setStateModelFactoryName("DEFAULT");

相关文章