@Test public void queryUserTest() throws Exception { QueryUserCondition queryUserCondition = new QueryUserCondition(); User user = new UserServiceProxyImpl().queryUser(queryUserCondition); LOGGER.info("queryUserTest：" + user); }
@Override public User queryUser(QueryUserCondition condition) { int times = 0; OutService outService = new AlwaysFailOutServiceImpl(); while (times < RetryConstant.MAX_TIMES) { try { outService.remoteCall(); return new User(); } catch (Exception e) { times++; if(times >= RetryConstant.MAX_TIMES) { throw new RuntimeException(e); } } } return null; }
UserServiceRetryImpl implements UserService { @Override public User queryUser(QueryUserCondition condition) { int times = 0; OutService outService = new AlwaysFailOutServiceImpl(); while (times < RetryConstant.MAX_TIMES) { try { outService.remoteCall(); return new User(); } catch (Exception e) { times++; if(times >= RetryConstant.MAX_TIMES) { throw new RuntimeException(e); } } } return null; } }
UserServiceRetryImpl implements UserService { @Override public User queryUser(QueryUserCondition condition) { int times = 0; OutService outService = new AlwaysFailOutServiceImpl(); while (times < RetryConstant.MAX_TIMES) { try { outService.remoteCall(); return new User(); } catch (Exception e) { times++; if(times >= RetryConstant.MAX_TIMES) { throw new RuntimeException(e); } } } return null; }  }
UserServiceRetryImpl implements UserService { @Override public User queryUser(QueryUserCondition condition) { int times = 0; OutService outService = new AlwaysFailOutServiceImpl(); while (times < RetryConstant.MAX_TIMES) { try { outService.remoteCall(); return new User(); } catch (Exception e) { times++; if(times >= RetryConstant.MAX_TIMES) { throw new RuntimeException(e); } } } return null; }  @Override User queryUser(QueryUserCondition condition); }
UserServiceRetryImpl implements UserService { @Override public User queryUser(QueryUserCondition condition) { int times = 0; OutService outService = new AlwaysFailOutServiceImpl(); while (times < RetryConstant.MAX_TIMES) { try { outService.remoteCall(); return new User(); } catch (Exception e) { times++; if(times >= RetryConstant.MAX_TIMES) { throw new RuntimeException(e); } } } return null; }  @Override User queryUser(QueryUserCondition condition);  }