Commit Graph

403 Commits

Author SHA1 Message Date
Sam Brannen
70e6606f0f Improve @Transactional docs regarding method visibility
Closes gh-27003
2021-05-30 17:16:08 +02:00
Sam Brannen
911aca17ea Doc tx semantics for @TransactionalEventListener after completion phases
This commit improves the Javadoc regarding transactional semantics for
@TransactionalEventListener methods invoked in the AFTER_COMMIT,
AFTER_ROLLBACK, or AFTER_COMPLETION phase. Specifically, the
documentation now points out that interactions with the underlying
transactional resource will not be committed in those phases.

Closes gh-26974
2021-05-26 14:27:16 +02:00
Juergen Hoeller
dd3262bfe3 Polishing (backported from master) 2021-02-25 19:08:53 +01:00
Juergen Hoeller
322babc04a Document that @Transactional does not propagate to new threads
Closes gh-25439
2020-11-17 16:16:24 +01:00
Juergen Hoeller
d022fcf32f Explicit note on TransactionalEventListener versus reactive transactions
Closes gh-25805
2020-09-25 12:49:45 +02:00
Sam Brannen
f5d36aa47a Revert use of Map::computeIfAbsent in thread and tx scopes
Issues gh-25038 and gh-25618 collectively introduced a regression for
thread-scoped and transaction-scoped beans.

For example, given a thread-scoped bean X that depends on another
thread-scoped bean Y, if the names of the beans (when used as map keys)
end up in the same bucket within a ConcurrentHashMap AND an attempt is
made to retrieve bean X from the ApplicationContext prior to retrieving
bean Y, then the use of Map::computeIfAbsent in SimpleThreadScope
results in recursive access to the same internal bucket in the map.

On Java 8, that scenario simply hangs. On Java 9 and higher,
ConcurrentHashMap throws an IllegalStateException pointing out that a
"Recursive update" was attempted.

In light of these findings, we are reverting the changes made to
SimpleThreadScope and SimpleTransactionScope in commits 50a4fdac6e and
148dc95eb1.

Closes gh-25801
2020-09-25 11:00:06 +02:00
Juergen Hoeller
cf2e0c7959 Selected use of ArrayList instead of LinkedList in common places
See gh-25652
2020-08-27 14:14:44 +02:00
Sam Brannen
148dc95eb1 Fix regressions in SimpleThreadScope and SimpleTransactionScope
PR gh-25038 introduced regressions in SimpleThreadScope and
SimpleTransactionScope in Spring Framework 5.2.7. Specifically, if a
thread-scoped or transaction-scoped bean has a dependency on another
thread-scoped or transaction-scoped bean, respectively, a
ConcurrentModificationException will be thrown on Java 11 or higher.

The reason is that Java 11 introduced a check for concurrent
modification in java.util.HashMap's computeIfAbsent() implementation,
and such a modification can occur when a thread-scoped bean is being
created in order to satisfy a dependency of another thread-scoped bean
that is currently being created.

This commit fixes these regressions by switching from HashMap to
ConcurrentHashMap for the instance maps in SimpleThreadScope and
SimpleTransactionScope.

Closes gh-25618
2020-08-22 23:19:58 +02:00
Juergen Hoeller
8dd285f877 Polishing 2020-08-07 13:02:43 +02:00
Juergen Hoeller
b0cabb29f3 Polishing 2020-06-23 23:20:45 +02:00
Juergen Hoeller
a08bf8c063 Avoid misleading log message for commit-triggering exception
Closes gh-25253
2020-06-17 15:39:41 +02:00
Juergen Hoeller
ae1ed9d458 Document exception handling limitations in TaskDecorator implementations
Closes gh-25231
2020-06-10 22:52:01 +02:00
Rossen Stoyanchev
9e1121fd8d Document behavior on reactive tx cancellation
Closes gh-25091
2020-06-08 17:43:52 +01:00
Juergen Hoeller
cd4ef6f781 Consistently refer to FlushMode.MANUAL instead of outdated NEVER
Closes gh-25158
2020-05-29 15:51:54 +02:00
Juergen Hoeller
1dea55dc20 WebSphereUowTransactionManager sets timeout for actual transaction only
Closes gh-25132
2020-05-26 23:34:36 +02:00
Yanming Zhou
50a4fdac6e Use Map::computeIfAbsent to simplify scope implementations
Closes gh-25038
2020-05-10 15:41:00 +02:00
Sam Brannen
f5d011cb82 Filter reactive tx managers in TransactionAttributeSourceClassFilter
Prior to this commit, the TransactionAttributeSourceClassFilter
filtered out PlatformTransactionManager but not
ReactiveTransactionManager implementations.

