* member groups of the registrar corresponding to the
* <code>response</code> parameter (just after a
* possible change)
*/
private void maybeSendEvent(UnicastResponse response, String[] newGroups) {
ServiceRegistrar reg = response.getRegistrar();
boolean getActual = true;
if(newGroups == null) { // newGroups null means get actual groups now
newGroups = getActualGroups(reg);
if(newGroups == null) return; // if null, then it was discarded
getActual = false;
}//endif
if(groupSetsEqual(response.getGroups(),newGroups)) return;
String[] actualGroups = newGroups;
if( getActual && (newGroups.length > 0) ) {
actualGroups = getActualGroups(reg);
if(actualGroups == null) return; // null ==> was already discarded
}//endif
synchronized (registrars) {
// Other events may have occured to registrars while we were
// making our remote call.
UnicastResponse resp =
(UnicastResponse) registrars.get(reg.getServiceID());
if (resp == null) {
// The registrar was discarded in the meantime. Oh well.
return;
}
notifyOnGroupChange(reg, resp.getGroups(), actualGroups);