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


Java AbsoluteOrder.comp方法代码示例

本文整理汇总了Java中org.apache.catalina.tribes.group.AbsoluteOrder.comp方法的典型用法代码示例。如果您正苦于以下问题:Java AbsoluteOrder.comp方法的具体用法?Java AbsoluteOrder.comp怎么用?Java AbsoluteOrder.comp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.tribes.group.AbsoluteOrder的用法示例。


在下文中一共展示了AbsoluteOrder.comp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMyToken

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected void handleMyToken(MemberImpl local, CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //no leadership change
        if ( Arrays.sameMembers(msg.getMembers(),merged.getMembers()) ) {
            msg.type = COORD_CONF;
            super.sendMessage(Arrays.remove(msg.getMembers(),local),createData(msg,local),null);
            handleViewConf(msg,local,merged);
        } else {
            //membership change
            suggestedView = new Membership(local,AbsoluteOrder.comp,true);
            suggestedviewId = msg.getId();
            Arrays.fill(suggestedView,merged.getMembers());
            msg.view = merged.getMembers();
            sendElectionMsgToNextInline(local,msg);
        }
    } else {
        //leadership change
        suggestedView = null;
        suggestedviewId = null;
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:NonBlockingCoordinator.java

示例2: handleViewConf

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected void handleViewConf(CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( viewId != null && msg.getId().equals(viewId) ) return;//we already have this view
    view = new Membership((MemberImpl)getLocalMember(false),AbsoluteOrder.comp,true);
    Arrays.fill(view,msg.getMembers());
    viewId = msg.getId();
    
    if ( viewId.equals(suggestedviewId) ) {
        suggestedView = null;
        suggestedviewId = null;
    }
    
    if (suggestedView != null && AbsoluteOrder.comp.compare(suggestedView.getMembers()[0],merged.getMembers()[0])<0 ) {
        suggestedView = null;
        suggestedviewId = null;
    }
    
    viewChange(viewId,view.getMembers());
    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_CONF_RX,this,"Accepted View"));
    
    if ( suggestedviewId == null && hasHigherPriority(merged.getMembers(),membership.getMembers()) ) {
        startElection(false);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:NonBlockingCoordinator.java

示例3: mergeOnArrive

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected Membership mergeOnArrive(CoordinationMessage msg, Member sender) {
	fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_PRE_MERGE, this, "Pre merge"));
	MemberImpl local = (MemberImpl) getLocalMember(false);
	Membership merged = new Membership(local, AbsoluteOrder.comp, true);
	Arrays.fill(merged, msg.getMembers());
	Arrays.fill(merged, getMembers());
	Member[] diff = Arrays.diff(merged, membership, local);
	for (int i = 0; i < diff.length; i++) {
		if (!alive(diff[i]))
			merged.removeMember((MemberImpl) diff[i]);
		else
			memberAdded(diff[i], false);
	}
	fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_POST_MERGE, this, "Post merge"));
	return merged;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:NonBlockingCoordinator.java

示例4: handleMyToken

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected void handleMyToken(MemberImpl local, CoordinationMessage msg, Member sender, Membership merged)
		throws ChannelException {
	if (local.equals(msg.getLeader())) {
		// no leadership change
		if (Arrays.sameMembers(msg.getMembers(), merged.getMembers())) {
			msg.type = COORD_CONF;
			super.sendMessage(Arrays.remove(msg.getMembers(), local), createData(msg, local), null);
			handleViewConf(msg, local, merged);
		} else {
			// membership change
			suggestedView = new Membership(local, AbsoluteOrder.comp, true);
			suggestedviewId = msg.getId();
			Arrays.fill(suggestedView, merged.getMembers());
			msg.view = merged.getMembers();
			sendElectionMsgToNextInline(local, msg);
		}
	} else {
		// leadership change
		suggestedView = null;
		suggestedviewId = null;
		msg.view = merged.getMembers();
		sendElectionMsgToNextInline(local, msg);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:25,代码来源:NonBlockingCoordinator.java

示例5: handleViewConf

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected void handleViewConf(CoordinationMessage msg, Member sender, Membership merged) throws ChannelException {
	if (viewId != null && msg.getId().equals(viewId))
		return;// we already have this view
	view = new Membership((MemberImpl) getLocalMember(false), AbsoluteOrder.comp, true);
	Arrays.fill(view, msg.getMembers());
	viewId = msg.getId();

	if (viewId.equals(suggestedviewId)) {
		suggestedView = null;
		suggestedviewId = null;
	}

	if (suggestedView != null
			&& AbsoluteOrder.comp.compare(suggestedView.getMembers()[0], merged.getMembers()[0]) < 0) {
		suggestedView = null;
		suggestedviewId = null;
	}

	viewChange(viewId, view.getMembers());
	fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_CONF_RX, this, "Accepted View"));

	if (suggestedviewId == null && hasHigherPriority(merged.getMembers(), membership.getMembers())) {
		startElection(false);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:NonBlockingCoordinator.java

示例6: createElectionMsg

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
    Membership m = new Membership(local,AbsoluteOrder.comp,true);
    Arrays.fill(m,others);
    MemberImpl[] mbrs = m.getMembers();
    m.reset(); 
    CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
    return msg;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:NonBlockingCoordinator.java

示例7: mergeOnArrive

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
protected Membership mergeOnArrive(CoordinationMessage msg, Member sender) {
    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_PRE_MERGE,this,"Pre merge"));
    MemberImpl local = (MemberImpl)getLocalMember(false);
    Membership merged = new Membership(local,AbsoluteOrder.comp,true);
    Arrays.fill(merged,msg.getMembers());
    Arrays.fill(merged,getMembers());
    Member[] diff = Arrays.diff(merged,membership,local);
    for ( int i=0; i<diff.length; i++ ) {
        if (!alive(diff[i])) merged.removeMember((MemberImpl)diff[i]);
        else memberAdded(diff[i],false);
    }
    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_POST_MERGE,this,"Post merge"));
    return merged;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:NonBlockingCoordinator.java

示例8: createElectionMsg

import org.apache.catalina.tribes.group.AbsoluteOrder; //导入方法依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
	Membership m = new Membership(local, AbsoluteOrder.comp, true);
	Arrays.fill(m, others);
	MemberImpl[] mbrs = m.getMembers();
	m.reset();
	CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,
			new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
	return msg;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:NonBlockingCoordinator.java


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