Package net.sf.sstk.retry

Examples of net.sf.sstk.retry.ArgumentSaver


    try {
      this.retryActive.set(Boolean.TRUE);
      if (definition == null) {
        return proceedIfPatient(invocation);
      }
      final ArgumentSaver argSaver = definition.getArgumentSaver();
      final Object[] origArgs = invocation.getArguments();
      if (this.patient) {
        try {
          argSaver.saveOriginalArgs(origArgs);
        } catch (ArgumentSaverException e) {
          this.logger
              .info(
                  "faild to save orig args, but beeing patient "
                      + "and do normal procceed without retry handling.",
                  e);
          return invocation.proceed();
        }
      } else {
        argSaver.saveOriginalArgs(origArgs);
      }
      try {
        return invocation.proceed();
      } catch (Throwable ex) {
        final int tries = definition.getNumberOfRetries();
View Full Code Here


      final RetryInvocation invocation, final RetryDefinition definition,
      final List exceptions) throws Throwable {
    Throwable lastEx = (Throwable) RetryHandler.getLastFromList(exceptions);
    if (tries > 0) {
      if (definition.retryOn(lastEx)) {
        ArgumentSaver argSaver = definition.getArgumentSaver();
        CleanUpContext context = this.cleanUpContextFactory
            .createCleanUpContext(invocation.getMethod(), lastEx,
                argSaver);
        CleanUpStrategy strategy = definition.getCleanUpStrategy();
        if (strategy.giveUpTotaly(context)) {
          doLog("strategy says we should give up", exceptions);
          throw lastEx;
        }
        strategy.cleanUp(context);
        Object[] loadedArgs = argSaver.restoreArgs();
        try {
          return invocation.proceed(loadedArgs);
        } catch (Throwable ex) {
          exceptions.add(ex);
          // we are in recursion, so do a bit clean up
View Full Code Here

    return createDefinition(retryAnno, this.beanFactory);
  }

  public RetryDefinition createDefinition(final Retry annotation,
      final BeanFactory beanFactory) {
    final ArgumentSaver argSaver = getArgSaver(annotation.argumentSaver());
    final CleanUpStrategy cleanUpStrategy = getCleanUpStrategy(annotation
        .cleanUpStrategy());
    return new SimpleRetryDefinition(argSaver, cleanUpStrategy, annotation
        .retryFor(), annotation.numberOfRetries());
  }
View Full Code Here

  /**
   * @param argumentSaver
   * @return
   */
  protected ArgumentSaver getArgSaver(final String argumentSaver) {
    ArgumentSaver saver = getBean(argumentSaver, ArgumentSaver.class);
    if (saver == null) {
      saver = getByMap(argumentSaver);
    }
    if (saver == null) {
      saver = getAdditionalSaver(argumentSaver);
View Full Code Here

TOP

Related Classes of net.sf.sstk.retry.ArgumentSaver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.