Skip to content

Commit 74cf5fc

Browse files
artembilancppwfs
authored andcommitted
GH-10906: DefaultLockRepository: Use LocalDateTime directly (#10908)
Fixes: #10906 The `Timestamp.valueOf()` method uses the system default time zone which may lead to discrepancy when daylight saving happens According to JDBC 4.2+, we don't need to convert `LocalDateTime` to `Timestamp` anymore * Fix `DefaultLockRepository` to use `LocalDateTime` as values for SQL statements instead of wrapping them into `Timestamp` There are no any new tests since this internal change does not affect API logic, and existing working tests prove that everything is still right **Auto-cherry-pick to `7.0.x` & `6.5.x`**
1 parent 0479b79 commit 74cf5fc

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.integration.jdbc.lock;
1818

19-
import java.sql.Timestamp;
2019
import java.time.Duration;
2120
import java.time.LocalDateTime;
2221
import java.time.ZoneOffset;
@@ -440,12 +439,12 @@ public boolean renew(String lock) {
440439
return Boolean.TRUE.equals(result);
441440
}
442441

443-
private Timestamp ttlEpochMillis() {
444-
return Timestamp.valueOf(currentTime().minus(this.ttl));
442+
private LocalDateTime ttlEpochMillis() {
443+
return currentTime().minus(this.ttl);
445444
}
446445

447-
private static Timestamp epochMillis() {
448-
return Timestamp.valueOf(currentTime());
446+
private static LocalDateTime epochMillis() {
447+
return currentTime();
449448
}
450449

451450
private static LocalDateTime currentTime() {

0 commit comments

Comments
 (0)