Examples of RetryTemplate


Examples of org.springframework.osgi.service.importer.support.internal.support.RetryTemplate

   * if both values are the same, no restart will be applied.
   *
   * @param millisBetweenRetries The millisBetweenRetries to set.
   */
  public void setTimeout(long millisBetweenRetries) {
    RetryTemplate rt;
    int retries;

    synchronized (monitor) {
      this.retryTimeout = millisBetweenRetries;
      rt = retryTemplate;
      retries = this.retriesNumber;
    }

    if (rt != null) {
      rt.reset(retries, millisBetweenRetries);
    }
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.support.RetryTemplate

   * if both values are the same, no restart will be applied.
   *
   * @param timeoutInMillis Timeout to set, in milliseconds
   */
  public void setTimeout(long timeoutInMillis) {
    RetryTemplate rt;

    synchronized (monitor) {
      this.retryTimeout = timeoutInMillis;
      rt = retryTemplate;
    }

    if (rt != null) {
      rt.reset(timeoutInMillis);
    }
  }
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

                }
            };
        }
       
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

        /**
         * Do not have Spring AMQP re-try messages upon failure, leave it to Camel
         * @return An advice chain populated with a NeverRetryPolicy
         */
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

                }
            };
        }
       
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            return new Advice[] { retryOperation.getObject() };
        }
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

        /**
         * Do not have Spring AMQP re-try messages upon failure, leave it to Camel
         * @return An advice chain populated with a NeverRetryPolicy
         */
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

        /**
         * Do not have Spring AMQP re-try messages upon failure, leave it to Camel
         * @return An advice chain populated with a NeverRetryPolicy
         */
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

  private NewMethodArgumentsIdentifier newMethodArgumentsIdentifier;

  private RetryOperations retryOperations;

  public StatefulRetryOperationsInterceptor() {
    RetryTemplate retryTemplate = new RetryTemplate();
    retryTemplate.setRetryPolicy(new NeverRetryPolicy());
    retryOperations = retryTemplate;
  }
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

        .recoverer(getRecoverer(target, method))
        .build();
  }

  private MethodInterceptor getStatefulInterceptor(Object target, Method method, Retryable retryable) {
    RetryTemplate template = new RetryTemplate();
    template.setRetryContextCache(this.retryContextCache);
    template.setRetryPolicy(getRetryPolicy(retryable));
    template.setBackOffPolicy(getBackoffPolicy(retryable.backoff()));

    return RetryInterceptorBuilder.stateful()
        .retryOperations(template)
        .recoverer(getRecoverer(target, method))
        .keyGenerator(this.methodArgumentsKeyGenerator)
View Full Code Here

Examples of org.springframework.retry.support.RetryTemplate

  public void testExternalRetryWithFailAndNoRetry() throws Throwable {
    MockRetryCallback callback = new MockRetryCallback();

    RetryState retryState = new DefaultRetryState("foo");

    RetryTemplate retryTemplate = new RetryTemplate();
    MapRetryContextCache cache = new MapRetryContextCache();
    retryTemplate.setRetryContextCache(cache);
    retryTemplate.setRetryPolicy(new SimpleRetryPolicy(1, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));

    assertFalse(cache.containsKey("foo"));

    try {
      retryTemplate.execute(callback, retryState);
      // The first failed attempt we expect to retry...
      fail("Expected RuntimeException");
    }
    catch (RuntimeException e) {
      assertEquals(null, e.getMessage());
    }

    assertTrue(cache.containsKey("foo"));

    try {
      retryTemplate.execute(callback, retryState);
      // We don't get a second attempt...
      fail("Expected ExhaustedRetryException");
    }
    catch (ExhaustedRetryException e) {
      // This is now the "exhausted" message:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.