Skip to content

Instantly share code, notes, and snippets.

@lordofthejars
Created September 30, 2014 10:47
Show Gist options
  • Select an option

  • Save lordofthejars/5babb4f2956d5886f38c to your computer and use it in GitHub Desktop.

Select an option

Save lordofthejars/5babb4f2956d5886f38c to your computer and use it in GitHub Desktop.
//I am running this example (which is the one provided in website), but I have modified the sample-client.properties so one of the server
//is invalid (unknown host). Then I run the code, but circuit to that server is never tripped (printing stats shows that no tripped //happened ever) and also debugging the code I can see that the server host is eligible. I would like to know if it is the expected behavior.
ConfigurationManager.loadPropertiesFromResources("sample-client.properties"); System.out.println(ConfigurationManager.getConfigInstance().getProperty("sample-client.ribbon.listOfServers"));
RestClient client = (RestClient) ClientFactory.getNamedClient("sample-client");
HttpRequest request = HttpRequest.newBuilder().uri(new URI("/")).build();
for (int i = 0; i < 20; i++) {
HttpResponse response = client.executeWithLoadBalancer(request);
System.out.println("Status code for " + response.getRequestedURI()
+ " :" + response.getStatus());
}
ZoneAwareLoadBalancer lb = (ZoneAwareLoadBalancer) client.getLoadBalancer();
System.out.println(lb.getLoadBalancerStats());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment