From bab7e8d579c7ae8704ea9898cc31dff09b1a54a7 Mon Sep 17 00:00:00 2001 From: Eddie Cho Date: Wed, 30 Oct 2024 21:01:04 +0100 Subject: [PATCH] DefaultLockRepository: Use `== 1` for `delete` and `renew` query results Some claim that it might improve code readability. --- .../integration/jdbc/lock/DefaultLockRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java index d8dd4ee94a..1c6fe23b1e 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java @@ -392,7 +392,7 @@ public class DefaultLockRepository @Override 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; } @Override @@ -436,7 +436,7 @@ public class DefaultLockRepository public boolean renew(String lock) { final Boolean result = this.defaultTransactionTemplate.execute( transactionStatus -> - this.template.update(this.renewQuery, epochMillis(), this.region, lock, this.id) > 0); + this.template.update(this.renewQuery, epochMillis(), this.region, lock, this.id) == 1); return Boolean.TRUE.equals(result); }