Skip to content

Commit 0d11c7e

Browse files
artembilangaryrussell
authored andcommitted
INT-4490: DefaultLockRepo: no uppercase format
JIRA https://jira.spring.io/browse/INT-4490 The `DefaultLockRepository.prefix` can be configured with the schema name. And this one can be case-sensitive. * Change format hint from the `%S` to `%s` to avoid upper-casing. **Cherry-pick to 5.0.x and 4.3.x**
1 parent 0146172 commit 0d11c7e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2017 the original author or authors.
2+
* Copyright 2016-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -69,17 +69,17 @@ public class DefaultLockRepository implements LockRepository, InitializingBean {
6969

7070
private String region = "DEFAULT";
7171

72-
private String deleteQuery = "DELETE FROM %SLOCK WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=?";
72+
private String deleteQuery = "DELETE FROM %sLOCK WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=?";
7373

74-
private String deleteExpiredQuery = "DELETE FROM %SLOCK WHERE REGION=? AND LOCK_KEY=? AND CREATED_DATE<?";
74+
private String deleteExpiredQuery = "DELETE FROM %sLOCK WHERE REGION=? AND LOCK_KEY=? AND CREATED_DATE<?";
7575

76-
private String deleteAllQuery = "DELETE FROM %SLOCK WHERE REGION=? AND CLIENT_ID=?";
76+
private String deleteAllQuery = "DELETE FROM %sLOCK WHERE REGION=? AND CLIENT_ID=?";
7777

78-
private String updateQuery = "UPDATE %SLOCK SET CREATED_DATE=? WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=?";
78+
private String updateQuery = "UPDATE %sLOCK SET CREATED_DATE=? WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=?";
7979

80-
private String insertQuery = "INSERT INTO %SLOCK (REGION, LOCK_KEY, CLIENT_ID, CREATED_DATE) VALUES (?, ?, ?, ?)";
80+
private String insertQuery = "INSERT INTO %sLOCK (REGION, LOCK_KEY, CLIENT_ID, CREATED_DATE) VALUES (?, ?, ?, ?)";
8181

82-
private String countQuery = "SELECT COUNT(REGION) FROM %SLOCK WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=? AND CREATED_DATE>=?";
82+
private String countQuery = "SELECT COUNT(REGION) FROM %sLOCK WHERE REGION=? AND LOCK_KEY=? AND CLIENT_ID=? AND CREATED_DATE>=?";
8383

8484
/**
8585
* Constructor that initializes the client id that will be associated for
@@ -173,8 +173,8 @@ public boolean isAcquired(String lock) {
173173
new Date(System.currentTimeMillis() - this.ttl)) == 1;
174174
}
175175

176-
private int deleteExpired(String lock) {
177-
return this.template.update(this.deleteExpiredQuery, this.region, lock,
176+
private void deleteExpired(String lock) {
177+
this.template.update(this.deleteExpiredQuery, this.region, lock,
178178
new Date(System.currentTimeMillis() - this.ttl));
179179
}
180180

0 commit comments

Comments
 (0)