ClusteringUtils.loadServiceGroup(serviceGroup,
configContext,
System.getProperty("axis2.work.dir")); //TODO: Introduce a constant. work dir is a temp dir.
} catch (FileNotFoundException ignored) {
} catch (Exception e) {
throw new ClusteringFault(e);
}
}
}
// Unload all service groups which were not sent by the neighbour,
// but have been currently loaded
for (Iterator iter = axisConfig.getServiceGroups(); iter.hasNext();) {
AxisServiceGroup serviceGroup = (AxisServiceGroup) iter.next();
boolean foundServiceGroup = false;
for (int i = 0; i < serviceGroups.length; i++) {
String serviceGroupName = serviceGroups[i];
if (serviceGroup.getServiceGroupName().equals(serviceGroupName)) {
foundServiceGroup = true;
break;
}
}
if (!foundServiceGroup) {
boolean mustUnloadServiceGroup = true;
// Verify that this service was not loaded from within a module
// If so, we must not unload such a service
for (Iterator serviceIter = serviceGroup.getServices();
serviceIter.hasNext();) {
AxisService service = (AxisService) serviceIter.next();
if (service.isClientSide() ||
service.getParameter(AxisModule.MODULE_SERVICE) != null) {
mustUnloadServiceGroup = false;
break; // Do not unload service groups containing client side services
}
}
if (mustUnloadServiceGroup) {
try {
axisConfig.removeServiceGroup(serviceGroup.getServiceGroupName());
} catch (Exception e) {
throw new ClusteringFault(e);
}
}
}
}
}