Removed service discovery to to old service class

This commit is contained in:
Luca Frosini 2022-07-26 11:47:13 +02:00
parent 73efe34e05
commit f39a50e6fa
1 changed files with 2 additions and 13 deletions

View File

@ -74,25 +74,14 @@ public class GCatClientDiscovery {
protected static List<String> getAddresses(){
List<String> addresses = new ArrayList<>();
try {
SimpleQuery proxyQuery = queryForProxy(GCatConstants.SERVICE_CLASS);
addresses = ICFactory.client().submit(proxyQuery);
if(addresses==null || addresses.isEmpty()){
proxyQuery = queryForProxy(GCatConstants.OLD_SERVICE_CLASS);
addresses = ICFactory.client().submit(proxyQuery);
if(addresses==null || addresses.isEmpty()){
throw new Exception("No ResourceRegistry Proxy Found");
}
}
} catch (Exception e) {
logger.debug("{}. Looking for RunningInstance.", e.getMessage());
SimpleQuery serviceQuery = queryForService(GCatConstants.SERVICE_CLASS);
addresses = ICFactory.client().submit(serviceQuery);
if(addresses==null || addresses.isEmpty()){
serviceQuery = queryForService(GCatConstants.OLD_SERVICE_CLASS);
addresses = ICFactory.client().submit(serviceQuery);
}
}
return addresses;
}
@ -122,7 +111,7 @@ public class GCatClientDiscovery {
List<String> addresses = getAddresses();
if(addresses==null || addresses.isEmpty()){
String error = String.format("No (%s or %s):%s found in the current context", GCatConstants.SERVICE_CLASS, GCatConstants.OLD_SERVICE_CLASS, GCatConstants.SERVICE_NAME);
String error = String.format("No %s:%s found in the current context", GCatConstants.SERVICE_CLASS, GCatConstants.SERVICE_NAME);
throw new RuntimeException(error);
}
Random random = new Random();