@Override public <T> T execute(CommandConfig config, Command<T> command) { if (calledInsideTransaction()) { log.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(config, command); } else { return super.execute(config, command); } }
public <T> T execute(CommandConfig config, Command<T> command) { long waitTime = waitTimeInMs; int failedAttempts = 0; do { if (failedAttempts > 0) { log.info("Waiting for {}ms before retrying the command.", waitTime); waitBeforeRetry(waitTime); waitTime *= waitIncreaseFactor; } try { // try to execute the command return next.execute(config, command); } catch (ActivitiOptimisticLockingException e) { log.info("Caught optimistic locking exception: " + e); } failedAttempts++; } while (failedAttempts <= numOfRetries); throw new ActivitiException(numOfRetries + " retries failed with ActivitiOptimisticLockingException. Giving up."); }
@Override public <T> T execute(CommandConfig config, Command<T> command) { if (calledInsideTransaction()) { LOGGER.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(config, command); } else { return super.execute(config, command); } }
public <T> T execute(CommandConfig config, Command<T> command) { long waitTime = waitTimeInMs; int failedAttempts = 0; do { if (failedAttempts > 0) { log.info("Waiting for {}ms before retrying the command.", waitTime); waitBeforeRetry(waitTime); waitTime *= waitIncreaseFactor; } try { // try to execute the command return next.execute(config, command); } catch (ActivitiOptimisticLockingException e) { log.info("Caught optimistic locking exception: " + e); } failedAttempts++; } while (failedAttempts <= numOfRetries); throw new ActivitiException(numOfRetries + " retries failed with ActivitiOptimisticLockingException. Giving up."); }
@Override public <T> T execute(CommandConfig config, Command<T> command) { if (calledInsideTransaction()) { log.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(config, command); } else { return super.execute(config, command); } }
public <T> T execute(Command<T> command) { long waitTime=waitTimeInMs; int failedAttempts=0; do { if (failedAttempts > 0) { log.info( "Waiting for {}ms before retrying the command.", waitTime); waitBeforeRetry(waitTime); waitTime *= waitIncreaseFactor; } try { // try to execute the command return next.execute(command); } catch (ActivitiOptimisticLockingException e) { log.info("Caught optimistic locking exception: "+e); } failedAttempts ++; } while(failedAttempts<=numOfRetries); throw new ActivitiException(numOfRetries + " retries failed with ActivitiOptimisticLockingException. Giving up."); }
@Override public <T> T execute(Command<T> command) { if (calledInsideTransaction()) { log.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(command); } else { return super.execute(command); } }
@Override public <T> T execute(CommandConfig config, Command<T> command) { long waitTime = waitTimeInMs; int failedAttempts = 0; do { if (failedAttempts > 0) { LOGGER.info("Waiting for {}ms before retrying the command.", waitTime); waitBeforeRetry(waitTime); waitTime *= waitIncreaseFactor; } try { // try to execute the command return next.execute(config, command); } catch (ActivitiOptimisticLockingException e) { LOGGER.info("Caught optimistic locking exception: {}", e.getMessage(), e); } failedAttempts++; } while (failedAttempts <= numOfRetries); throw new ActivitiException(numOfRetries + " retries failed with ActivitiOptimisticLockingException. Giving up."); }