Skip to content

Transaction#commit and Transaction#rollback #622

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

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

zhenlineo
Copy link
Contributor

Replaced Transaction#success and Transaction#failure
Changed the behaviour of AsyncTransaction#commitAsync and AsyncTransaction#rollbackAsync to throw error when committing/rolling back second time.
A transaction can be allowed to commit or rollback once, but closed multiple times.
This bring the behaviour of commit and rollback the same as 4.0 core API, as well as all other language drivers.

@zhenlineo zhenlineo force-pushed the 4.0-commit-rollback branch from a5cf951 to 324c166 Compare August 23, 2019 09:56
Changed the behaviour of `AsyncTransaction#commitAsync` and `AsyncTransaction#rollbackAsync` to throw error when committing/rolling back second time.
A transaction can be allowed to commit or rollback once, but closed multiple times.
This bring the behaviour of commit and rollback the same as 4.0 core API, as well as all other language drivers.
@zhenlineo zhenlineo force-pushed the 4.0-commit-rollback branch from 324c166 to 83d57d7 Compare August 23, 2019 14:14
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

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

LGTM. I've a couple of comments regarding error messages.

@@ -130,7 +104,7 @@ else if ( state != State.COMMITTED && state != State.ROLLED_BACK )
{
if ( state == State.COMMITTED )
{
return completedWithNull();
return failedFuture( new ClientException( "Can't commit, transaction has been committed" ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm definitely not an English guru, but I would find Can't commit, because transaction has already been committed. more descriptive. And it would be nice if we could standardise the error messages like using always Can't or Cannot in the same context.

@@ -152,7 +126,7 @@ else if ( state == State.ROLLED_BACK )
}
else if ( state == State.ROLLED_BACK )
{
return completedWithNull();
return failedFuture( new ClientException( "Can't rollback, transaction has been rolled back" ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, and also the following (unchanged) messages with regards to standardisation,

@zhenlineo zhenlineo force-pushed the 4.0-commit-rollback branch from 1b7ebd7 to 83d57d7 Compare August 30, 2019 14:16
@zhenlineo zhenlineo merged commit fcbc7fc into neo4j:4.0 Aug 30, 2019
@zhenlineo zhenlineo deleted the 4.0-commit-rollback branch August 30, 2019 15:08
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

Successfully merging this pull request may close these issues.

2 participants