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);