From 43bdccbd20dc268643124d35713ca411edb41c23 Mon Sep 17 00:00:00 2001 From: ZhangCheng Date: Thu, 16 Mar 2023 20:02:29 +0800 Subject: [PATCH] Add global clock dependency in jdbc adapter (#24651) * Add global clock dependency in jdbc adapter * fix --- jdbc/core/pom.xml | 10 ++++++++++ .../core/executor/GlobalClockTransactionHook.java | 2 +- .../type/tso/provider/LocalTSOProvider.java | 2 +- .../type/tso/provider/RedisTSOProvider.java | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml index 53afd2384e568..46146d9e73437 100644 --- a/jdbc/core/pom.xml +++ b/jdbc/core/pom.xml @@ -33,6 +33,16 @@ shardingsphere-transaction-core ${project.version} + + org.apache.shardingsphere + shardingsphere-global-clock-core + ${project.parent.version} + + + org.apache.shardingsphere + shardingsphere-global-clock-tso-core + ${project.parent.version} + org.apache.shardingsphere shardingsphere-sql-parser-sql92 diff --git a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/executor/GlobalClockTransactionHook.java b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/executor/GlobalClockTransactionHook.java index b70a2ed164469..e65eced416765 100644 --- a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/executor/GlobalClockTransactionHook.java +++ b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/executor/GlobalClockTransactionHook.java @@ -40,7 +40,7 @@ public final class GlobalClockTransactionHook extends TransactionHookAdapter { private GlobalClockTransactionExecutor globalClockTransactionExecutor; - private LockDefinition lockDefinition = new GlobalLockDefinition("global_clock"); + private final LockDefinition lockDefinition = new GlobalLockDefinition("global_clock"); private boolean enabled; diff --git a/kernel/global-clock/type/tso/core/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/LocalTSOProvider.java b/kernel/global-clock/type/tso/core/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/LocalTSOProvider.java index a9edf3e859cd8..1dd05cf1671ad 100644 --- a/kernel/global-clock/type/tso/core/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/LocalTSOProvider.java +++ b/kernel/global-clock/type/tso/core/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/LocalTSOProvider.java @@ -23,7 +23,7 @@ /** * Local timestamp oracle provider. */ -public class LocalTSOProvider implements TSOProvider { +public final class LocalTSOProvider implements TSOProvider { private final AtomicLong localClock = new AtomicLong(); diff --git a/kernel/global-clock/type/tso/provider/redis/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/RedisTSOProvider.java b/kernel/global-clock/type/tso/provider/redis/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/RedisTSOProvider.java index 66ff2c24c6e2f..05f74ab021301 100644 --- a/kernel/global-clock/type/tso/provider/redis/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/RedisTSOProvider.java +++ b/kernel/global-clock/type/tso/provider/redis/src/main/java/org/apache/shardingsphere/globalclock/type/tso/provider/RedisTSOProvider.java @@ -22,7 +22,7 @@ /** * Redis timestamp oracle provider. */ -public class RedisTSOProvider implements TSOProvider { +public final class RedisTSOProvider implements TSOProvider { @Override public void init(final Properties props) {