Click here to Skip to main content
15,867,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have four service instances,each instance have local cache.I use this code to call the method to refresh cache,but I find that each time it only call one service instance. How to change my code if I want to call all of four service instance to refresh cache?

Java
ResponseEntity<String> re=restTemplate.getForEntity("http://SERVICE/refreshCache",String.class);


What I have tried:

I have try to get all the ip,but I think it is not a good way.
List<ServiceInstance> instances = discoveryClient.getInstances("SERVICE");<br />
 for (ServiceInstance instance : instances) {System.out.println(instance.getHost()+"\t"+instance.getInstanceId()+"\t"+instance.getPort()+"\t"+instance.getUri());<br />
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900