本文整理汇总了Java中org.apache.helix.model.Message.getTgtName方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getTgtName方法的具体用法?Java Message.getTgtName怎么用?Java Message.getTgtName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.model.Message
的用法示例。
在下文中一共展示了Message.getTgtName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBecomeLeaderFromStandby
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "LEADER", from = "STANDBY")
public void onBecomeLeaderFromStandby(Message message, NotificationContext context)
throws Exception {
String clusterName = message.getPartitionName();
String controllerName = message.getTgtName();
logger.info(controllerName + " becomes leader from standby for " + clusterName);
// System.out.println(controllerName + " becomes leader from standby for " + clusterName);
if (_controller == null) {
_controller =
HelixManagerFactory.getZKHelixManager(clusterName, controllerName,
InstanceType.CONTROLLER, _zkAddr);
_controller.connect();
_controller.startTimerTasks();
} else {
logger.error("controller already exists:" + _controller.getInstanceName() + " for "
+ clusterName);
}
}
示例2: doTransition
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public void doTransition(Message message, NotificationContext context) {
MockParticipantManager manager = (MockParticipantManager) context.getManager();
String instance = message.getTgtName();
String partition = message.getPartitionName();
if (instance.equals("localhost_12918") && partition.equals("TestDB0_1") // TestDB0_1 is SLAVE
// on localhost_12918
&& _done.getAndSet(true) == false) {
try {
ZkTestHelper.expireSession(manager.getZkClient());
} catch (Exception e) {
LOG.error("Exception expire zk-session", e);
}
}
}
示例3: cacheMessages
import org.apache.helix.model.Message; //导入方法依赖的package包/类
public void cacheMessages(List<Message> messages) {
for (Message message : messages) {
String instanceName = message.getTgtName();
Map<String, Message> instMsgMap;
if (_messageCache.containsKey(instanceName)) {
instMsgMap = _messageCache.get(instanceName);
} else {
instMsgMap = Maps.newHashMap();
_messageCache.put(instanceName, instMsgMap);
}
instMsgMap.put(message.getId(), message);
}
}
示例4: onBecomeStandbyFromLeader
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "STANDBY", from = "LEADER")
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) {
_controller.disconnect();
_controller = null;
} else {
logger.error("No controller exists for " + clusterName);
}
}
示例5: onBecomeOfflineFromStandby
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "OFFLINE", from = "STANDBY")
public void onBecomeOfflineFromStandby(Message message, NotificationContext context) {
String clusterName = message.getPartitionName();
String controllerName = message.getTgtName();
logger.info(controllerName + " becoming offline from standby for cluster:" + clusterName);
}
示例6: rollbackOnError
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public void rollbackOnError(Message message, NotificationContext context,
StateTransitionError error) {
String clusterName = message.getPartitionName();
String controllerName = message.getTgtName();
logger.error(controllerName + " rollbacks on error for " + clusterName);
if (_controller != null) {
_controller.disconnect();
_controller = null;
}
}
示例7: doTransition
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@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();
}
}
示例8: doTransition
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public void doTransition(Message message, NotificationContext context) {
HelixManager manager = context.getManager();
String clusterName = manager.getClusterName();
String instance = message.getTgtName();
String partitionName = message.getPartitionName();
String fromState = message.getFromState();
String toState = message.getToState();
if (instance.equals("localhost_12919") && partitionName.equals("TestDB0_0")) {
if (fromState.equals("SLAVE") && toState.equals("OFFLINE")) {
slaveToOfflineCnt++;
try {
String command =
"--zkSvr " + ZK_ADDR + " --enablePartition true " + clusterName
+ " localhost_12919 TestDB0 TestDB0_0";
ClusterSetup.processCommandLineArgs(command.split("\\s+"));
} catch (Exception e) {
LOG.error("Exception in cluster setup", e);
}
} else if (slaveToOfflineCnt > 0 && fromState.equals("OFFLINE") && toState.equals("SLAVE")) {
offlineToSlave++;
}
}
}
示例9: onBecomeSlaveFromOffline
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "SLAVE", from = "OFFLINE")
public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes SLAVE from OFFLINE for " + partitionName);
}
示例10: onBecomeOfflineFromError
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@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);
}
示例11: onBecomeSlaveFromMaster
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@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);
}
示例12: onBecomeOfflineFromSlave
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "OFFLINE", from = "SLAVE")
public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
}
示例13: onBecomeDroppedFromOffline
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "DROPPED", from = "OFFLINE")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes DROPPED from OFFLINE for " + partitionName);
}
示例14: onBecomeOfflineFromError
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@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);
}
示例15: onBecomeDroppedFromOffline
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "DROPPED", from = "OFFLINE")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
LOGGER.info(instanceName + " becomes DROPPED from OFFLINE for " + partitionName);
}