Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
feat: add catch for duplicated key issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 20, 2022
1 parent d8de8a1 commit f343f7c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion common/src/main/java/infrastructure/DBIStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import io.netty.util.internal.StringUtil;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.statement.Batch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Phaser;

public class DBIStore {
private static final Logger logger = LoggerFactory.getLogger(DefaultBatchImpl.class);

private static final String JDBC_URL = System.getProperty("dburl");
private static final DBIStore INSTANCE = new DBIStore(JDBC_URL);
Expand Down Expand Up @@ -58,7 +62,13 @@ private void doSave(List<String> sqls, String file, Phaser phaser) {
for (String sql : sqls) {
batch.add(sql);
}
return batch.execute();

try {
batch.execute();
} catch (Exception e) {
logger.info(String.valueOf(e));
}
return new ArrayList<Integer>();
}));

SqlExecuteThreadPool.execute(p);
Expand Down

0 comments on commit f343f7c

Please sign in to comment.