Package org.jgroups

Examples of org.jgroups.Address




    public static void main(String[] args) throws UnknownHostException {
        AckMcastReceiverWindow win=new AckMcastReceiverWindow();
        Address sender1=new IpAddress("janet", 1111);
        Address sender2=new IpAddress("janet", 4444);
        Address sender3=new IpAddress("janet", 6767);
        Address sender4=new IpAddress("janet", 3333);

        win.add(sender1, 1);
        win.add(sender1, 2);

        win.add(sender3, 2);
View Full Code Here


     * then removes the Message from the send queue, performs a conversion and adds the
     * modified Message to the send queue of the layer below it, by calling Down).
     */
    public Object down(Event evt) {
        Message msg;
        Address dest_addr;


        switch(evt.getType()) {

        case Event.MSG:
View Full Code Here

    }


    public Object up(Event evt) {
        Message msg;
        Address dest_addr;
        switch(evt.getType()) {

        case Event.MSG:
            if(done) {
                if(log.isWarnEnabled()) log.warn("all done (discarding msg)");
View Full Code Here

                sent.put(addr, new Credit(max_credits));
        }

        // remove members that left
        for(Iterator<Address> it=sent.keySet().iterator(); it.hasNext();) {
            Address addr=it.next();
            if(!mbrs.contains(addr))
                it.remove(); // modified the underlying map
        }
    }
View Full Code Here

                            num_credit_responses_received++;
                            handleCredit(msg.getSrc(), (Number)msg.getObject());
                            break;
                        case FcHeader.CREDIT_REQUEST:
                            num_credit_requests_received++;
                            Address sender=msg.getSrc();
                            Long sent_credits=(Long)msg.getObject();
                            if(sent_credits != null)
                                handleCreditRequest(received, sender, sent_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

            }
        }
    }

    private Object handleDownMessage(final Event evt, final Message msg, int length) {
        Address dest=msg.getDest();

        if(max_block_times != null) {
            long tmp=getMaxBlockTime(length);
            if(tmp > 0)
                end_time.set(System.currentTimeMillis() + tmp);
View Full Code Here

        num_credit_requests_sent++;
    }


    private void handleViewChange(Vector<Address> mbrs) {
        Address addr;
        if(mbrs == null) return;
        if(log.isTraceEnabled()) log.trace("new membership: " + mbrs);

        lock.lock();
        try {
            // add members not in membership to received and sent hashmap (with full credits)
            for(int i=0; i < mbrs.size(); i++) {
                addr=mbrs.elementAt(i);
                if(!received.containsKey(addr))
                    received.put(addr, new Credit(max_credits));
                if(!sent.containsKey(addr))
                    sent.put(addr, new Credit(max_credits));
            }
            // remove members that left
            for(Iterator<Address> it=received.keySet().iterator(); it.hasNext();) {
                addr=it.next();
                if(!mbrs.contains(addr))
                    it.remove();
            }

            // remove members that left
            for(Iterator<Address> it=sent.keySet().iterator(); it.hasNext();) {
                addr=it.next();
                if(!mbrs.contains(addr))
                    it.remove(); // modified the underlying map
            }

            // fixed http://jira.jboss.com/jira/browse/JGRP-754 (CCME)
            for(Iterator<Address> it=creditors.iterator(); it.hasNext();) {
                Address creditor=it.next();
                if(!mbrs.contains(creditor))
                    it.remove();
            }

            if(log.isTraceEnabled()) log.trace("creditors are " + creditors);
View Full Code Here

            this.t=t;
        }

        public Object up(Event evt) {
            Message msg=null;
            Address sender;

            if(evt == null || evt.getType() != Event.MSG)
                return null;
            msg=(Message)evt.getArg();
            sender=msg.getSrc();
View Full Code Here

            }
        }

        final Set<Address> initial_mbrs = new HashSet<Address>();
        for (PingData rsp : responses) {
            Address logical_addr = rsp.getAddress();
            initial_mbrs.add(logical_addr);

            // 1. Set physical addresses
            Collection<PhysicalAddress> physical_addrs = rsp.getPhysicalAddrs();
            if (physical_addrs != null) {
View Full Code Here

        }

        private void readLoop() {
            while(isRunning()) {
                GossipData request;
                Address addr;
                String group;
                try {                  
                    request=new GossipData();
                    request.readFrom(input);
                    byte command=request.getType();
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.