Package org.springframework.retry.support

Examples of org.springframework.retry.support.DefaultRetryState


              public Object doWithRetry(RetryContext context) throws Exception {
                writer.write(Collections.singletonList(item));
                return null;
              }
            };
            return retryTemplate.execute(callback, new DefaultRetryState(item));
          }
          catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
          }
        }
      });
      fail("Expected Exception");
    }
    catch (Exception e) {

      assertEquals("Rollback!", e.getMessage());

      // Client of retry template has to take care of rollback. This would
      // be a message listener container in the MDP case.

    }

    new TransactionTemplate(transactionManager).execute(new TransactionCallback<Object>() {
      @Override
      public Object doInTransaction(TransactionStatus status) {
        try {
          final String item = provider.read();
          RetryCallback<Object, Exception> callback = new RetryCallback<Object, Exception>() {
            @Override
            public Object doWithRetry(RetryContext context) throws Exception {
              writer.write(Collections.singletonList(item));
              return null;
            }
          };
          return retryTemplate.execute(callback, new DefaultRetryState(item));
        }
        catch (Exception e) {
          throw new RuntimeException(e.getMessage(), e);
        }
      }
View Full Code Here


      try {
        result = new TransactionTemplate(transactionManager).execute(new TransactionCallback<String>() {
          @Override
          public String doInTransaction(TransactionStatus status) {
            try {
              return retryTemplate.execute(callback, recoveryCallback, new DefaultRetryState(item));
            }
            catch (Exception e) {
              throw new RuntimeException(e.getMessage(), e);
            }
          }
View Full Code Here

      public String doWithRetry(RetryContext context) throws Exception {
        assertTrue("Wrong context type: " + context.getClass().getSimpleName(), context.getClass()
            .getSimpleName().contains("Batch"));
        return "2";
      }
    }, Arrays.<RetryState> asList(new DefaultRetryState("1")));

    assertEquals("2", result);

  }
View Full Code Here

        }
        return new String[] { "a", "b" };
      }
    };

    List<RetryState> states = Arrays.<RetryState> asList(new DefaultRetryState("1"), new DefaultRetryState("2"));
    try {
      template.execute(retryCallback, states);
      fail("Expected RecoverableException");
    }
    catch (RecoverableException e) {
View Full Code Here

                throw new IllegalStateException(e);
              }
              return msg;
            }
          };
          retryTemplate.execute(callback, recoveryCallback, new DefaultRetryState(msg.getJMSMessageID()));
        }
        catch (Exception e) {
          throw (RuntimeException) e;
        }
      }
View Full Code Here

TOP

Related Classes of org.springframework.retry.support.DefaultRetryState

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.