本文整理汇总了Java中com.hazelcast.core.Member.localMember方法的典型用法代码示例。如果您正苦于以下问题:Java Member.localMember方法的具体用法?Java Member.localMember怎么用?Java Member.localMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.core.Member
的用法示例。
在下文中一共展示了Member.localMember方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doOther
import com.hazelcast.core.Member; //导入方法依赖的package包/类
/**
* @param commandId
* @param clusterMessage
* @since 1.0
*/
private void doOther(short commandId, MyClusterMessage clusterMessage, Member member) {
logger.debug("MyClusterMessageListener#doOther");
IMHeader header = clusterMessage.getHeader();
try {
MessageLite body = clusterMessage.getMessage();
switch (commandId) {
case OtherCmdID.CID_OTHER_SERVER_KICK_USER_VALUE:
if (!member.localMember()) {
handleKickUser(body);
}
break;
case OtherCmdID.CID_OTHER_LOGIN_STATUS_NOTIFY_VALUE:
if (!member.localMember()) {
handlePCLoginStatusNotify(header, body);
}
break;
case OtherCmdID.CID_OTHER_HEARTBEAT_VALUE:// 无需实现
break;
case OtherCmdID.CID_OTHER_ROLE_SET_VALUE:// 目前不需要实现
break;
default:
logger.warn("Unsupport command id {}", commandId);
break;
}
} catch (IOException e) {
logger.error("decode failed.", e);
}
}
示例2: lookupManagedNodes
import com.hazelcast.core.Member; //导入方法依赖的package包/类
private static void lookupManagedNodes(HazelcastInstance hzInstance) {
SchemaManagement sMgr = context.getBean("schemaService", SchemaManagement.class);
for (Member member: hzInstance.getCluster().getMembers()) {
if (!member.localMember()) {
sMgr.initMember(member);
}
}
}
示例3: isLeader
import com.hazelcast.core.Member; //导入方法依赖的package包/类
/**
* Check whether current node is the leader or not.
*
* @return boolean
*/
@Override
public boolean isLeader() {
HazelcastInstance hazelcastInstance = BPELServiceComponent.getHazelcastInstance();
Member leader = hazelcastInstance.getCluster().getMembers().iterator().next();
if (leader.localMember()) {
return true;
}
return false;
}
示例4: memberRemoved
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
HazelcastInstance hazelcastInstance = BPELServiceComponent.getHazelcastInstance();
Member leader = hazelcastInstance.getCluster().getMembers().iterator().next();
// Allow Leader to update distributed map.
if (leader.localMember()) {
String leftMemberID = getHazelCastNodeID(membershipEvent.getMember());
hazelcastInstance.getMap(BPELConstants.BPS_CLUSTER_NODE_MAP).remove(leftMemberID);
}
}
示例5: isCoordinator
import com.hazelcast.core.Member; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean isCoordinator() {
Member oldestMember = hazelcastInstance.getCluster().getMembers().iterator().next();
return oldestMember.localMember();
}
示例6: onMessage
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@Override
public void onMessage(Message<MyClusterMessage> message) {
MyClusterMessage clusterMessage = message.getMessageObject();
Member member = message.getPublishingMember();
logger.debug("Length:{}, ServiceID:{}, CommandID:{}, Body:{}", clusterMessage.getLength(),
clusterMessage.getServiceId(), clusterMessage.getCommandId(), clusterMessage.getBody());
// 根据不同的消息,做不同的处理
// 处理请求分发
switch (clusterMessage.getServiceId()) {
case IMBaseDefine.ServiceID.SID_BUDDY_LIST_VALUE:
this.doBuddyList(clusterMessage.getCommandId(), clusterMessage);
break;
case IMBaseDefine.ServiceID.SID_MSG_VALUE:
if (!member.localMember()) {
// 不处理当前node的消息
this.doMessage(clusterMessage.getCommandId(), clusterMessage);
}
break;
case IMBaseDefine.ServiceID.SID_OTHER_VALUE:
this.doOther(clusterMessage.getCommandId(), clusterMessage, member);
break;
case IMBaseDefine.ServiceID.SID_SWITCH_SERVICE_VALUE:
if (!member.localMember()) {
this.doSwitch(clusterMessage.getCommandId(), clusterMessage);
}
break;
case IMBaseDefine.ServiceID.SID_FILE_VALUE:
this.doFile(clusterMessage.getCommandId(), clusterMessage);
break;
case IMBaseDefine.ServiceID.SID_GROUP_VALUE:
if (!member.localMember()) {
this.doGroup(clusterMessage.getCommandId(), clusterMessage);
}
break;
default:
logger.warn("暂不支持的服务ID{}", clusterMessage.getServiceId());
break;
}
}