List of usage examples for org.springframework.transaction.interceptor RollbackRuleAttribute RollbackRuleAttribute
public RollbackRuleAttribute(String exceptionName)
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(""))); }