/** * Getter for the {@link TransactionAttribute} for subclasses only. * @return the transactionAttribute */ @SuppressWarnings("serial") protected TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute attribute = new DefaultTransactionAttribute(); attribute.setPropagationBehavior(propagation.value()); attribute.setIsolationLevel(isolation.value()); attribute.setTimeout(transactionTimeout); return new DefaultTransactionAttribute(attribute) { /** * Ignore the default behaviour and rollback on all exceptions that bubble up to the tasklet level. The * tasklet has to deal with the rollback rules internally. */ @Override public boolean rollbackOn(Throwable ex) { return true; } }; }
public TransactionInterceptorBuilder timeout(int timeout) { this.transactionAttribute.setTimeout(timeout); return this; }
@Test public void testDefaultTransactionAttributeToString() { DefaultTransactionAttribute source = new DefaultTransactionAttribute(); source.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS); source.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ); source.setTimeout(10); source.setReadOnly(true); TransactionAttributeEditor pe = new TransactionAttributeEditor(); pe.setAsText(source.toString()); TransactionAttribute ta = (TransactionAttribute) pe.getValue(); assertEquals(ta, source); assertEquals(TransactionDefinition.PROPAGATION_SUPPORTS, ta.getPropagationBehavior()); assertEquals(TransactionDefinition.ISOLATION_REPEATABLE_READ, ta.getIsolationLevel()); assertEquals(10, ta.getTimeout()); assertTrue(ta.isReadOnly()); assertTrue(ta.rollbackOn(new RuntimeException())); assertFalse(ta.rollbackOn(new Exception())); source.setTimeout(9); assertNotSame(ta, source); source.setTimeout(10); assertEquals(ta, source); }
attribute.setTimeout(transactionTimeout);
public TransactionInterceptorBuilder timeout(int timeout) { this.transactionAttribute.setTimeout(timeout); return this; }
public TransactionInterceptorBuilder timeout(int timeout) { this.transactionAttribute.setTimeout(timeout); return this; }
public TransactionInterceptorBuilder timeout(int timeout) { this.transactionAttribute.setTimeout(timeout); return this; }
/** * Getter for the {@link TransactionAttribute} for subclasses only. * @return the transactionAttribute */ @SuppressWarnings("serial") protected TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute attribute = new DefaultTransactionAttribute(); attribute.setPropagationBehavior(propagation.value()); attribute.setIsolationLevel(isolation.value()); attribute.setTimeout(transactionTimeout); return new DefaultTransactionAttribute(attribute) { /** * Ignore the default behaviour and rollback on all exceptions that bubble up to the tasklet level. The * tasklet has to deal with the rollback rules internally. */ @Override public boolean rollbackOn(Throwable ex) { return true; } }; }
/** * Getter for the {@link TransactionAttribute} for subclasses only. * @return the transactionAttribute */ @SuppressWarnings("serial") protected TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute attribute = new DefaultTransactionAttribute(); attribute.setPropagationBehavior(propagation.value()); attribute.setIsolationLevel(isolation.value()); attribute.setTimeout(transactionTimeout); return new DefaultTransactionAttribute(attribute) { /** * Ignore the default behaviour and rollback on all exceptions that bubble up to the tasklet level. The * tasklet has to deal with the rollback rules internally. */ @Override public boolean rollbackOn(Throwable ex) { return true; } }; }
/** * Getter for the {@link TransactionAttribute} for subclasses only. * @return the transactionAttribute */ @SuppressWarnings("serial") protected TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute attribute = new DefaultTransactionAttribute(); attribute.setPropagationBehavior(propagation.value()); attribute.setIsolationLevel(isolation.value()); attribute.setTimeout(transactionTimeout); return new DefaultTransactionAttribute(attribute) { /** * Ignore the default behaviour and rollback on all exceptions that * bubble up to the tasklet level. The tasklet has to deal with the * rollback rules internally. */ @Override public boolean rollbackOn(Throwable ex) { return true; } }; }
/** * Getter for the {@link TransactionAttribute} for subclasses only. * @return the transactionAttribute */ @SuppressWarnings("serial") protected TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute attribute = new DefaultTransactionAttribute(); attribute.setPropagationBehavior(propagation.value()); attribute.setIsolationLevel(isolation.value()); attribute.setTimeout(transactionTimeout); return new DefaultTransactionAttribute(attribute) { /** * Ignore the default behaviour and rollback on all exceptions that bubble up to the tasklet level. The * tasklet has to deal with the rollback rules internally. */ @Override public boolean rollbackOn(Throwable ex) { return true; } }; }
attribute.setTimeout(transactionTimeout);
attribute.setTimeout(transactionTimeout);
attribute.setTimeout(transactionTimeout);
attribute.setTimeout(transactionTimeout);