Skip to content

Commit f359c11

Browse files
committed
Polishing
1 parent 8158b6f commit f359c11

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ public enum Propagation {
8787

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

spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -553,7 +553,7 @@ protected int determineTimeout(TransactionDefinition definition) {
553553
if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
554554
return definition.getTimeout();
555555
}
556-
return this.defaultTimeout;
556+
return getDefaultTimeout();
557557
}
558558

559559

@@ -1099,6 +1099,8 @@ protected boolean useSavepointForNestedTransaction() {
10991099
* @param definition a TransactionDefinition instance, describing propagation
11001100
* behavior, isolation level, read-only flag, timeout, and transaction name
11011101
* @throws TransactionException in case of creation or system errors
1102+
* @throws org.springframework.transaction.NestedTransactionNotSupportedException
1103+
* if the underlying transaction does not support nesting
11021104
*/
11031105
protected abstract void doBegin(Object transaction, TransactionDefinition definition)
11041106
throws TransactionException;

spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -292,10 +292,11 @@ public static void registerSynchronization(TransactionSynchronization synchroniz
292292
throws IllegalStateException {
293293

294294
Assert.notNull(synchronization, "TransactionSynchronization must not be null");
295-
if (!isSynchronizationActive()) {
295+
Set<TransactionSynchronization> synchs = synchronizations.get();
296+
if (synchs == null) {
296297
throw new IllegalStateException("Transaction synchronization is not active");
297298
}
298-
synchronizations.get().add(synchronization);
299+
synchs.add(synchronization);
299300
}
300301

301302
/**

0 commit comments

Comments
 (0)