Java Code Examples for org.apache.catalina.tribes.membership.Membership#getMembers()
The following examples show how to use
org.apache.catalina.tribes.membership.Membership#getMembers() .
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 Tomcat8-Source-Read with MIT License | 6 votes |
protected void handleMyToken(Member local, CoordinationMessage msg, 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, 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 Tomcat7.0.67 with Apache License 2.0 | 6 votes |
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 tomcatsrc with Apache License 2.0 | 6 votes |
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 4
Source File: NonBlockingCoordinator.java From Tomcat8-Source-Read with MIT License | 5 votes |
private CoordinationMessage createElectionMsg(Member local, Member[] others, Member leader) { Membership m = new Membership(local,AbsoluteOrder.comp,true); Arrays.fill(m,others); Member[] mbrs = m.getMembers(); m.reset(); CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST); return msg; }
Example 5
Source File: NonBlockingCoordinator.java From Tomcat8-Source-Read with MIT License | 5 votes |
protected void handleOtherToken(Member local, CoordinationMessage msg, 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 6
Source File: Arrays.java From Tomcat8-Source-Read with MIT License | 5 votes |
public static Member[] diff(Membership complete, Membership local, Member ignore) { ArrayList<Member> result = new ArrayList<>(); Member[] 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 Member[result.size()]); }
Example 7
Source File: NonBlockingCoordinator.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
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; }
Example 8
Source File: NonBlockingCoordinator.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
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 9
Source File: Arrays.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
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 10
Source File: NonBlockingCoordinator.java From tomcatsrc with Apache License 2.0 | 5 votes |
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; }
Example 11
Source File: NonBlockingCoordinator.java From tomcatsrc with Apache License 2.0 | 5 votes |
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 12
Source File: Arrays.java From tomcatsrc with Apache License 2.0 | 5 votes |
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()]); }