當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。