updates to interfaces from netflix

This commit is contained in:
Spencer Gibb
2014-12-02 15:20:58 -07:00
parent f96d9947df
commit 2874ae543e
2 changed files with 8 additions and 3 deletions

View File

@@ -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 {
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);
}

View File

@@ -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;
}