updates to interfaces from netflix
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user