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

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

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

Message.getTgtName介绍

[英]Get the name of the target instance
[中]获取目标实例的名称

代码示例

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

  1. /**
  2. * Check if this message is targetted for a controller
  3. * @return true if this is a controller message, false otherwise
  4. */
  5. public boolean isControlerMsg() {
  6. return getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name());
  7. }

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

  1. @Transition(to = "SLAVE", from = "MASTER")
  2. public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. System.out.println(instanceName + " becomes SLAVE from MASTER for " + partitionName);
  6. }

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

  1. @Transition(to = "OFFLINE", from = "ERROR")
  2. public void onBecomeOfflineFromError(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. System.out.println(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
  6. }

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

  1. @Deprecated
  2. public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
  3. String additionalInfo, HelixDataAccessor accessor) {
  4. try {
  5. ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
  6. publishStatusUpdateRecord(record, message, level, accessor,
  7. message.getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name()));
  8. } catch (Exception e) {
  9. _logger.error("Exception while logging status update", e);
  10. }
  11. }

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

  1. @Transition(to = "MASTER", from = "SLAVE")
  2. public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. System.out.println(instanceName + " becomes MASTER from SLAVE for " + partitionName);
  6. }

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

  1. @Deprecated
  2. public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
  3. String additionalInfo, HelixDataAccessor accessor) {
  4. try {
  5. ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
  6. publishStatusUpdateRecord(record, message, level, accessor,
  7. message.getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name()));
  8. } catch (Exception e) {
  9. _logger.error("Exception while logging status update", e);
  10. }
  11. }

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

  1. @Override
  2. public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
  3. String clusterName = message.getPartitionName();
  4. String controllerName = message.getTgtName();
  5. logger.info(controllerName + " becoming standby from leader for " + clusterName);
  6. if (_controller != null) {
  7. reset();
  8. logStateTransition("LEADER", "STANDBY", clusterName, controllerName);
  9. } else {
  10. logger.error("No controller exists for " + clusterName);
  11. }
  12. }

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

  1. @Override
  2. public void onBecomeOfflineFromStandby(Message message, NotificationContext context) {
  3. logStateTransition("STANDBY", "OFFLINE", message.getPartitionName(), message.getTgtName());
  4. }

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

  1. @Override
  2. public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
  3. String clusterName = message.getPartitionName();
  4. String controllerName = message.getTgtName();
  5. logger.info(controllerName + " becoming standby from leader for " + clusterName);
  6. if (_controller != null) {
  7. reset();
  8. logStateTransition("LEADER", "STANDBY", clusterName, controllerName);
  9. } else {
  10. logger.error("No controller exists for " + clusterName);
  11. }
  12. }

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

  1. @Override
  2. public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  3. reset();
  4. logStateTransition("OFFLINE", "DROPPED", message == null ? "" : message.getPartitionName(),
  5. message == null ? "" : message.getTgtName());
  6. }

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

  1. @Override
  2. public void doTransition(Message message, NotificationContext context)
  3. throws InterruptedException {
  4. String instance = message.getTgtName();
  5. String partition = message.getPartitionName();
  6. if (instance.equals("localhost_12918") && partition.equals("TestDB0_0")
  7. && _done.getAndSet(true) == false) {
  8. _startCountdown.countDown();
  9. // this await will be interrupted since we cancel the task during handleNewSession
  10. _endCountdown.await();
  11. }
  12. }
  13. }

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

  1. @Override
  2. public void rollbackOnError(Message message, NotificationContext context,
  3. StateTransitionError error) {
  4. reset();
  5. logger.info("{} rolled back on error. Code: {}, Exception: {}",
  6. getStateModeInstanceDescription(message == null ? "" : message.getPartitionName(),
  7. message == null ? "" : message.getTgtName()), error == null ? "" : error.getCode(),
  8. error == null ? "" : error.getException());
  9. }

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

  1. @Override
  2. public void rollbackOnError(Message message, NotificationContext context,
  3. StateTransitionError error) {
  4. reset();
  5. logger.info("{} rolled back on error. Code: {}, Exception: {}",
  6. getStateModeInstanceDescription(message == null ? "" : message.getPartitionName(),
  7. message == null ? "" : message.getTgtName()), error == null ? "" : error.getCode(),
  8. error == null ? "" : error.getException());
  9. }

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

  1. @Transition(to = "OFFLINE", from = "DROPPED")
  2. public void onBecomeOfflineFromDropped(
  3. Message message, NotificationContext context) {
  4. reset();
  5. logStateTransition("DROPPED", "OFFLINE", message == null ? "" : message.getPartitionName(),
  6. message == null ? "" : message.getTgtName());
  7. }

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

  1. @Transition(to = "OFFLINE", from = "ERROR")
  2. public void onBecomeOfflineFromError(Message message, NotificationContext context) {
  3. reset();
  4. logStateTransition("ERROR", "OFFLINE", message == null ? "" : message.getPartitionName(),
  5. message == null ? "" : message.getTgtName());
  6. }

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

  1. @Transition(to = "MASTER", from = "SLAVE")
  2. public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. LOGGER.info(instanceName + " becomes MASTER from SLAVE for " + partitionName);
  6. }

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

  1. @Transition(to = "SLAVE", from = "MASTER")
  2. public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. LOGGER.info(instanceName + " becomes SLAVE from MASTER for " + partitionName);
  6. }

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

  1. @Transition(to = "OFFLINE", from = "ERROR")
  2. public void onBecomeOfflineFromError(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. LOGGER.info(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
  6. }
  7. }

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

  1. @Transition(to = "OFFLINE", from = "SLAVE")
  2. public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
  3. String partitionName = message.getPartitionName();
  4. String instanceName = message.getTgtName();
  5. LOGGER.info(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
  6. }

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

  1. public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  2. MockProcess.sleep(_transDelay);
  3. logger.info(
  4. "MockStateModel.onBecomeOfflineFromOnline(), resource " + message.getResourceName()
  5. + ", partition"
  6. + message.getPartitionName() + ", targetName: " + message.getTgtName());
  7. try {
  8. Thread.sleep(1);
  9. } catch (InterruptedException e) {
  10. e.printStackTrace();
  11. }
  12. verifyMessage(message);
  13. }

相关文章