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
4 changes: 4 additions & 0 deletions src/main/java/org/tikv/common/TiSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ private synchronized void shutdown(boolean now) throws Exception {
if (metricsServer != null) {
metricsServer.close();
}

if (circuitBreaker != null) {
circuitBreaker.close();
}
}

if (now) {
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/tikv/raw/SmartRawKVClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ public SmartRawKVClient(RawKVClientBase client, CircuitBreaker breaker) {
this.circuitBreaker = breaker;
}

@Override
public void close() throws Exception {
circuitBreaker.close();
client.close();
}

@Override
public void put(ByteString key, ByteString value) {
callWithCircuitBreaker("put", () -> client.put(key, value));
Expand Down Expand Up @@ -268,6 +262,11 @@ private void callWithCircuitBreaker(String funcName, Function0 func) {
});
}

@Override
public void close() throws Exception {
client.close();
}

public interface Function1<T> {
T apply();
}
Expand Down