Java Code Examples for org.apache.catalina.tribes.group.AbsoluteOrder#absoluteOrder()

The following examples show how to use org.apache.catalina.tribes.group.AbsoluteOrder#absoluteOrder() . 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 5 votes vote down vote up
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);

}
 
Example 2
Source File: StaticMembershipInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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
}
 
Example 3
Source File: Arrays.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public static Member[] merge(Member[] m1, Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    ArrayList<Member> list = new ArrayList<>(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;
}
 
Example 4
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
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);
    
}
 
Example 5
Source File: StaticMembershipInterceptor.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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
}
 
Example 6
Source File: Arrays.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
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);
    
}
 
Example 8
Source File: StaticMembershipInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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
}
 
Example 9
Source File: Arrays.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: Arrays.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public static boolean sameMembers(Member[] m1, Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    return equals(m1,m2);
}
 
Example 11
Source File: Arrays.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public static boolean sameMembers(Member[] m1, Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    return equals(m1,m2);
}
 
Example 12
Source File: Arrays.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public static boolean sameMembers(Member[] m1, Member[] m2) {
    AbsoluteOrder.absoluteOrder(m1);
    AbsoluteOrder.absoluteOrder(m2);
    return equals(m1,m2);
}