fix SmartRawKVClient close (#393) (#394)

Signed-off-by: marsishandsome <marsishandsome@gmail.com>
This commit is contained in:
ti-srebot 2021-12-11 20:55:12 +08:00 committed by GitHub
parent 83fb5f4d46
commit 952627a18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -542,6 +542,10 @@ public class TiSession implements AutoCloseable {
if (metricsServer != null) {
metricsServer.close();
}
if (circuitBreaker != null) {
circuitBreaker.close();
}
}
if (now) {

View File

@ -66,12 +66,6 @@ public class SmartRawKVClient implements RawKVClientBase {
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));
@ -268,6 +262,11 @@ public class SmartRawKVClient implements RawKVClientBase {
});
}
@Override
public void close() throws Exception {
client.close();
}
public interface Function1<T> {
T apply();
}