TransactionAttributeSourceClassFilter now filters out any
TransactionManager implementation, covering both imperative and
reactive transaction managers.
2020-05-09 13:57:03 +02:00
Sam Brannen
ec3d647d1d Update spring-tx.xsd regarding reactive tx mgmt support
Closes gh-25030
2020-05-08 19:49:00 +02:00
Sam Brannen
0f22a5e409 Update Javadoc regarding reactive tx mgmt support
See gh-25030
2020-05-08 19:25:22 +02:00
Sam Brannen
1d0c5195bc Polish Javadoc for TransactionManagementConfigurer 2020-04-06 15:31:48 +02:00
Sam Brannen
144b0e1437 Test status quo for @Primary + TransactionManagementConfigurer
This commit introduces tests for the status quo in production support
for multiple transaction managers registered as @Primary and via the
TransactionManagementConfigurer API.

See gh-24869
2020-04-06 15:16:31 +02:00
Sam Brannen
f8ab19dc68 Ensure @EnableTxMgmt tests actually test something 2020-04-06 14:32:34 +02:00
Sam Brannen
e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Qimiao Chen
70581d1ea2 Improve javadoc in RollbackRuleAttribute regarding nested classes
Closes gh-24682

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-03-15 12:06:16 +01:00
Juergen Hoeller
193f419520 Deprecate PTM-based constructors in favor of generic TransactionManager
Closes gh-24612
2020-03-11 14:52:03 +01:00
Rossen Stoyanchev
adc13f2030 Polishing contribution
See gh-24493
2020-02-20 17:58:47 +00:00
陈其苗
a09f02f64e Minor refactoring in AbstractPlatformTransactionManager
See gh-24493
2020-02-20 17:33:18 +00:00
Juergen Hoeller
d1c7083e77 Consistent ROLE_INFRASTRUCTURE declarations for configuration classes
Closes gh-24509
2020-02-12 16:49:02 +01:00
Michael Simons
711fafc924 Improve assertion message in PersistenceExceptionTranslationInterceptor
Closes gh-24484
2020-02-06 15:41:33 +01:00
Sam Brannen
5581f3b77b Use Gradle test fixture support for spring-tx
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
726b1bb1d0 Rename test fixture package in spring-context
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Juergen Hoeller
a4f75e9c6a Polishing 2019-12-09 13:29:00 +01:00
Sam Brannen
9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis
3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller
43a86565ca Consider target transaction manager for reactive transaction decision
Closes gh-23832
2019-10-30 16:23:37 +01:00
Mark Paluch
0d8aa854e8 Add tests for cancellation of transactional streams
See gh-23864

Closes gh-23873
2019-10-25 17:16:33 +02:00
Andreas Killaitis
f838590300 Commit on cancelled subscription in TransactionalOperator::transactional
Prior to this commit, TransactionalOperator::transactional did not close
the transaction when cancelled.

Closes gh-23864
2019-10-25 14:48:46 +02:00
Sebastien Deleuze
b24ac74106 Restore TransactionOperations Kotlin API compatibilty
This commit renames the Runnable variant to executeWithoutResult
and uses a Consumer<TransactionStatus> parameter for better
consistency with TransactionCallbackWithoutResult.

Closes gh-23724
2019-09-29 19:31:12 +02:00
Juergen Hoeller
2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sebastien Deleuze
091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Juergen Hoeller
a48c13ae73 Avoid deprecated usingWhen method in Reactor 3.3
Closes gh-23562
2019-09-20 21:54:18 +02:00
Mark Paluch
393a81d4a9 Omit cancellation of transactional Monos in TransactionOperator
TransactionOperator.as(Mono) now no longer short-cuts via a Flux.next() but provides an implementation via Mono.usingWhen(…).
The short-cut previously issued a cancellation signal to the transactional Mono causing the transaction cleanup to happen without a handle for synchronization.

Using Mono.usingWhen(…) initiates transaction cleanup when the Mono completes eliminating the need for cancellation of the transactional Publisher.

This change does not fully fix gh-23304 but it softens its impact because TransactionalOperator.transactional(Mono) avoids cancellation.
2019-09-20 20:48:39 +02:00
Sebastien Deleuze
fc6480631e Improve Coroutines transaction API
As a follow-up of gh-22915, the purpose of this commit is to improve
Coroutines programmatic transaction API to make it more consistent with
the Java one and more idiomatic.

For suspending functions, this commit changes the
TransactionalOperator.transactional extension with a suspending lambda
parameter to a TransactionalOperator.executeAndAwait one which is
conceptually closer to TransactionalOperator.execute Java API so more
consistent.

For Flow, the TransactionalOperator.transactional extension is correct
but would be more idiomatic as a Flow extension.

This commit also adds code samples to the reference documentation.

Closes gh-23627
2019-09-12 14:45:03 +02:00
康智冬
0d742cf3d0 Fix typos related to indefinite articles for SQL acronym
Closes gh-23603
2019-09-07 16:04:47 +02:00
Phillip Webb
deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sebastien Deleuze
70bbe71235 Polishing
See gh-22915
2019-09-04 18:24:35 +02:00