@Argent pointcupe invokes the method twice

Advertisement

Sometimes my API throws an exception, this server can not process my request. I decided to create an AOP aspect that will reset the API call. For example, 5 times and after that throws an exception if it still does not work.

Please see my AOP class. It's not a whole body, but I hope you'll understand what's going on:

 @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } public class RetryRequestExecutor { @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Around ("@ annotation (com.test.RequestRetriable)") @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } public Object retryApiRequest (ProceedingJoinPoint point) throw Throwable { @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } int numAttempts = 0; @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } ServiceException lastException; @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } numTtempts ++; @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } preInvokeLog (point); @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } Object retValue = point.proceed (); @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } PostInvokeLog (point); @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } return retValue; @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } lastException = handleServiceException (point, numAttempts, e); @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } } while (numTtempts <= maxRetries); @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } run lastException; @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... }  @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } @Aspect public class RetryRequestExecutor { .... @Around("@annotation(com.test.RequestRetriable)") public Object retryApiRequest(ProceedingJoinPoint point) throws Throwable { int numAttempts = 0; ServiceException lastException; do { numAttempts++; try { preInvokeLog(point); Object retValue = point.proceed(); postInvokeLog(point); return retValue; } catch (ServiceException e) { lastException = handleServiceException(point, numAttempts, e); } } while (numAttempts <= maxRetries); throw lastException; } .... } 

This is my service class:

 public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } publicAttribute publicAttribute public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } retrieveSuspendedUsers () throws exception { public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } LOG.debug ("Recovering suspended users"); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } (64); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } // Invoke API. public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } AOP invokes it twice! public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } currentPage = getUsers (retrieveUrl); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } URL nextLink = currentPage.getNextLink (); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } if (nextLink == null) { public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } while (nextLink! = null); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } @RequestRetriable public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } Public UserFeed getUsers (URL feedUrl) throws Exception { public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } returns userService.getFeed (feedUrl, UserFeed.class); public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... }  public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } public class UserApiImpl implements UserApi { ... @Override public List retrieveSuspendedUsers() throws Exception{ LOG.debug("Retrieving suspended users."); ... List users = new ArrayList (64); do { //Invoke API. AOP invoke it two times! currentPage = getUsers(retrieveUrl); ... URL nextLink = currentPage.getNextLink(); if (nextLink == null){ break; } ... } while (nextLink != null); return users; } @Override @RequestRetriable public UserFeed getUsers(URL feedUrl) throws Exception { return userService.getFeed(feedUrl, UserFeed.class); } ... } 

As you can see, I only annotated the getUsers method. The retrieveSuspendedUsers method is not annotated.

The spring configuration looks like this:


Now, when I invoke the getUsers method, everything works correctly. AOP invokes it only once. But when I invoke the method retrieveSuspendedUsers - AOP invokes it twice for each page (I get the users page by page with a page size equal to 100). I can see in the following lines:

  2013-03-11 13:06:40,179 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:40,180 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13: 06: 40,179 DEBUG [pool-2-thread-1] Invoking a getUsers API query with arguments [https: // domain. com / user / 2.0 /] 2013-03-11 13:06:40,179 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:40,180 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully  2013-03-11 13:06:40,179 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:40,180 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13: 06: 40,180 DEBUG [pool-2-thread-1] Invokes a getUsers API request with arguments [https://domain.com/user/ 2013-03-11 13:06:40,179 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:40,180 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13: 06: 41,745 DEBUG [pool-2-thread-1] Invokes the getUsers API request with arguments [https: / / /domain.com/user/2.0/] term  2012-03-11 2013-03-11 13:06:40,179 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:40,180 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 2013-03-11 13:06:41,745 DEBUG [pool-2-thread-1] Invoke API request getUsers with arguments [https://domain.com/user/2.0/] finished successfully 

The API call takes a lot of time and I wish to avoid an additional and unnecessary call. How to fix this behavior?

The answer

AFAIK pointing interceptions are called for both call and execution events of point counts. You can filter to match only the execution method in your points cut:

 @Around("execution(* *(..)) && @annotation(com.test.RequestRetriable)")