Java Code Examples for org.apache.catalina.tribes.membership.MemberImpl#equals()

The following examples show how to use org.apache.catalina.tribes.membership.MemberImpl#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected void handleToken(CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    MemberImpl local = (MemberImpl)getLocalMember(false);
    if ( local.equals(msg.getSource()) ) {
        //my message msg.src=local
        handleMyToken(local, msg, sender,merged);
    } else {
        handleOtherToken(local, msg, sender,merged);
    }
}
 
Example 4
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected void handleOtherToken(MemberImpl local, CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //I am the new leader
        //startElection(false);
    } else {
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
Example 5
Source File: Arrays.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static Member[] diff(Membership complete, Membership local, MemberImpl ignore) {
    ArrayList<Member> result = new ArrayList<Member>();
    MemberImpl[] comp = complete.getMembers();
    for ( int i=0; i<comp.length; i++ ) {
        if ( ignore!=null && ignore.equals(comp[i]) ) continue;
        if ( local.getMember(comp[i]) == null ) result.add(comp[i]);
    }
    return result.toArray(new MemberImpl[result.size()]);
}
 
Example 6
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
protected void handleToken(CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    MemberImpl local = (MemberImpl)getLocalMember(false);
    if ( local.equals(msg.getSource()) ) {
        //my message msg.src=local
        handleMyToken(local, msg, sender,merged);
    } else {
        handleOtherToken(local, msg, sender,merged);
    }
}
 
Example 7
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
protected void handleOtherToken(MemberImpl local, CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //I am the new leader
        //startElection(false);
    } else {
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
Example 8
Source File: Arrays.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static Member[] diff(Membership complete, Membership local, MemberImpl ignore) {
    ArrayList<Member> result = new ArrayList<Member>();
    MemberImpl[] comp = complete.getMembers();
    for ( int i=0; i<comp.length; i++ ) {
        if ( ignore!=null && ignore.equals(comp[i]) ) continue;
        if ( local.getMember(comp[i]) == null ) result.add(comp[i]);
    }
    return result.toArray(new MemberImpl[result.size()]);
}