Package org.jgroups

Examples of org.jgroups.Address


            case Event.MSG:
                Message msg=(Message)evt.getArg();
                if(msg.isFlagSet(Message.NO_FC))
                    break;

                Address dest=msg.getDest();
                boolean multicast=dest == null || dest.isMulticastAddress();
                boolean handle_multicasts=handleMulticastMessage();
                FcHeader hdr=(FcHeader)msg.getHeader(this.id);
                boolean process=(handle_multicasts && multicast) || (!handle_multicasts && !multicast) || hdr != null;
                if(!process)
                    break;
               
                if(hdr != null) {
                    switch(hdr.type) {
                        case FcHeader.REPLENISH:
                            num_credit_responses_received++;
                            handleCredit(msg.getSrc(), (Long)msg.getObject());
                            break;
                        case FcHeader.CREDIT_REQUEST:
                            num_credit_requests_received++;
                            Address sender=msg.getSrc();
                            Long requested_credits=(Long)msg.getObject();
                            if(requested_credits != null)
                                handleCreditRequest(received, sender, requested_credits.longValue());
                            break;
                        default:
                            log.error("header type " + hdr.type + " not known");
                            break;
                    }
                    return null; // don't pass message up
                }

                Address sender=msg.getSrc();
                long new_credits=adjustCredit(received, sender, msg.getLength());
               
                // JGRP-928: changed ignore_thread to a ThreadLocal: multiple threads can access it with the
                // introduction of the concurrent stack
                if(ignore_synchronous_response)
View Full Code Here


            if(!received.containsKey(addr))
                received.put(addr, new Credit(max_credits));
        }
        // remove members that left
        for(Iterator<Address> it=received.keySet().iterator(); it.hasNext();) {
            Address addr=it.next();
            if(!mbrs.contains(addr))
                it.remove();
        }
    }
View Full Code Here

    }


    public void testNonConflictingMerge() {
        MutableDigest cons_d=new  MutableDigest(5);
        Address ip1=Util.createRandomAddress(), ip2=Util.createRandomAddress();

        cons_d.add(ip1, 1, 10, 10);
        cons_d.add(ip2, 2, 20, 20);
        // System.out.println("\ncons_d before: " + cons_d);
        cons_d.merge(d);
View Full Code Here

                return;

        lock.lock();
        try {
            for(Rsp rsp: responses) {
                Address mbr=rsp.getSender();
                if(!mbrs.contains(mbr)) {
                    rsp.setValue(null);
                    if(rsp.setSuspected(true)) {
                        num_suspected++;
                        changed=true;
View Full Code Here

        lock.lock();
        try {
            if(!(responses.length == 0)) {
                ret.append(", entries:\n");
                for(Rsp rsp: responses) {
                    Address mbr=rsp.getSender();
                    ret.append(mbr).append(": ").append(rsp).append("\n");
                }
            }
        }
        finally {
View Full Code Here

        }
    }


    public boolean isCoord() {
        Address coord_addr=getCoordAddress();
        return is_server && own_addr != null && coord_addr != null && own_addr.equals(coord_addr);
    }
View Full Code Here

        Address coord_addr=getCoordAddress();
        return is_server && own_addr != null && coord_addr != null && own_addr.equals(coord_addr);
    }
   
    public boolean hasCoord(){
        Address coord_addr=getCoordAddress();
        return is_server && own_addr != null && coord_addr != null;
    }
View Full Code Here

        coll.waitForAllAcks(1000);
    }

    public static void testOneList() throws TimeoutException, UnknownHostException {
        List tmp=new ArrayList();
        Address addr=Util.createRandomAddress();
        tmp.add(addr);
        AckCollector coll=new AckCollector(null, tmp);
        coll.ack(addr);
        coll.waitForAllAcks(1000);
    }
View Full Code Here

     */
    public boolean isGreaterThanOrEqual(Digest other) {
        if(other == null)
            return true;
        Map<Address,Entry> our_map=getSenders();
        Address sender;
        Entry my_entry, their_entry;
        long my_highest, their_highest;
        for(Map.Entry<Address,Entry> entry: our_map.entrySet()) {
            sender=entry.getKey();
            my_entry=entry.getValue();
View Full Code Here

        StringBuilder sb=new StringBuilder();
        boolean first=true;
        if(senders.isEmpty()) return "[]";

        for(Map.Entry<Address,Entry> entry: senders.entrySet()) {
            Address key=entry.getKey();
            Entry val=entry.getValue();
            if(!first)
                sb.append(", ");
            else
                first=false;
View Full Code Here

TOP

Related Classes of org.jgroups.Address

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.