* @return an array of TargetService instances matching the probe or null
* @throws Exception if an error occurs while accessing the registry
*/
public static TargetService[] findServices(Probe probe) throws Exception {
ServiceManager serviceManager = new ServiceManager(getRegistry());
DiscoveryServiceFilter filter = new DiscoveryServiceFilter(probe);
// Check whether the inactive services should be skipped when searching
AxisConfiguration axisConfig;
String tenantDomain = SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);
ConfigurationContext mainCfgCtx = ConfigHolder.getInstance().getServerConfigurationContext();
if (tenantDomain != null) {
axisConfig = TenantAxisUtils.getTenantAxisConfiguration(tenantDomain, mainCfgCtx);
} else {
axisConfig = mainCfgCtx.getAxisConfiguration();
}
Parameter parameter = axisConfig.getParameter(DiscoveryConstants.SKIP_INACTIVE_SERVICES);
if (parameter != null && "true".equals(parameter.getValue())) {
filter.setSkipInactiveServices(true);
}
Service[] services = serviceManager.findServices(filter);
if (services != null && services.length > 0) {
TargetService[] targetServices = new TargetService[services.length];