Package org.jgroups.util

Examples of org.jgroups.util.MutableDigest


            // in the digest returned to the client, so the client will *not* be able to ask for retransmission
            // of those messages if he misses them           
            if(hasJoiningMembers) {
                gms.getDownProtocol().down(new Event(Event.SUSPEND_STABLE, MAX_SUSPEND_TIMEOUT));
                Digest tmp=gms.getDigest(); // get existing digest
                MutableDigest join_digest=null;
                if(tmp == null){
                    log.error("received null digest from GET_DIGEST: will cause JOIN to fail");
                }
                else {
                    // create a new digest, which contains the new member
                    join_digest=new MutableDigest(tmp.size() + new_mbrs.size());
                    join_digest.add(tmp); // add the existing digest to the new one
                    for(Address member:new_mbrs)
                        join_digest.add(member, 0, 0); // ... and add the new members. their first seqno will be 1
                }
                join_rsp=new JoinRsp(new_view, join_digest != null? join_digest.copy() : null);
            }

            sendLeaveResponses(leaving_mbrs); // no-op if no leaving members                           
            gms.castViewChangeWithDest(new_view, null,join_rsp,new_mbrs);                     
        }
View Full Code Here


    /**
     * Merge all digests into one. For each sender, the new value is min(low_seqno), max(high_seqno),
     * max(high_seqno_seen). This method has a lock on merge_rsps
     */
    private Digest consolidateDigests(Vector<MergeData> merge_rsps, int num_mbrs) {              
        MutableDigest retval=new MutableDigest(num_mbrs);

        for(MergeData data:merge_rsps) {           
            Digest tmp_digest=data.getDigest();
            if(tmp_digest == null) {
                if(log.isErrorEnabled()) log.error("tmp_digest == null; skipping");
                continue;
            }
            retval.merge(tmp_digest);
        }
        return retval.copy();
    }
View Full Code Here

        a3=new IpAddress(7777);
        map.put(a1, new Digest.Entry(4, 500, 501));
        map.put(a2, new Digest.Entry(25, 26, 26));
        map.put(a3, new Digest.Entry(20, 25, 33));
        d=new Digest(map);
        md=new MutableDigest(map);
    }
View Full Code Here

        System.out.println("\nd: " + d + "\nmy: " + my);
        assertFalse(my.isGreaterThanOrEqual(d));
    }

    public void testEquals2() {
        md=new MutableDigest(d);
        System.out.println("d: " + d + "\nmd= " + md);
        assertEquals(d, d);
        assertEquals(d, md);
        md.incrementHighestDeliveredSeqno(a1);
        System.out.println("d: " + d + "\nmd= " + md);
View Full Code Here

        md.incrementHighestDeliveredSeqno(a2);
        assertEquals(md, md2);
    }

    public void testImmutability() {
        MutableDigest tmp=new MutableDigest(d);
        assertEquals(d, tmp);
        tmp.incrementHighestDeliveredSeqno(a2);
        assertFalse(d.equals(tmp));
    }
View Full Code Here

        md.incrementHighestDeliveredSeqno(a1);
        assertFalse(copy.equals(md));
    }

    public void testSeal() {
        MutableDigest tmp=new MutableDigest(3);
        tmp.add(a2, 1,2,3);
        assertEquals(1, tmp.size());
        tmp.seal();
        try {
            tmp.add(a2, 4,5,6);
            fail("should run into an exception");
        }
        catch(IllegalAccessError e) {
            System.out.println("received exception \"" + e.toString() + "\" - as expected");
        }
        assertEquals(1, tmp.size());
    }
View Full Code Here

        }
        catch(IllegalAccessError e) {
            System.out.println("received exception \"" + e.toString() + "\" - as expected");
        }

        MutableDigest tmp=new MutableDigest(md);
        tmp.incrementHighestDeliveredSeqno(a3);
    }
View Full Code Here

        md.add(tmp);
        assertEquals(3, md.size());
    }

    public void testAddDigest2() {
        MutableDigest tmp=new MutableDigest(4);
        tmp.add(new IpAddress(1111), 1,2,3);
        tmp.add(new IpAddress(2222), 1,2,3);
        tmp.add(new IpAddress(5555), 1,2,3);
        tmp.add(new IpAddress(6666), 1,2,3);
        md.add(tmp);
        assertEquals(5, md.size());
    }
View Full Code Here

        entry=d.get(a3);
        assertEquals(entry, new Digest.Entry(20,25,33));
    }

    public void testIncrementHighSeqno() {
        md=new MutableDigest(3);
        md.add(a1, 1, 100);
        md.add(a2, 3, 300);
        md.add(a3, 7, 700);

        long tmp=md.highestDeliveredSeqnoAt(a1);
View Full Code Here

        Digest dd=new Digest(3);
        assertEquals(0, dd.size());
    }

    public void testConstructor3() {
        Digest dd=new MutableDigest(3);
        assertEquals(0, dd.size());
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.MutableDigest

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.