Skip to content
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

About Transactions #24

Open
chiaradiamarcelo opened this issue Mar 15, 2021 · 0 comments
Open

About Transactions #24

chiaradiamarcelo opened this issue Mar 15, 2021 · 0 comments

Comments

@chiaradiamarcelo
Copy link

chiaradiamarcelo commented Mar 15, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant