微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.catalina.tribes.group.AbsoluteOrder的实例源码

项目:tomcat7    文件NonBlockingCoordinator.java   
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,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);
    }
}
项目:tomcat7    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,Membership merged) throws ChannelException {
    if ( viewId != null && msg.getId().equals(viewId) ) return;//we already have this view
    view = new Membership((MemberImpl)getLocalMember(false),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);
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件NonBlockingCoordinator.java   
protected void handleMyToken(MemberImpl local,msg);
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,membership.getMembers()) ) {
        startElection(false);
    }
}
项目:lazycat    文件NonBlockingCoordinator.java   
protected Membership mergeOnArrive(CoordinationMessage msg,Member sender) {
    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_PRE_MERGE,"Pre merge"));
    MemberImpl local = (MemberImpl) getLocalMember(false);
    Membership merged = new Membership(local,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,"Post merge"));
    return merged;
}
项目:lazycat    文件NonBlockingCoordinator.java   
protected void handleMyToken(MemberImpl local,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(),merged);
        } else {
            // membership change
            suggestedView = new Membership(local,msg);
        }
    } else {
        // leadership change
        suggestedView = null;
        suggestedviewId = null;
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
项目:lazycat    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,Membership merged) throws ChannelException {
    if (viewId != null && msg.getId().equals(viewId))
        return;// we already have this view
    view = new Membership((MemberImpl) getLocalMember(false),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,"Accepted View"));

    if (suggestedviewId == null && hasHigherPriority(merged.getMembers(),membership.getMembers())) {
        startElection(false);
    }
}
项目:lazycat    文件StaticmembershipInterceptor.java   
/**
 * Get all current cluster members
 * 
 * @return all members or empty array
 */
@Override
public Member[] getMembers() {
    if (members.size() == 0)
        return super.getMembers();
    else {
        synchronized (members) {
            Member[] others = super.getMembers();
            Member[] result = new Member[members.size() + others.length];
            for (int i = 0; i < others.length; i++)
                result[i] = others[i];
            for (int i = 0; i < members.size(); i++)
                result[i + others.length] = members.get(i);
            AbsoluteOrder.absoluteOrder(result);
            return result;
        } // sync
    } // end if
}
项目:class-guard    文件NonBlockingCoordinator.java   
protected void handleMyToken(MemberImpl local,msg);
    }
}
项目:class-guard    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,membership.getMembers()) ) {
        startElection(false);
    }
}
项目:apache-tomcat-7.0.57    文件NonBlockingCoordinator.java   
protected void handleMyToken(MemberImpl local,msg);
    }
}
项目:apache-tomcat-7.0.57    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,membership.getMembers()) ) {
        startElection(false);
    }
}
项目:WBSAirback    文件NonBlockingCoordinator.java   
protected void handleMyToken(MemberImpl local,msg);
    }
}
项目:WBSAirback    文件NonBlockingCoordinator.java   
protected void handleViewConf(CoordinationMessage msg,membership.getMembers()) ) {
        startElection(false);
    }
}
项目:tomcat7    文件NonBlockingCoordinator.java   
private CoordinationMessage createElectionMsg(MemberImpl local,MemberImpl[] others,MemberImpl leader) {
    Membership m = new Membership(local,true);
    Arrays.fill(m,others);
    MemberImpl[] mbrs = m.getMembers();
    m.reset(); 
    CoordinationMessage msg = new CoordinationMessage(leader,mbrs,new UniqueId(UUIDGenerator.randomUUID(true)),COORD_REQUEST);
    return msg;
}
项目:tomcat7    文件NonBlockingCoordinator.java   
protected Membership mergeOnArrive(CoordinationMessage msg,"Pre merge"));
    MemberImpl local = (MemberImpl)getLocalMember(false);
    Membership merged = new Membership(local,local);
    for ( int i=0; i<diff.length; i++ ) {
        if (!alive(diff[i])) merged.removeMember((MemberImpl)diff[i]);
        else memberAdded(diff[i],"Post merge"));
    return merged;
}
项目:tomcat7    文件NonBlockingCoordinator.java   
protected boolean hasHigherPriority(Member[] complete,Member[] local) {
    if ( local == null || local.length == 0 ) return false;
    if ( complete == null || complete.length == 0 ) return true;
    AbsoluteOrder.absoluteOrder(complete);
    AbsoluteOrder.absoluteOrder(local);
    return (AbsoluteOrder.comp.compare(complete[0],local[0]) > 0);

}
项目:tomcat7    文件StaticmembershipInterceptor.java   
/**
 * Get all current cluster members
 * @return all members or empty array
 */
