diff --git a/src/proto/rpc_client.h b/src/proto/rpc_client.h index 1830a298a..dc83537a2 100644 --- a/src/proto/rpc_client.h +++ b/src/proto/rpc_client.h @@ -67,6 +67,10 @@ class RpcClientBase { RpcClientBase() : m_rpc_channel(NULL) {} virtual ~RpcClientBase() {} + static void Shutdown() { + m_rpc_client.Shutdown(); + } + protected: virtual void ResetClient(const std::string& server_addr) { std::map::iterator it; diff --git a/src/proto/tabletnode_client.cc b/src/proto/tabletnode_client.cc index 459bd97c4..2725f1b55 100644 --- a/src/proto/tabletnode_client.cc +++ b/src/proto/tabletnode_client.cc @@ -19,6 +19,10 @@ void TabletNodeClient::SetRpcOption(int32_t max_inflow, int32_t max_outflow, pending_buffer_size, thread_num); } +void TabletNodeClient::Shutdown() { + RpcClientBase::Shutdown(); +} + TabletNodeClient::TabletNodeClient(const std::string& server_addr, int32_t rpc_timeout) : RpcClient(server_addr), diff --git a/src/proto/tabletnode_client.h b/src/proto/tabletnode_client.h index 66aec499c..5d6fa0576 100644 --- a/src/proto/tabletnode_client.h +++ b/src/proto/tabletnode_client.h @@ -27,6 +27,7 @@ class TabletNodeClient : public RpcClient { static void SetRpcOption(int32_t max_inflow = -1, int32_t max_outflow = -1, int32_t pending_buffer_size = -1, int32_t thread_num = -1); + static void Shutdown(); TabletNodeClient(const std::string& addr = "", int32_t rpc_timeout = FLAGS_tera_rpc_timeout_period); diff --git a/src/sdk/client_impl.cc b/src/sdk/client_impl.cc index 3f16490c7..940344493 100644 --- a/src/sdk/client_impl.cc +++ b/src/sdk/client_impl.cc @@ -63,6 +63,7 @@ ClientImpl::ClientImpl(const std::string& user_identity, } ClientImpl::~ClientImpl() { + tabletnode::TabletNodeClient::Shutdown(); delete _cluster; }