当前位置: 首页>>代码示例>>Java>>正文


Java Message.getTgtName方法代码示例

本文整理汇总了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);
  }

}
 
开发者ID:apache,项目名称:helix,代码行数:22,代码来源:DistClusterControllerStateModel.java

示例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);
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:17,代码来源:TestSessionExpiryInTransition.java

示例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);
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:14,代码来源:ClusterDataCache.java

示例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);
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:15,代码来源:DistClusterControllerStateModel.java

示例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);

}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:DistClusterControllerStateModel.java

示例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;
  }

}
 
开发者ID:apache,项目名称:helix,代码行数:15,代码来源:DistClusterControllerStateModel.java

示例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();
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:13,代码来源:TestParticipantManager.java

示例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++;
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:29,代码来源:TestEnablePartitionDuringDisable.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:DummyParticipant.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:TestMessageThrottle2.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:DummyParticipant.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:DummyParticipant.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:DummyParticipant.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:DummyParticipant.java

示例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);
}
 
开发者ID:apache,项目名称:helix,代码行数:7,代码来源:TestMessageThrottle2.java


注:本文中的org.apache.helix.model.Message.getTgtName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。