Description
Here’s a summary of the issue as per chronological order.
1, When Light-4J starts, the serviceMap container has the target IP (e.g. 10.10.10.10)
-
When target changes IP (e.g. 11.11.11.11) , this method will first look at the cache (serviceMap) and if there exists use that.
-
Issue is the serviceMap contains old IP (10.10.10.10)
-
Hence wrong IP being used and hence it blows up since IP 10.10.10.10 no longer exists
Here’s the code:
private List discovery(String protocol, String serviceId, String tag) {
if(logger.isDebugEnabled()) logger.debug("protocol = " + protocol + " serviceId = " + serviceId);
// lookup in serviceMap first, if not there, then subscribe and discover.
List urls = serviceMap.get(serviceId);
if(logger.isDebugEnabled()) logger.debug("cached serviceId " + serviceId + " urls = " + urls);
if((urls == null) || (urls.isEmpty())) {
URL subscribeUrl = URLImpl.valueOf(protocol + "://localhost/" + serviceId);
if(tag != null) {
subscribeUrl.addParameter(Constants.TAG_ENVIRONMENT, tag);