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

The following examples show how to use org.apache.catalina.tribes.membership.MemberImpl#getMember() . 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
public void parse() {
    //header
    int offset = 16;
    //leader
    int ldrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] ldr = new byte[ldrLen];
    System.arraycopy(buf.getBytesDirect(),offset,ldr,0,ldrLen);
    leader = MemberImpl.getMember(ldr);
    offset += ldrLen;
    //source
    int srcLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] src = new byte[srcLen];
    System.arraycopy(buf.getBytesDirect(),offset,src,0,srcLen);
    source = MemberImpl.getMember(src);
    offset += srcLen;
    //view
    int mbrCount = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    view = new Member[mbrCount];
    for (int i=0; i<view.length; i++ ) {
        int mbrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
        offset += 4;
        byte[] mbr = new byte[mbrLen];
        System.arraycopy(buf.getBytesDirect(), offset, mbr, 0, mbrLen);
        view[i] = MemberImpl.getMember(mbr);
        offset += mbrLen;
    }
    //id
    this.id = new UniqueId(buf.getBytesDirect(),offset,16);
    offset += 16;
    type = new byte[16];
    System.arraycopy(buf.getBytesDirect(), offset, type, 0, type.length);
    offset += 16;

}
 
Example 2
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated  Unused - will be removed in 8.0.x
 */
@Deprecated
protected Member[] readMembers(ObjectInput in) throws IOException {
    int nodecount = in.readInt();
    Member[] members = new Member[nodecount];
    for ( int i=0; i<members.length; i++ ) {
        byte[] d = new byte[in.readInt()];
        in.readFully(d);
        if (d.length > 0) members[i] = MemberImpl.getMember(d);
    }
    return members;
}
 
Example 3
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public void parse() {
    //header
    int offset = 16;
    //leader
    int ldrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] ldr = new byte[ldrLen];
    System.arraycopy(buf.getBytesDirect(),offset,ldr,0,ldrLen);
    leader = MemberImpl.getMember(ldr);
    offset += ldrLen;
    //source
    int srcLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] src = new byte[srcLen];
    System.arraycopy(buf.getBytesDirect(),offset,src,0,srcLen);
    source = MemberImpl.getMember(src);
    offset += srcLen;
    //view
    int mbrCount = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    view = new MemberImpl[mbrCount];
    for (int i=0; i<view.length; i++ ) {
        int mbrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
        offset += 4;
        byte[] mbr = new byte[mbrLen];
        System.arraycopy(buf.getBytesDirect(), offset, mbr, 0, mbrLen);
        view[i] = MemberImpl.getMember(mbr);
        offset += mbrLen;
    }
    //id
    this.id = new UniqueId(buf.getBytesDirect(),offset,16);
    offset += 16;
    type = new byte[16];
    System.arraycopy(buf.getBytesDirect(), offset, type, 0, type.length);
    offset += 16;
    
}
 
Example 4
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated  Unused - will be removed in 8.0.x
 */
@Deprecated
protected Member[] readMembers(ObjectInput in) throws IOException {
    int nodecount = in.readInt();
    Member[] members = new Member[nodecount];
    for ( int i=0; i<members.length; i++ ) {
        byte[] d = new byte[in.readInt()];
        in.readFully(d);
        if (d.length > 0) members[i] = MemberImpl.getMember(d);
    }
    return members;
}
 
Example 5
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public void parse() {
    //header
    int offset = 16;
    //leader
    int ldrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] ldr = new byte[ldrLen];
    System.arraycopy(buf.getBytesDirect(),offset,ldr,0,ldrLen);
    leader = MemberImpl.getMember(ldr);
    offset += ldrLen;
    //source
    int srcLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    byte[] src = new byte[srcLen];
    System.arraycopy(buf.getBytesDirect(),offset,src,0,srcLen);
    source = MemberImpl.getMember(src);
    offset += srcLen;
    //view
    int mbrCount = XByteBuffer.toInt(buf.getBytesDirect(),offset);
    offset += 4;
    view = new MemberImpl[mbrCount];
    for (int i=0; i<view.length; i++ ) {
        int mbrLen = XByteBuffer.toInt(buf.getBytesDirect(),offset);
        offset += 4;
        byte[] mbr = new byte[mbrLen];
        System.arraycopy(buf.getBytesDirect(), offset, mbr, 0, mbrLen);
        view[i] = MemberImpl.getMember(mbr);
        offset += mbrLen;
    }
    //id
    this.id = new UniqueId(buf.getBytesDirect(),offset,16);
    offset += 16;
    type = new byte[16];
    System.arraycopy(buf.getBytesDirect(), offset, type, 0, type.length);
    offset += 16;
    
}