本文整理了Java中org.apache.helix.model.Message.getTgtName()
方法的一些代码示例,展示了Message.getTgtName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getTgtName()
方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:getTgtName
[英]Get the name of the target instance
[中]获取目标实例的名称
代码示例来源:origin: org.apache.helix/helix-core
/**
* Check if this message is targetted for a controller
* @return true if this is a controller message, false otherwise
*/
public boolean isControlerMsg() {
return getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name());
}
代码示例来源:origin: org.apache.helix/helix-core
@Transition(to = "SLAVE", from = "MASTER")
public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes SLAVE from MASTER for " + partitionName);
}
代码示例来源:origin: apache/helix
@Transition(to = "OFFLINE", from = "ERROR")
public void onBecomeOfflineFromError(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
}
代码示例来源:origin: org.apache.helix/helix-core
@Deprecated
public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
String additionalInfo, HelixDataAccessor accessor) {
try {
ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
publishStatusUpdateRecord(record, message, level, accessor,
message.getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name()));
} catch (Exception e) {
_logger.error("Exception while logging status update", e);
}
}
代码示例来源:origin: org.apache.helix/helix-core
@Transition(to = "MASTER", from = "SLAVE")
public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes MASTER from SLAVE for " + partitionName);
}
代码示例来源:origin: apache/helix
@Deprecated
public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
String additionalInfo, HelixDataAccessor accessor) {
try {
ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
publishStatusUpdateRecord(record, message, level, accessor,
message.getTgtName().equalsIgnoreCase(InstanceType.CONTROLLER.name()));
} catch (Exception e) {
_logger.error("Exception while logging status update", e);
}
}
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
String clusterName = message.getPartitionName();
String controllerName = message.getTgtName();
logger.info(controllerName + " becoming standby from leader for " + clusterName);
if (_controller != null) {
reset();
logStateTransition("LEADER", "STANDBY", clusterName, controllerName);
} else {
logger.error("No controller exists for " + clusterName);
}
}
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void onBecomeOfflineFromStandby(Message message, NotificationContext context) {
logStateTransition("STANDBY", "OFFLINE", message.getPartitionName(), message.getTgtName());
}
代码示例来源:origin: apache/helix
@Override
public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
String clusterName = message.getPartitionName();
String controllerName = message.getTgtName();
logger.info(controllerName + " becoming standby from leader for " + clusterName);
if (_controller != null) {
reset();
logStateTransition("LEADER", "STANDBY", clusterName, controllerName);
} else {
logger.error("No controller exists for " + clusterName);
}
}
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
reset();
logStateTransition("OFFLINE", "DROPPED", message == null ? "" : message.getPartitionName(),
message == null ? "" : message.getTgtName());
}
代码示例来源:origin: apache/helix
@Override
public void doTransition(Message message, NotificationContext context)
throws InterruptedException {
String instance = message.getTgtName();
String partition = message.getPartitionName();
if (instance.equals("localhost_12918") && partition.equals("TestDB0_0")
&& _done.getAndSet(true) == false) {
_startCountdown.countDown();
// this await will be interrupted since we cancel the task during handleNewSession
_endCountdown.await();
}
}
}
代码示例来源:origin: apache/helix
@Override
public void rollbackOnError(Message message, NotificationContext context,
StateTransitionError error) {
reset();
logger.info("{} rolled back on error. Code: {}, Exception: {}",
getStateModeInstanceDescription(message == null ? "" : message.getPartitionName(),
message == null ? "" : message.getTgtName()), error == null ? "" : error.getCode(),
error == null ? "" : error.getException());
}
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void rollbackOnError(Message message, NotificationContext context,
StateTransitionError error) {
reset();
logger.info("{} rolled back on error. Code: {}, Exception: {}",
getStateModeInstanceDescription(message == null ? "" : message.getPartitionName(),
message == null ? "" : message.getTgtName()), error == null ? "" : error.getCode(),
error == null ? "" : error.getException());
}
代码示例来源:origin: org.apache.helix/helix-core
@Transition(to = "OFFLINE", from = "DROPPED")
public void onBecomeOfflineFromDropped(
Message message, NotificationContext context) {
reset();
logStateTransition("DROPPED", "OFFLINE", message == null ? "" : message.getPartitionName(),
message == null ? "" : message.getTgtName());
}
代码示例来源:origin: apache/helix
@Transition(to = "OFFLINE", from = "ERROR")
public void onBecomeOfflineFromError(Message message, NotificationContext context) {
reset();
logStateTransition("ERROR", "OFFLINE", message == null ? "" : message.getPartitionName(),
message == null ? "" : message.getTgtName());
}
代码示例来源:origin: apache/helix
@Transition(to = "MASTER", from = "SLAVE")
public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
LOGGER.info(instanceName + " becomes MASTER from SLAVE for " + partitionName);
}
代码示例来源:origin: apache/helix
@Transition(to = "SLAVE", from = "MASTER")
public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
LOGGER.info(instanceName + " becomes SLAVE from MASTER for " + partitionName);
}
代码示例来源:origin: apache/helix
@Transition(to = "OFFLINE", from = "ERROR")
public void onBecomeOfflineFromError(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
LOGGER.info(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
}
}
代码示例来源:origin: apache/helix
@Transition(to = "OFFLINE", from = "SLAVE")
public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
LOGGER.info(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
}
代码示例来源:origin: apache/helix
public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
MockProcess.sleep(_transDelay);
logger.info(
"MockStateModel.onBecomeOfflineFromOnline(), resource " + message.getResourceName()
+ ", partition"
+ message.getPartitionName() + ", targetName: " + message.getTgtName());
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
verifyMessage(message);
}
内容来源于网络,如有侵权,请联系作者删除!