@Override
public Member[] getMembers() {
    if ( members.size() == 0 ) return super.getMembers();
    else {
        synchronized (members) {
            Member[] others = super.getMembers();
            Member[] result = new Member[members.size() + others.length];
            for (int i = 0; i < others.length; i++) result[i] = others[i];
            for (int i = 0; i < members.size(); i++) result[i + others.length] = members.get(i);
            AbsoluteOrder.absoluteOrder(result);
            return result;
        }//sync
    }//end if
}
项目:tomcat7    文件SimpleCoordinator.java   
private void installViewWhenStable() {
    int stableCount = 0;

    while (stableCount < 10) {
        if (membershipChanged.compareAndSet(true,false)) {
            stableCount = 0;
        } else {
            stableCount++;
        }
        try {
            TimeUnit.MILLISECONDS.sleep(250);
        } catch (final InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    final Member[] members = getMembers();
    final Member[] view = new Member[members.length+1];
    System.arraycopy(members,view,members.length);
    view[members.length] = getLocalMember(false);
    Arrays.sort(view,AbsoluteOrder.comp);
    if (Arrays.equals(view,this.view)) {
        return;
    }
    this.view = view;
    viewChange(view);
}
项目:tomcat7    文件Arrays.java   
public static Member[] merge(Member[] m1,Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    ArrayList<Member> list =
        new ArrayList<Member>(java.util.Arrays.asList(m1));
    for (int i=0; i<m2.length; i++) if ( !list.contains(m2[i]) ) list.add(m2[i]);
    Member[] result = new Member[list.size()];
    list.toArray(result);
    AbsoluteOrder.absoluteOrder(result);
    return result;
}
项目:apache-tomcat-7.0.73-with-comment    文件NonBlockingCoordinator.java   
private CoordinationMessage createElectionMsg(MemberImpl local,COORD_REQUEST);
    return msg;
}
项目:apache-tomcat-7.0.73-with-comment    文件NonBlockingCoordinator.java   
protected Membership mergeOnArrive(CoordinationMessage msg,"Post merge"));
    return merged;
}
项目:apache-tomcat-7.0.73-with-comment    文件NonBlockingCoordinator.java   
protected boolean hasHigherPriority(Member[] complete,local[0]) > 0);

}
项目:apache-tomcat-7.0.73-with-comment    文件StaticmembershipInterceptor.java   
/**
 * Get all current cluster members
 * @return all members or empty array
 */
