Skip to content

Rename TransactionSynchronizationManager#currentTransaction to something more meaningful #23086

Closed

Description

@michael-simons

I am working currently on implementing reactive Transactions with our new Neo4j reactive driver and need to access the reactive transaction synchronisation manager through

...reactive.TransactionSynchronizationManager#currentTransaction

The JavaDoc says "…Return the TransactionSynchronizationManager of the current transaction…"

I understand that TransactionSynchronizationManager is merely a wrapper around the TransactionContext.

Neither the manager nor the context are the transaction itself and therefor I think that the currentTransaction() would benefit from another name, like current TransactionSynchronizationManager() or currentTransactionContext(); it's intentions would be clearer.

cc @mp911de

Activity

  1. added
    status: waiting-for-triage
    on Jun 5, 2019
  2. added
    status: pending-design-work
    in: data
    type: enhancement
    and removed
    status: waiting-for-triage
    on Jun 5, 2019
  3. added this to the 5.2 M3 milestone on Jun 5, 2019
  4. sbrannen commented on Jun 5, 2019

    @sbrannen
    Member

    Tentatively slated for 5.2 M3

  5. changed the title [-]Method naming: TransactionSynchronizationManager#currentTransaction is irritating[/-] [+]Rename TransactionSynchronizationManager#currentTransaction to something more meaningful[/+] on Jun 5, 2019
  6. mp911de commented on Jun 5, 2019

    @mp911de
    Member

    To add a bit of background: The reactive TransactionSynchronizationManager isn't associated with a transaction/TransactionContext, it is a wrapper to interact with resources and synchronizations stored in TransactionContext.

    Renaming that method to forCurrentTransaction() could be more expressive. current TransactionSynchronizationManager is rather bulky. As Javadoc could be always improved, we could refine it along the lines of Return the TransactionSynchronizationManager that is associated with the current transaction context.

  7. michael-simons commented on Jun 5, 2019

    @michael-simons
    ContributorAuthor

    A big +1 for forCurrentTransaction(). That reads nice and shows the purpose.

  8. sbrannen commented on Jun 5, 2019

    @sbrannen
    Member

    A big +1 for forCurrentTransaction(). That reads nice and shows the purpose.

    That sounds better to me as well.

    So, unless someone objects, I'll go ahead and make the proposed name change and Javadoc improvement.

  9. self-assigned this
    on Jun 5, 2019
  10. added
    status: feedback-provided
    and removed
    status: pending-design-work
    on Jun 5, 2019
  11. added a commit that references this issue on Jun 5, 2019
    2ed9a61
  12. snicoll commented on Jun 8, 2019

    @snicoll
    Member

    @sbrannen shouldn't we keep the existing method in a deprecated fashion at least for one feature release?

  13. jhoeller commented on Jun 8, 2019

    @jhoeller
    Contributor

    @snicoll this just affects the reactive transaction support, so it's new API in 5.2 anyway.

  14. davidkiss commented on Aug 30, 2019

    @davidkiss

    This is a breaking change for spring-data-r2dbc v1.0 M2 (see spring-projects/spring-data-r2dbc#154) and spring-fu's latest version.

  15. sbrannen commented on Aug 31, 2019

    @sbrannen
    Member

    This is a breaking change for spring-data-r2dbc v1.0 M2 (see spring-projects/spring-data-r2dbc#154) and spring-fu's latest version.

    As @jhoeller already pointed out in #23086 (comment), the API in question is new in Spring Framework 5.2 and is therefore allowed to be renamed before the 5.2 GA release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: datastatus: feedback-providedtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions