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