msg.putHeader(name, hdr); if(trace) log.trace(new StringBuffer().append(local_addr).append(" --> DATA(").append(dst).append(": #"). append(seqno));  entry.sent_msgs_seqno++; Message tmp=Global.copy? msg.copy() : msg;
catch(Throwable t) { entry.sent_msgs.ack(seqno); if(t instanceof Error) throw (Error)t; if(t instanceof RuntimeException) throw (RuntimeException)t; else { throw new RuntimeException("failure adding msg " + msg + " to the retransmit table", t); } }
    public void down(Event evt) {        switch (evt.getType()) {            case Event.MSG: // Add UnicastHeader, add to AckSenderWindow and pass down                Message msg = (Message) evt.getArg();                Object dst = msg.getDest();                /* only handle unicast messages */                if (dst == null || ((Address) dst).isMulticastAddress()) {                    break;                }                if(previous_members.contains(dst)) {                    if(trace)                        log.trace("discarding message to " + dst + " as this member left the group," +                                " previous_members=" + previous_members);                    return;                }                Entry entry;                synchronized(connections) {                    entry=(Entry)connections.get(dst);                    if(entry == null) {                        entry=new Entry();                        connections.put(dst, entry);                        if(trace)                            log.trace(local_addr + ": created new connection for dst " + dst);                    }                }                synchronized(entry) { // threads will only sync if they access the same entry                    long seqno=entry.sent_msgs_seqno;                    UnicastHeader hdr=new UnicastHeader(UnicastHeader.DATA, seqno);                    if(entry.sent_msgs == null) { // first msg to peer 'dst'                        entry.sent_msgs=new AckSenderWindow(this, timeout, timer); // use the protocol stack's timer                    }                    msg.putHeader(name, hdr);                    if(trace)                        log.trace(new StringBuffer().append(local_addr).append(" --> DATA(").append(dst).append(": #").                                append(seqno));                    entry.sent_msgs_seqno++;                    Message tmp=Global.copy? msg.copy() : msg;                    try {                        passDown(new Event(Event.MSG, tmp));                        num_msgs_sent++;                        num_bytes_sent+=msg.getLength();                    }                    finally {                        entry.sent_msgs.add(seqno, tmp);  // add *including* UnicastHeader, adds to retransmitter                    }                }                msg=null;                return; // we already passed the msg down            case Event.VIEW_CHANGE:  // remove connections to peers that are not members anymore !                Vector new_members=((View)evt.getArg()).getMembers();                Vector left_members;                synchronized(members) {                    left_members=Util.determineLeftMembers(members, new_members);                    members.clear();                    if(new_members != null)                        members.addAll(new_members);                }                // Remove all connections for members that left between the current view and the new view                // See DESIGN for details                boolean rc;                if(use_gms && left_members.size() > 0) {                    Object mbr;                    for(int i=0; i < left_members.size(); i++) {                        mbr=left_members.elementAt(i);                        rc=removeConnection(mbr);                        if(rc && trace)                            log.trace("removed " + mbr + " from connection table, member(s) " + left_members + " left");                    }                }                break;            case Event.ENABLE_UNICASTS_TO:                Object member=evt.getArg();                previous_members.removeElement(member);                if(trace)                    log.trace("removing " + member + " from previous_members as result of ENABLE_UNICAST_TO event, " +                            "previous_members=" + previous_members);                break;        }        passDown(evt);          // Pass on to the layer below us    }