Package org.springframework.retry

Examples of org.springframework.retry.RetryState


  @Test
  public void testRecover() throws Throwable {
    retryTemplate.setRetryPolicy(new SimpleRetryPolicy(1, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
    final String input = "foo";
    RetryState state = new DefaultRetryState(input);
    RetryCallback<String, Exception> callback = new RetryCallback<String, Exception>() {
      public String doWithRetry(RetryContext context) throws Exception {
        throw new RuntimeException("Barf!");
      }
    };
View Full Code Here


    BinaryExceptionClassifier classifier = new BinaryExceptionClassifier(Collections
        .<Class<? extends Throwable>> singleton(DataAccessException.class));
    // ...but not these:
    assertFalse(classifier.classify(new RuntimeException()));
    final String input = "foo";
    RetryState state = new DefaultRetryState(input, classifier);
    RetryCallback<String, Exception> callback = new RetryCallback<String, Exception>() {
      public String doWithRetry(RetryContext context) throws Exception {
        throw new RuntimeException("Barf!");
      }
    };
View Full Code Here

    RetryPolicy retryPolicy = new SimpleRetryPolicy(1, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true));
    retryTemplate.setRetryPolicy(retryPolicy);

    final String input = "foo";
    RetryState state = new DefaultRetryState(input);
    RetryCallback<String, Exception> callback = new RetryCallback<String, Exception>() {
      public String doWithRetry(RetryContext context) throws Exception {
        throw new RuntimeException("Barf!");
      }
    };
View Full Code Here

    RetryPolicy retryPolicy = new SimpleRetryPolicy(3, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true));
    retryTemplate.setRetryPolicy(retryPolicy);
    final StringHolder item = new StringHolder("bar");
    RetryState state = new DefaultRetryState(item);

    RetryCallback<StringHolder, Exception> callback = new RetryCallback<StringHolder, Exception>() {
      public StringHolder doWithRetry(RetryContext context) throws Exception {
        // This simulates what happens if someone uses a primary key
        // for hashCode and equals and then relies on default key
View Full Code Here

    SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(1, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true));
    retryTemplate.setRetryPolicy(retryPolicy);
    retryTemplate.setRetryContextCache(new MapRetryContextCache(2));
    final StringHolder item = new StringHolder("foo");
    RetryState state = new DefaultRetryState(item);

    RetryCallback<Object, Exception> callback = new RetryCallback<Object, Exception>() {
      public Object doWithRetry(RetryContext context) throws Exception {
        count++;
        throw new RuntimeException("Barf!");
View Full Code Here

TOP

Related Classes of org.springframework.retry.RetryState

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.