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


Java Member.localMember方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:34,代码来源:MyClusterMessageListener.java

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

示例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;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:15,代码来源:BPELServerImpl.java

示例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);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:11,代码来源:BPELServerImpl.java

示例5: isCoordinator

import com.hazelcast.core.Member; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isCoordinator() {
    Member oldestMember = hazelcastInstance.getCluster().getMembers().iterator().next();

    return oldestMember.localMember();
}
 
开发者ID:wso2,项目名称:andes,代码行数:10,代码来源:HazelcastCoordinationStrategy.java

示例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;
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:43,代码来源:MyClusterMessageListener.java


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