Skip to content

Conversation

@EddieChoCho
Copy link
Contributor

  • Modify delete method of DefaultLockRepository: improve readability
  • Modify renew method of DefaultLockRepository: improve readability

public boolean delete(String lock) {
return this.defaultTransactionTemplate.execute(
transactionStatus -> this.template.update(this.deleteQuery, this.region, lock, this.id)) > 0;
transactionStatus -> this.template.update(this.deleteQuery, this.region, lock, this.id)) == 1;
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure what difference with existing style.
How whatever you have done here helps with readability?

Copy link
Contributor Author

@EddieChoCho EddieChoCho Oct 30, 2024

Choose a reason for hiding this comment

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

I think readers can easily understand that only one lock ownership is expected to be deleted.

Copy link
Member

Choose a reason for hiding this comment

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

That's debatable. Because you see: for me this does nothing.
However to save both our time discussing this I'll go ahead and merge.

@artembilan artembilan added this to the 6.4.0 milestone Oct 30, 2024
@artembilan artembilan merged commit bab7e8d into spring-projects:main Oct 30, 2024
3 checks passed
@EddieChoCho EddieChoCho deleted the improve-readability-of-delete-and-renew-methods-of-defaultLockRepository branch October 30, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants