Example usage for org.springframework.transaction.interceptor RollbackRuleAttribute RollbackRuleAttribute

List of usage examples for org.springframework.transaction.interceptor RollbackRuleAttribute RollbackRuleAttribute

Introduction

In this page you can find the example usage for org.springframework.transaction.interceptor RollbackRuleAttribute RollbackRuleAttribute.

Prototype

public RollbackRuleAttribute(String exceptionName) 

Source Link

Document

Create a new instance of the RollbackRuleAttribute class for the given exceptionName .

Usage

From source file:eap.config.TxAdviceBeanDefinitionParser.java

private void addRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String rollbackForValue) {
    String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(rollbackForValue);
    for (String typeName : exceptionTypeNames) {
        rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(typeName)));
    }/* w w  w  .  j  ava  2  s .co m*/
}

From source file:org.springframework.batch.core.step.item.FaultTolerantStepFactoryBeanRollbackTests.java

@Test
public void testNonDefaultRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
    editor.setAsText("+RuntimeException,+SkippableException");
    RuleBasedTransactionAttribute attr = (RuleBasedTransactionAttribute) editor.getValue();
    attr.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
    assertTrue(attr.rollbackOn(new Exception("")));
    assertFalse(attr.rollbackOn(new RuntimeException("")));
    assertFalse(attr.rollbackOn(new SkippableException("")));
}