try {
membershipListener = (MembershipListener) Class.forName(clazz).newInstance();
} catch (Exception e) {
String msg = "Cannot instantiate MembershipListener " + clazz;
log.error(msg, e);
throw new ClusteringFault(msg, e);
}
OMElement propsEle = paramEle.getFirstChildWithName(new QName("properties"));
if (propsEle != null) {
for (Iterator iter = propsEle.getChildElements(); iter.hasNext();) {
OMElement propEle = (OMElement) iter.next();
OMAttribute nameAttrib = propEle.getAttribute(new QName("name"));
if (nameAttrib != null) {
String name = nameAttrib.getAttributeValue();
setInstanceProperty(name, propEle.getText().trim(), membershipListener);
}
}
}
}
String scheme = getMembershipScheme();
log.info("Using " + scheme + " based membership management scheme");
if (scheme.equals(ClusteringConstants.MembershipScheme.WKA_BASED)) {
membershipScheme =
new WkaBasedMembershipScheme(channel, mode,
membershipManagers,
primaryMembershipManager,
parameters, localDomain, members,
getBooleanParam(ClusteringConstants.Parameters.ATMOST_ONCE_MSG_SEMANTICS),
getBooleanParam(ClusteringConstants.Parameters.PRESERVE_MSG_ORDER));
} else if (scheme.equals(ClusteringConstants.MembershipScheme.MULTICAST_BASED)) {
membershipScheme =
new MulticastBasedMembershipScheme(channel, mode, parameters,
localDomain,
getBooleanParam(ClusteringConstants.Parameters.ATMOST_ONCE_MSG_SEMANTICS),
getBooleanParam(ClusteringConstants.Parameters.PRESERVE_MSG_ORDER));
} else {
String msg = "Invalid membership scheme '" + scheme +
"'. Supported schemes are multicast & wka";
log.error(msg);
throw new ClusteringFault(msg);
}
membershipScheme.init();
}