public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.isEmpty()) { throw new RpcException("No invoker is found!"); } int lengthOfInvokerList = invokers == null ? 0 : invokers.size(); return invokers.get(random.nextInt(lengthOfInvokerList)); }
public <T> Invoker<T> fireChooseInvoker(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { this.fireInitializeIfNecessary(); if (this.loadBalancer == null) { throw new RpcException("No org.bytesoft.bytetcc.supports.dubbo.ext.ILoadBalancer is found!"); } else { return this.loadBalancer.select(invokers, url, invocation); } }
throw new RpcException("No invoker is found!"); if (remoteNode == null || StringUtils.isBlank(remoteNode.getServiceKey())) { if (rpcException == null) { rpcException = new RpcException("Cannot get application name of remote node!"); } else { logger.warn("Cannot get application name of remote node({})!", remoteAddr); throw new RpcException("The instance has been enlisted is currently unavailable."); rpcException = new RpcException("There is already an instance of the same application being enlisted.");
invokeError = new RpcException(rex.getMessage()); } catch (RpcException rex) { invokeError = rex; } catch (Throwable rex) { logger.error("Error occurred in remote call!", rex); invokeError = new RpcException(rex.getMessage()); } finally { try { } catch (RemotingException rex) { if (invokeError == null) { throw new RpcException(rex.getMessage()); } else { logger.error("Error occurred in remote call!", rex); throw new RpcException(rex.getMessage()); } else { logger.error("Error occurred in remote call!", rex); throw (RpcException) serverError; } else if (RemotingException.class.isInstance(serverError)) { throw new RpcException(serverError.getMessage()); } else { return result;
invokeError = new RpcException(rex.getMessage()); } catch (RpcException rex) { invokeError = rex; } catch (Throwable rex) { logger.error("Error occurred in remote call!", rex); invokeError = new RpcException(rex.getMessage()); } finally { try { } catch (RemotingException rex) { if (invokeError == null) { throw new RpcException(rex.getMessage()); } else { logger.error("Error occurred in remote call!", rex); throw new RpcException(rex.getMessage()); } else { logger.error("Error occurred in remote call!", rex); throw (RpcException) serverError; } else if (RemotingException.class.isInstance(serverError)) { throw new RpcException(serverError.getMessage()); } else { return result;
throw new RpcException("Cannot get the application name of the remote application.");
throw new RpcException("Cannot get the application name of the remote application.");
throw new RpcException("Cannot get the application name of the remote application.");
throw new RpcException("Cannot get the application name of the remote application.");
throw new RpcException("Cannot get the application name of the remote application.");
private void error(String generic, String expected, String actual) throws RpcException { throw new RpcException( "Generic serialization [" + generic + "] only support message type " + expected + " and your message type is " + actual); }
@Override public Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance) throws RpcException { for (Invoker<T> invoker : invokers) { if (invoker.isAvailable()) { return invoker.invoke(invocation); } } throw new RpcException("No provider available in " + invokers); }
public Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance) throws RpcException { for (Invoker<T> invoker : invokers) { if (invoker.isAvailable()) { return invoker.invoke(invocation); } } throw new RpcException("No provider available in " + invokers); } };
protected RpcException getRpcException(Class<?> type, URL url, Invocation invocation, Throwable e) { RpcException re = new RpcException("Failed to invoke remote service: " + type + ", method: " + invocation.getMethodName() + ", cause: " + e.getMessage(), e); re.setCode(getErrorCode(e)); return re; }
protected void checkWhetherDestroyed() { if (destroyed.get()) { throw new RpcException("Rpc cluster invoker for " + getInterface() + " on consumer " + NetUtils.getLocalHost() + " use dubbo version " + Version.getVersion() + " is now destroyed! Can not invoke any more."); } }
private ExchangeClient initClient(URL url) { ExchangeClient client; url = url.addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); try { client = Exchangers.connect(url); } catch (RemotingException e) { throw new RpcException("Fail to create remoting client for service(" + url + "): " + e.getMessage(), e); } return client; }
private ExchangeClient initClient(URL url) { ExchangeClient client; url = url.addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); try { client = Exchangers.connect(url); } catch (RemotingException e) { throw new RpcException("Fail to create remoting client for service(" + url + "): " + e.getMessage(), e); } return client; }
@Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (!tpsLimiter.isAllowable(invoker.getUrl(), invocation)) { throw new RpcException( "Failed to invoke service " + invoker.getInterface().getName() + "." + invocation.getMethodName() + " because exceed max service tps."); } return invoker.invoke(invocation); }
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) { if (invokers == null || invokers.isEmpty()) { throw new RpcException("Failed to invoke the method " + invocation.getMethodName() + " in the service " + getInterface().getName() + ". No provider available for the service " + directory.getUrl().getServiceKey() + " from registry " + directory.getUrl().getAddress() + " on the consumer " + NetUtils.getLocalHost() + " using the dubbo version " + Version.getVersion() + ". Please check if the providers have been started and registered."); } }
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) { if (invokers == null || invokers.isEmpty()) { throw new RpcException("Failed to invoke the method " + invocation.getMethodName() + " in the service " + getInterface().getName() + ". No provider available for the service " + directory.getUrl().getServiceKey() + " from registry " + directory.getUrl().getAddress() + " on the consumer " + NetUtils.getLocalHost() + " using the dubbo version " + Version.getVersion() + ". Please check if the providers have been started and registered."); } }