Package org.jgroups.util

Examples of org.jgroups.util.Range


        assertEquals(0, r.low);
        assertEquals(10, r.high);
    }

    public void testComputeFragOffsets3() {
        Range r;
        byte[] buf={0,1,2,3,4,5,6,7,8,9};
        java.util.List retval=Util.computeFragOffsets(buf, 100);
        System.out.println("list is " + retval);
        assertEquals(1, retval.size());
        r=(Range)retval.get(0);
View Full Code Here


        assertEquals(0, r.low);
        assertEquals(10, r.high);
    }

    public void testComputeFragOffsets4() {
        Range r;
        byte[] buf={0,1,2,3,4,5,6,7,8,9};
        java.util.List retval=Util.computeFragOffsets(buf, 5);
        System.out.println("list is " + retval);
        assertEquals(2, retval.size());
        r=(Range)retval.get(0);
View Full Code Here

                log.trace(sb.toString());
            }

            long id=getNextId(); // used as a seqno
            for(int i=0; i < fragments.size(); i++) {
                Range r=fragments.get(i);
                Message frag_msg=msg.copy(false); // don't copy the buffer, only src, dest and headers. But do copy the headers
                frag_msg.setBuffer(buffer, (int)r.low, (int)r.high);
                FragHeader hdr=new FragHeader(id, i, num_frags);
                frag_msg.putHeader(name, hdr);
                down_prot.down(new Event(Event.MSG, frag_msg));
View Full Code Here

    /**
     * Constructor for retransmit requests (XMIT_REQs) (low and high define the range of msgs)
     */
    private NakAckHeader(byte type, long low, long high, Address sender) {
        this.type=type;
        range=new Range(low, high);
        this.sender=sender;
    }
View Full Code Here

        FragHeader         hdr;
        Message            frag_msg;
        Address            dest=msg.getDest();
        long               id=getNextId(); // used as seqnos
        int                num_frags;
        Range              r;

        try {
            buffer=msg.getBuffer();
            fragments=Util.computeFragOffsets(buffer, frag_size);
            num_frags=fragments.size();
View Full Code Here

                          local_addr, dest != null ? dest : "<all>", msg.getLength(), num_frags, frag_size);
            }

            long frag_id=getNextId(); // used as a seqno
            for(int i=0; i < num_frags; i++) {
                Range r=fragments.get(i);
                // don't copy the buffer, only src, dest and headers. Only copy the headers one time !
                Message frag_msg=msg.copy(false, i == 0);
                frag_msg.setBuffer(buffer, (int)r.low, (int)r.high);
                FragHeader hdr=new FragHeader(frag_id, i, num_frags);
                frag_msg.putHeader(this.id, hdr);
View Full Code Here

        FragHeader         hdr;
        Message            frag_msg;
        Address            dest=msg.getDest();
        long               id=getNextId(); // used as seqnos
        int                num_frags;
        Range              r;

        try {
            buffer=msg.getBuffer();
            fragments=Util.computeFragOffsets(buffer, frag_size);
            num_frags=fragments.size();
View Full Code Here

    /**
     * Constructor for retransmit requests/responses (low and high define the range of msgs)
     */
    public NakAckHeader(byte type, long low, long high) {
        this.type=type;
        range=new Range(low, high);
    }
View Full Code Here

        boolean read_range;
        type=in.readByte();
        seqno=in.readLong();
        read_range=in.readBoolean();
        if(read_range) {
            range=new Range();
            range.readExternal(in);
        }
        sender=(Address)in.readObject();
    }
View Full Code Here

        assertEquals(3, m4.getLength());
        assertEquals(3, m4.getBuffer().length);
    }

    public void testComputeFragOffsets() {
        Range r;
        byte[] buf={0,1,2,3,4,5,6,7,8,9};
        java.util.List retval=Util.computeFragOffsets(buf, 4);
        System.out.println("list is " + retval);
        assertEquals(3, retval.size());
        r=(Range)retval.get(0);
View Full Code Here

TOP

Related Classes of org.jgroups.util.Range

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.