You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#3866
Some RDBMS vendors (or their JDBC drivers) may just log the problem
without throwing an exception.
* Expose setters for UPDATE and INSERTS queries in the `DefaultLockRepository`
to let end-user to modify them respectively, e.g. be able to add a PostgreSQL
`ON CONFLICT DO NOTHING` hint.
* Refactor `DefaultLockRepository` to `Instant` instead of `LocalDateTime`
with zone offset.
* Refactor `ttl` property to `Duration` type
* Fix `dead-lock` typo to `deadlock`
Copy file name to clipboardExpand all lines: spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java
+106-17
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,8 @@
16
16
17
17
packageorg.springframework.integration.jdbc.lock;
18
18
19
-
importjava.time.LocalDateTime;
20
-
importjava.time.ZoneOffset;
21
-
importjava.time.temporal.ChronoUnit;
19
+
importjava.time.Duration;
20
+
importjava.time.Instant;
22
21
importjava.util.UUID;
23
22
24
23
importjavax.sql.DataSource;
@@ -66,13 +65,13 @@ public class DefaultLockRepository
Copy file name to clipboardExpand all lines: spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/lock/JdbcLockRegistryTests-context.xml
Copy file name to clipboardExpand all lines: src/reference/asciidoc/jdbc.adoc
+12-1
Original file line number
Diff line number
Diff line change
@@ -1143,7 +1143,7 @@ The `INT_` can be changed according to the target database design requirements.
1143
1143
Therefore, you must use `prefix` property on the `DefaultLockRepository` bean definition.
1144
1144
1145
1145
Sometimes, one application has moved to such a state that it cannot release the distributed lock and remove the particular record in the database.
1146
-
For this purpose, such dead-locks can be expired by the other application on the next locking invocation.
1146
+
For this purpose, such deadlocks can be expired by the other application on the next locking invocation.
1147
1147
The `timeToLive` (TTL) option on the `DefaultLockRepository` is provided for this purpose.
1148
1148
You may also want to specify `CLIENT_ID` for the locks stored for a given `DefaultLockRepository` instance.
1149
1149
If so, you can specify the `id` to be associated with the `DefaultLockRepository` as a constructor parameter.
@@ -1162,6 +1162,17 @@ See its JavaDocs for more information.
1162
1162
1163
1163
String with version 6.0, the `DefaultLockRepository` can be supplied with a `PlatformTransactionManager` instead of relying on the primary bean from the application context.
1164
1164
1165
+
String with version 6.1, the `DefaultLockRepository` can be configured for custom `insert`, `update` and `renew` queries.
1166
+
For this purpose the respective setters and getters are exposed.
1167
+
For example, an insert query for PostgreSQL hint can be configured like this:
1168
+
1169
+
====
1170
+
[source,java]
1171
+
----
1172
+
lockRepository.setInsertQuery(lockRepository.getInsertQuery() + " ON CONFLICT DO NOTHING");
0 commit comments