synchronized(mutex) { if(trace) { Long old_credit=(Long)sent.get(sender); sb=new StringBuffer(); sb.append("received credit from ").append(sender).append(", old credit was "). append(old_credit).append(", new credits are ").append(max_credits). append(".\nCreditors before are: ").append(creditors); }
if(Util.acquire(lock)) { try { if(trace) { Long old_credit=(Long)sent.get(sender); sb=new StringBuffer(); sb.append("received credit from ").append(sender).append(", old credit was "). append(old_credit).append(", new credits are ").append(max_credits). append(".\nCreditors before are: ").append(creditors); }
    private void handleCredit(Address sender) {        if(sender == null) return;        StringBuffer sb=null;        synchronized(mutex) {            if(trace) {                Long old_credit=(Long)sent.get(sender);                sb=new StringBuffer();                sb.append("received credit from ").append(sender).append(", old credit was ").                        append(old_credit).append(", new credits are ").append(max_credits).                        append(".\nCreditors before are: ").append(creditors);            }            sent.put(sender, max_credits_constant);            lowest_credit=computeLowestCredit(sent);            if(creditors.size() > 0) {  // we are blocked because we expect credit from one or more members                creditors.remove(sender);                if(trace) {                    sb.append("\nCreditors after removal of ").append(sender).append(" are: ").append(creditors);                    log.trace(sb.toString());                }            }            if(insufficient_credit && lowest_credit > 0 && creditors.size() == 0) {                insufficient_credit=false;                mutex.notifyAll();            }        }    }