Skip to content

About Transactions #24

Description

@chiaradiamarcelo

Hi @thombergs,

I was taking a look at the implementation of the SendMoneyService (https://github.com/thombergs/buckpal/blob/master/src/main/java/io/reflectoring/buckpal/account/application/service/SendMoneyService.java).

It seems you are implementing pessimistic locking by explicitly locking the banck accounts with the AccountLock.

I can see that you also handle the transaction (either commit/rollback) with javax's Transactional.

Given that the locks on the bank accounts are released before the transaction is committed/rollback, how can you make sure that in between (ie, when the locks are released but before the commit/rollback is done) there's not another transaction executed with the same bank accounts before this one is fully finished?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions