Package org.springframework.classify

Examples of org.springframework.classify.BinaryExceptionClassifier.classify()


          : noRollbackExceptionClasses;
      final BinaryExceptionClassifier classifier = new BinaryExceptionClassifier(exceptions, false);
      builder.transactionAttribute(new DefaultTransactionAttribute(attribute) {
        @Override
        public boolean rollbackOn(Throwable ex) {
          return classifier.classify(ex);
        }
      });
    }
    if (streams != null) {
      for (ItemStream stream : streams) {
View Full Code Here


    Classifier<Throwable, Boolean> classifier = new BinaryExceptionClassifier(noRollbackExceptionClasses, false);

    // Try to avoid pathological cases where we cannot force a rollback
    // (should be pretty uncommon):
    if (!classifier.classify(new ForceRollbackForWriteSkipException("test", new RuntimeException()))
        || !classifier.classify(new ExhaustedRetryException("test"))) {

      final Classifier<Throwable, Boolean> binary = classifier;

      Collection<Class<? extends Throwable>> types = new HashSet<Class<? extends Throwable>>();
View Full Code Here

    Classifier<Throwable, Boolean> classifier = new BinaryExceptionClassifier(noRollbackExceptionClasses, false);

    // Try to avoid pathological cases where we cannot force a rollback
    // (should be pretty uncommon):
    if (!classifier.classify(new ForceRollbackForWriteSkipException("test", new RuntimeException()))
        || !classifier.classify(new ExhaustedRetryException("test"))) {

      final Classifier<Throwable, Boolean> binary = classifier;

      Collection<Class<? extends Throwable>> types = new HashSet<Class<? extends Throwable>>();
      types.add(ForceRollbackForWriteSkipException.class);
View Full Code Here

      classifier = new Classifier<Throwable, Boolean>() {
        @Override
        public Boolean classify(Throwable classifiable) {
          // Rollback if either the user's list or our own applies
          return panic.classify(classifiable) || binary.classify(classifiable);
        }
      };

    }
View Full Code Here

        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
    // Roll back for these:
    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

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.