Skip to content

Deprecate ChainedTransactionManager #2286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.5.0-GH-2232-SNAPSHOT</version>

<name>Spring Data Core</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,32 @@
* which means the {@link PlatformTransactionManager} most likely to break the transaction should be the <em>last</em>
* in the list configured. A {@link PlatformTransactionManager} throwing an exception during commit will automatically
* cause the remaining transaction managers to roll back instead of committing.
* <p />
* As consequence, a transaction can get into a state, where the first {@link PlatformTransactionManager} has committed
* its transaction and a subsequent {@link PlatformTransactionManager} failed to commit its transaction (e.g. caused by
* an I/O error or the transactional resource failed to commit for other reasons). In that case,
* {@link #commit(TransactionStatus)} throws a {@link HeuristicCompletionException} to indicate a partially committed
* transaction. Rollback isn't affected as the natural consequence of a missing commit is a rollback of a transactional
* resource. {@link ChainedTransactionManager} should be only used if the application can tolerate or recover from
* inconsistent state caused by partially committed transactions. In any other case, the use of
* {@link ChainedTransactionManager} is not recommended.
* <p/>
* Instead of using {@link ChainedTransactionManager} for attaching callbacks to transaction commit (pre commit/post
* commit), either register a {@link org.springframework.transaction.reactive.TransactionSynchronization} to explicitly
* follow transaction cleanup with simplified semantics in case of exceptions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "either" seems to be missing an "or".

*
* @author Michael Hunger
* @author Oliver Gierke
* @author Mark Paluch
* @since 1.6
* @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit(boolean)
* @see org.springframework.transaction.support.TransactionSynchronization#afterCommit()
* @deprecated since 2.5
*/
@Deprecated
public class ChainedTransactionManager implements PlatformTransactionManager {

private final static Log logger = LogFactory.getLog(ChainedTransactionManager.class);
private final static Log logger = LogFactory.getLog(ChainedTransactionManager.class);

private final List<PlatformTransactionManager> transactionManagers;
private final SynchronizationManager synchronizationManager;
Expand Down Expand Up @@ -156,7 +174,7 @@ public void commit(TransactionStatus status) throws TransactionException {

} else {

// after unsucessfull commit we must try to rollback remaining transaction managers
// after unsuccessful commit we must try to rollback remaining transaction managers

try {
multiTransactionStatus.rollback(transactionManager);
Expand Down