Skip to content

Commit 04ac3be

Browse files
committed
fix: changes after code review
1 parent ca110b3 commit 04ac3be

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

community/flamingock-auditstore-sql/src/main/java/io/flamingock/community/sql/driver/SqlAuditStore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public synchronized CommunityAuditPersistence getPersistence() {
7777
public synchronized CommunityLockService getLockService() {
7878
if (lockService == null) {
7979
lockService = new SqlLockService(dataSource, lockRepositoryName, autoCreate);
80+
lockService.initialize(autoCreate);
8081
}
8182
return lockService;
8283
}

community/flamingock-auditstore-sql/src/main/java/io/flamingock/community/sql/internal/SqlLockService.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ public SqlLockService(DataSource dataSource, String lockRepositoryName, boolean
3939
this.dataSource = dataSource;
4040
this.lockRepositoryName = lockRepositoryName;
4141
this.dialectHelper = new SqlLockDialectHelper(dataSource);
42-
if (autoCreate) {
43-
try (Connection conn = dataSource.getConnection();
44-
Statement stmt = conn.createStatement()) {
45-
stmt.executeUpdate(dialectHelper.getCreateTableSqlString(lockRepositoryName));
46-
} catch (SQLException e) {
47-
throw new RuntimeException("Failed to initialize lock table", e);
48-
}
49-
}
5042
}
5143

5244
public void initialize(boolean autoCreate) {
@@ -60,6 +52,7 @@ public void initialize(boolean autoCreate) {
6052
}
6153
}
6254

55+
6356
@Override
6457
public LockAcquisition upsert(LockKey key, RunnerId owner, long leaseMillis) {
6558
String keyStr = key.toString();

0 commit comments

Comments
 (0)