use of cn.polarismesh.agent.plugin.dubbo2.entity.InstanceInvoker in project polaris-java-agent by polarismesh.
the class PolarisLoadBalance method doSelect.
@Override
@SuppressWarnings("unchecked")
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
if (null == invokers || invokers.size() == 0) {
return null;
}
String service = url.getServiceInterface();
LOGGER.info("[POLARIS] select instance for service {} by PolarisLoadBalance", service);
String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName();
List<Instance> instances = (List<Instance>) ((List<?>) invokers);
Instance instance = PolarisSingleton.getPolarisOperator().loadBalance(service, key, instances);
return (InstanceInvoker<T>) instance;
}
Aggregations