Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/tikv/common/PDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
private static final int PAUSE_CHECKER_TIMEOUT = 300; // in seconds
private static final int KEEP_CHECKER_PAUSE_PERIOD = PAUSE_CHECKER_TIMEOUT / 5; // in seconds
private static final Logger logger = LoggerFactory.getLogger(PDClient.class);
private static final ObjectMapper mapper = new ObjectMapper();

private final RequestKeyCodec codec;
private RequestHeader header;
Expand Down Expand Up @@ -226,7 +227,6 @@ public Boolean isCheckerPaused(PDChecker checker) {
URI url = pdAddrs.get(0);
String api = url.toString() + "/pd/api/v1/checker/" + checker.apiName();
try {
ObjectMapper mapper = new ObjectMapper();
HashMap<String, Boolean> status =
mapper.readValue(new URL(api), new TypeReference<HashMap<String, Boolean>>() {});
return status.get("paused");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tikv/common/TiDBJDBCClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class TiDBJDBCClient implements AutoCloseable {
private static final int DELAY_CLEAN_TABLE_LOCK_DEFAULT = 0;
private static final String TIDB_ROW_FORMAT_VERSION_SQL = "select @@tidb_row_format_version";
private static final int TIDB_ROW_FORMAT_VERSION_DEFAULT = 1;
private static final ObjectMapper objectMapper = new ObjectMapper();
private final Logger logger = LoggerFactory.getLogger(getClass().getName());
private final Connection connection;

Expand Down Expand Up @@ -120,7 +121,6 @@ public boolean dropTable(String databaseName, String tableName) throws SQLExcept

private Map<String, Object> readConfMapFromTiDB() throws SQLException, IOException {
String configJSON = (String) queryTiDBViaJDBC(SELECT_TIDB_CONFIG_SQL).get(0).get(0);
ObjectMapper objectMapper = new ObjectMapper();
TypeReference<HashMap<String, Object>> typeRef =
new TypeReference<HashMap<String, Object>>() {};
return objectMapper.readValue(configJSON, typeRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

public class CatalogTransaction {
protected static final Logger logger = LoggerFactory.getLogger(CatalogTransaction.class);
private static final ObjectMapper mapper = new ObjectMapper();
private final Snapshot snapshot;

CatalogTransaction(Snapshot snapshot) {
Expand All @@ -51,7 +52,6 @@ public static <T> T parseFromJson(ByteString json, Class<T> cls) {
Objects.requireNonNull(cls, "cls is null");

logger.debug(String.format("Parse Json %s : %s", cls.getSimpleName(), json.toStringUtf8()));
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(json.toStringUtf8(), cls);
} catch (JsonParseException | JsonMappingException e) {
Expand Down
Loading