Package org.jgroups.util

Examples of org.jgroups.util.MutableDigest


                        if(log.isWarnEnabled())
                            log.warn("digest response has no senders: digest=" + rsp.getDigest());
                        rsp=null; // just skip the response we guess
                        continue;
                    }
                    MutableDigest tmp_digest=new MutableDigest(rsp.getDigest());
                    tmp_view=rsp.getView();
                    if(tmp_view == null) {
                        if(log.isErrorEnabled())
                            log.error("JoinRsp has a null view, skipping it");
                        rsp=null;
                    }
                    else {
                        if(!tmp_digest.contains(gms.local_addr)) {
                            throw new IllegalStateException("digest returned from " + coord + " with JOIN_RSP does not contain myself (" +
                                    gms.local_addr + "): join response: " + rsp);
                        }
                        tmp_digest.incrementHighestDeliveredSeqno(coord); // see DESIGN for details
                        tmp_digest.seal();
                        gms.setDigest(tmp_digest);

                        if(log.isDebugEnabled())
                            log.debug("[" + gms.local_addr + "]: JoinRsp=" + tmp_view + " [size=" + tmp_view.size() + "]\n\n");
View Full Code Here


            // 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

            // 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, join_rsp != null? join_rsp.getDigest() : null, join_rsp,new_mbrs);                     
        }
View Full Code Here

                    if(log.isWarnEnabled())
                        log.warn("digest response has no senders: digest=" + rsp.getDigest());
                    rsp=null; // just skip the response we guess
                    continue;
                }
                MutableDigest tmp_digest=new MutableDigest(rsp.getDigest());
                tmp_view=rsp.getView();
                if(tmp_view == null) {
                    if(log.isErrorEnabled())
                        log.error("JoinRsp has a null view, skipping it");
                    rsp=null;
                }
                else {
                    if(!tmp_digest.contains(gms.local_addr)) {
                        throw new IllegalStateException("digest returned from " + coord + " with JOIN_RSP does not contain myself (" +
                                gms.local_addr + "): join response: " + rsp);
                    }
                    tmp_digest.incrementHighestDeliveredSeqno(coord); // see doc/design/varia2.txt for details
                    tmp_digest.seal();
                    gms.setDigest(tmp_digest);

                    if(log.isDebugEnabled())
                        log.debug("[" + gms.local_addr + "]: JoinRsp=" + tmp_view + " [size=" + tmp_view.size() + "]\n\n");
View Full Code Here

                    if(log.isWarnEnabled())
                        log.warn("digest response has no senders: digest=" + rsp.getDigest());
                    rsp=null; // just skip the response we guess
                    continue;
                }
                MutableDigest tmp_digest=new MutableDigest(rsp.getDigest());
                tmp_view=rsp.getView();
                if(tmp_view == null) {
                    if(log.isErrorEnabled())
                        log.error("JoinRsp has a null view, skipping it");
                    rsp=null;
                }
                else {
                    if(!tmp_digest.contains(gms.local_addr)) {
                        throw new IllegalStateException("digest returned from " + coord + " with JOIN_RSP does not contain myself (" +
                                gms.local_addr + "): join response: " + rsp);
                    }
                    tmp_digest.incrementHighestDeliveredSeqno(coord); // see DESIGN for details
                    tmp_digest.seal();
                    gms.setDigest(tmp_digest);

                    if(log.isDebugEnabled())
                        log.debug("[" + gms.local_addr + "]: JoinRsp=" + tmp_view + " [size=" + tmp_view.size() + "]\n\n");
View Full Code Here

        long max_wait_time=gms.merge_timeout > 0? (long)(gms.merge_timeout * 0.8) : 2000L;
        digest_collector.reset(current_mbrs);
        gms.getDownProtocol().down(new Event(Event.MSG, get_digest_req));
        digest_collector.waitForAllResponses(max_wait_time);
        Map<Address,Digest> responses=new HashMap<Address,Digest>(digest_collector.getResults());
        MutableDigest retval=new MutableDigest(responses.size());
        for(Digest digest: responses.values()) {
            if(digest != null)
                retval.add(digest);
        }
        return retval;
    }
View Full Code Here

            // 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

                    if(log.isWarnEnabled())
                        log.warn("digest response has no senders: digest=" + rsp.getDigest());
                    rsp=null; // just skip the response we guess
                    continue;
                }
                MutableDigest tmp_digest=new MutableDigest(rsp.getDigest());
                tmp_view=rsp.getView();
                if(tmp_view == null) {
                    if(log.isErrorEnabled())
                        log.error("JoinRsp has a null view, skipping it");
                    rsp=null;
                }
                else {
                    if(!tmp_digest.contains(gms.local_addr)) {
                        throw new IllegalStateException("digest returned from " + coord + " with JOIN_RSP does not contain myself (" +
                                gms.local_addr + "): join response: " + rsp);
                    }
                    tmp_digest.incrementHighestDeliveredSeqno(coord); // see DESIGN for details
                    tmp_digest.seal();
                    gms.setDigest(tmp_digest);

                    if(log.isDebugEnabled())
                        log.debug("[" + gms.local_addr + "]: JoinRsp=" + tmp_view + " [size=" + tmp_view.size() + "]\n\n");
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.