Browse Source

updates to interfaces from netflix

pull/5/head
Spencer Gibb 10 years ago
parent
commit
2874ae543e
  1. 9
      src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java
  2. 2
      src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java

9
src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java

@ -2,6 +2,8 @@ package org.springframework.cloud.client.loadbalancer; @@ -2,6 +2,8 @@ package org.springframework.cloud.client.loadbalancer;
import org.springframework.cloud.client.ServiceInstance;
import java.net.URI;
/**
* @author Spencer Gibb
*/
@ -14,10 +16,13 @@ public interface LoadBalancerClient { @@ -14,10 +16,13 @@ public interface LoadBalancerClient {
public ServiceInstance choose(String serviceId);
/**
* Choose a ServiceInstance from the LoadBalancer for the specified service
* execute request using a ServiceInstance from the LoadBalancer for the specified service
* @param serviceId the service id to look up the LoadBalancer
* @param request allows implementations to execute pre and post actions such as incrementing metrics
* @return the result of the LoadBalancerRequest callback on the selected ServiceInstance
*/
public <T> T choose(String serviceId, LoadBalancerRequest<T> request);
public <T> T execute(String serviceId, LoadBalancerRequest<T> request);
public URI reconstructURI(ServiceInstance instance, URI original);
}

2
src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java

@ -6,5 +6,5 @@ import org.springframework.cloud.client.ServiceInstance; @@ -6,5 +6,5 @@ import org.springframework.cloud.client.ServiceInstance;
* @author Spencer Gibb
*/
public interface LoadBalancerRequest<T> {
public T apply(ServiceInstance instance);
public T apply(ServiceInstance instance) throws Exception;
}

Loading…
Cancel
Save