Polishing

This commit is contained in:
Juergen Hoeller 2019-05-02 17:28:32 +02:00
parent 8158b6fd86
commit f359c117d3
3 changed files with 11 additions and 8 deletions

View File

@ -87,11 +87,11 @@ public enum Propagation {
/** /**
* Execute within a nested transaction if a current transaction exists, * Execute within a nested transaction if a current transaction exists,
* behave like {@code REQUIRED} else. There is no analogous feature in EJB. * behave like {@code REQUIRED} otherwise. There is no analogous feature in EJB.
* <p>Note: Actual creation of a nested transaction will only work on specific * <p>Note: Actual creation of a nested transaction will only work on specific
* transaction managers. Out of the box, this only applies to the JDBC * transaction managers. Out of the box, this only applies to the JDBC
* DataSourceTransactionManager when working on a JDBC 3.0 driver. * DataSourceTransactionManager. Some JTA providers might support nested
* Some JTA providers might support nested transactions as well. * transactions as well.
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager * @see org.springframework.jdbc.datasource.DataSourceTransactionManager
*/ */
NESTED(TransactionDefinition.PROPAGATION_NESTED); NESTED(TransactionDefinition.PROPAGATION_NESTED);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -553,7 +553,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
return definition.getTimeout(); return definition.getTimeout();
} }
return this.defaultTimeout; return getDefaultTimeout();
} }
@ -1099,6 +1099,8 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @param definition a TransactionDefinition instance, describing propagation * @param definition a TransactionDefinition instance, describing propagation
* behavior, isolation level, read-only flag, timeout, and transaction name * behavior, isolation level, read-only flag, timeout, and transaction name
* @throws TransactionException in case of creation or system errors * @throws TransactionException in case of creation or system errors
* @throws org.springframework.transaction.NestedTransactionNotSupportedException
* if the underlying transaction does not support nesting
*/ */
protected abstract void doBegin(Object transaction, TransactionDefinition definition) protected abstract void doBegin(Object transaction, TransactionDefinition definition)
throws TransactionException; throws TransactionException;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -292,10 +292,11 @@ public abstract class TransactionSynchronizationManager {
throws IllegalStateException { throws IllegalStateException {
Assert.notNull(synchronization, "TransactionSynchronization must not be null"); Assert.notNull(synchronization, "TransactionSynchronization must not be null");
if (!isSynchronizationActive()) { Set<TransactionSynchronization> synchs = synchronizations.get();
if (synchs == null) {
throw new IllegalStateException("Transaction synchronization is not active"); throw new IllegalStateException("Transaction synchronization is not active");
} }
synchronizations.get().add(synchronization); synchs.add(synchronization);
} }
/** /**