Skip to content

TransactionSynchronizationManager - throw an Exception or log a warning if a Synchronization wants to add a Synchronization and afterCompletion is already called [SPR-11590] #16214

Closed
@spring-projects-issues

Description

@spring-projects-issues

Torsten Krah opened SPR-11590 and commented

Hi,

i've got a service A which registered a TransactionSynchronization to do stuff in the afterCommit() case.
It calls a service B to index things to lucene.
I've forgot that i did already leveraged the transaction handling to the lucene service B, so i did wonder why nothing happened and no error was thrown.

After debugging i've found that A did register a Synchronization (doAfterCommit) to call B, and B did also register one (doAfterCompletion).

The one which B registered was never called because doAfterCommit is the last trigger to be called and triggerAfterCompletion was already run.

Maybe a check can be added for addSynchronization(), that it throws an Exception, if the afterCompletion trigger is already reached - or at least a log warning would be nice.


Affects: 4.0.2

Issue Links:

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions