@Override public Object invoke(Object o, Method method, Object[] args) throws Throwable { int attempts = 0; while (true) { attempts++; InvocationResult invokeResult = invokeInternal(method, args); if (invokeResult.success) { return invokeResult.result; } // Error because of thrift client, we have to recreate base object connectWithRetry(conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_CLIENT_CONNECTION_RETRY_LIMIT)); if (attempts >= retryLimit) { LOG.error(method.getName() + " failed after " + attempts + " retries.", invokeResult.exception); throw invokeResult.exception; } LOG.warn("Last call ThriftCLIServiceClient." + method.getName() + " failed, attempts = " + attempts, invokeResult.exception); Thread.sleep(retryDelaySeconds * 1000); } }
@Override protected InvocationResult invokeInternal(Method method, Object[] args) throws Throwable { System.out.println("## Calling: " + method.getName() + ", " + callCount + "/" + getRetryLimit()); callCount++; return super.invokeInternal(method, args); }
@Override public Object invoke(Object o, Method method, Object[] args) throws Throwable { int attempts = 0; while (true) { attempts++; InvocationResult invokeResult = invokeInternal(method, args); if (invokeResult.success) { return invokeResult.result; } // Error because of thrift client, we have to recreate base object connectWithRetry(conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_CLIENT_CONNECTION_RETRY_LIMIT)); if (attempts >= retryLimit) { LOG.error(method.getName() + " failed after " + attempts + " retries.", invokeResult.exception); throw invokeResult.exception; } LOG.warn("Last call ThriftCLIServiceClient." + method.getName() + " failed, attempts = " + attempts, invokeResult.exception); Thread.sleep(retryDelaySeconds * 1000); } }