/** * 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.setIsolationLevel(isolation.value());
public TransactionInterceptorBuilder isolation(Isolation isolation) { Assert.notNull(isolation, "'isolation' must not be null."); this.transactionAttribute.setIsolationLevel(isolation.value()); 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); }
public TransactionInterceptorBuilder isolation(Isolation isolation) { Assert.notNull(isolation, "'isolation' must not be null."); this.transactionAttribute.setIsolationLevel(isolation.value()); return this; }
public TransactionInterceptorBuilder isolation(Isolation isolation) { Assert.notNull(isolation, "'isolation' must not be null."); this.transactionAttribute.setIsolationLevel(isolation.value()); return this; }
public TransactionInterceptorBuilder isolation(Isolation isolation) { Assert.notNull(isolation, "'isolation' must not be null."); this.transactionAttribute.setIsolationLevel(isolation.value()); return this; }
/** * Using the default transaction attribute for the job will cause the * TaskLauncher not to see the latest state in the database but rather * what is in its transaction. By setting isolation to READ_COMMITTED * The task launcher can see latest state of the db. Since the changes * to the task execution are done by the tasks. * @return DefaultTransactionAttribute with isolation set to READ_COMMITTED. */ private TransactionAttribute getTransactionAttribute() { DefaultTransactionAttribute defaultTransactionAttribute = new DefaultTransactionAttribute(); defaultTransactionAttribute.setIsolationLevel( Isolation.READ_COMMITTED.value()); return defaultTransactionAttribute; }
/** * 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.setIsolationLevel(isolation.value());
attribute.setIsolationLevel(isolation.value());
attribute.setIsolationLevel(isolation.value());
attribute.setIsolationLevel(isolation.value());