while((msg_to_deliver=win.remove()) != null) {
synchronized(win) { while((msg_to_deliver=win.remove()) != null) {
    private void handleMessage(Message msg, NakAckHeader hdr) {        NakReceiverWindow win;        Message msg_to_deliver;        Address sender=msg.getSrc();        if(sender == null) {            if(log.isErrorEnabled())                log.error("sender of message is null");            return;        }        if(trace) {            StringBuffer sb=new StringBuffer('[');            sb.append(local_addr).append(": received ").append(sender).append('#').append(hdr.seqno);            log.trace(sb.toString());        }        // msg is potentially re-sent later as result of XMIT_REQ reception; that's why hdr is added !        // Changed by bela Jan 29 2003: we currently don't resend from received msgs, just from sent_msgs !        // msg.putHeader(getName(), hdr);        synchronized(received_msgs) {            win=(NakReceiverWindow)received_msgs.get(sender);        }        if(win == null) {  // discard message if there is no entry for sender            if(leaving)                return;            if(warn) {                StringBuffer sb=new StringBuffer('[');                sb.append(local_addr).append("] discarded message from non-member ").append(sender);                if(warn)                    log.warn(sb);            }            return;        }        win.add(hdr.seqno, msg);  // add in order, then remove and pass up as many msgs as possible        while((msg_to_deliver=win.remove()) != null) {            // Changed by bela Jan 29 2003: not needed (see above)            //msg_to_deliver.removeHeader(getName());            passUp(new Event(Event.MSG, msg_to_deliver));        }    }