@Override
public Member[] getMembers() {
    if ( members.size() == 0 ) return super.getMembers();
    else {
        synchronized (members) {
            Member[] others = super.getMembers();
            Member[] result = new Member[members.size() + others.length];
            for (int i = 0; i < others.length; i++) result[i] = others[i];
            for (int i = 0; i < members.size(); i++) result[i + others.length] = members.get(i);
            AbsoluteOrder.absoluteOrder(result);
            return result;
        }//sync
    }//end if
}
项目:apache-tomcat-7.0.73-with-comment    文件SimpleCoordinator.java   
private void installViewWhenStable() {
    int stableCount = 0;

    while (stableCount < 10) {
        if (membershipChanged.compareAndSet(true,this.view)) {
        return;
    }
    this.view = view;
    viewChange(view);
}
项目:apache-tomcat-7.0.73-with-comment    文件Arrays.java   
public static Member[] merge(Member[] m1,Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    ArrayList<Member> list =
        new ArrayList<Member>(java.util.Arrays.asList(m1));
    for (int i=0; i<m2.length; i++) if ( !list.contains(m2[i]) ) list.add(m2[i]);
    Member[] result = new Member[list.size()];
    list.toArray(result);
    AbsoluteOrder.absoluteOrder(result);
    return result;
}
项目:lazycat    文件NonBlockingCoordinator.java   
private CoordinationMessage createElectionMsg(MemberImpl local,others);
    MemberImpl[] mbrs = m.getMembers();
    m.reset();
    CoordinationMessage msg = new CoordinationMessage(leader,COORD_REQUEST);
    return msg;
}
项目:lazycat    文件NonBlockingCoordinator.java   
protected boolean hasHigherPriority(Member[] complete,Member[] local) {
    if (local == null || local.length == 0)
        return false;
    if (complete == null || complete.length == 0)
        return true;
    AbsoluteOrder.absoluteOrder(complete);
    AbsoluteOrder.absoluteOrder(local);
    return (AbsoluteOrder.comp.compare(complete[0],local[0]) > 0);

}
项目:lazycat    文件NonBlockingCoordinator.java   
public boolean isHighest() {
    Member local = getLocalMember(false);
    if (membership.getMembers().length == 0)
        return true;
    else
        return AbsoluteOrder.comp.compare(local,membership.getMembers()[0]) <= 0;
}
项目:lazycat    文件SimpleCoordinator.java   
private void installViewWhenStable() {
    int stableCount = 0;

    while (stableCount < 10) {
        if (membershipChanged.compareAndSet(true,false)) {
            stableCount = 0;
        } else {
            stableCount++;
        }
        try {
            TimeUnit.MILLISECONDS.sleep(250);
        } catch (final InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    final Member[] members = getMembers();
    final Member[] view = new Member[members.length + 1];
    System.arraycopy(members,this.view)) {
        return;
    }
    this.view = view;
    viewChange(view);
}
项目:lazycat    文件Arrays.java   
public static Member[] merge(Member[] m1,Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    ArrayList<Member> list = new ArrayList<Member>(java.util.Arrays.asList(m1));
    for (int i = 0; i < m2.length; i++)
        if (!list.contains(m2[i]))
            list.add(m2[i]);
    Member[] result = new Member[list.size()];
    list.toArray(result);
    AbsoluteOrder.absoluteOrder(result);
    return result;
}
项目:class-guard    文件NonBlockingCoordinator.java   
private CoordinationMessage createElectionMsg(MemberImpl local,COORD_REQUEST);
    return msg;
}
项目:class-guard    文件NonBlockingCoordinator.java   
protected Membership mergeOnArrive(CoordinationMessage msg,"Post merge"));
    return merged;
}
项目:class-guard    文件NonBlockingCoordinator.java   
protected boolean hasHigherPriority(Member[] complete,local[0]) > 0);

}
项目:class-guard    文件StaticmembershipInterceptor.java   
/**
 * Get all current cluster members
 * @return all members or empty array
 */
@Override
public Member[] getMembers() {
    if ( members.size() == 0 ) return super.getMembers();
    else {
        synchronized (members) {
            Member[] others = super.getMembers();
            Member[] result = new Member[members.size() + others.length];
            for (int i = 0; i < others.length; i++) result[i] = others[i];
            for (int i = 0; i < members.size(); i++) result[i + others.length] = members.get(i);
            AbsoluteOrder.absoluteOrder(result);
            return result;
        }//sync
    }//end if
}
项目:class-guard    文件SimpleCoordinator.java   
private void installViewWhenStable() {
    int stableCount = 0;

    while (stableCount < 10) {
        if (membershipChanged.compareAndSet(true,this.view)) {
        return;
    }
    this.view = view;
    viewChange(view);
}
项目:class-guard    文件Arrays.java   
public static Member[] merge(Member[] m1,Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    ArrayList<Member> list =
        new ArrayList<Member>(java.util.Arrays.asList(m1));
    for (int i=0; i<m2.length; i++) if ( !list.contains(m2[i]) ) list.add(m2[i]);
    Member[] result = new Member[list.size()];
    list.toArray(result);
    AbsoluteOrder.absoluteOrder(result);
    return result;
}
项目:apache-tomcat-7.0.57    文件NonBlockingCoordinator.java   
private CoordinationMessage createElectionMsg(MemberImpl local,COORD_REQUEST);
    return msg;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。