MCPcopy Create free account
hub / github.com/apache/impala / CreateClient

Method CreateClient

be/src/runtime/client-cache.cc:111–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111Status ClientCacheHelper::CreateClient(const TNetworkAddress& address,
112 const ClientFactory& factory_method, ClientKey* client_key) {
113 shared_ptr<ThriftClientImpl> client_impl(factory_method(address, client_key));
114 VLOG(2) << "CreateClient(): creating new client for " <<
115 TNetworkAddressToString(client_impl->address());
116
117 if (!client_impl->init_status().ok()) {
118 *client_key = nullptr;
119 return client_impl->init_status();
120 }
121
122 // Set the TSocket's send, receive and connect timeouts.
123 client_impl->setRecvTimeout(recv_timeout_ms_);
124 client_impl->setSendTimeout(send_timeout_ms_);
125 client_impl->setConnTimeout(conn_timeout_ms_);
126
127 Status status = client_impl->OpenWithRetry(num_tries_, wait_ms_);
128 if (!status.ok()) {
129 *client_key = nullptr;
130 return status;
131 }
132
133 // Because the client starts life 'checked out', we don't add it to its host cache.
134 {
135 lock_guard<mutex> lock(client_map_lock_);
136 client_map_[*client_key] = client_impl;
137 }
138
139 if (metrics_enabled_) total_clients_metric_->Increment(1);
140 return Status::OK();
141}
142
143void ClientCacheHelper::ReleaseClient(ClientKey* client_key) {
144 DCHECK(*client_key != NULL) << "Trying to release NULL client";

Callers

nothing calls this directly

Calls 9

TNetworkAddressToStringFunction · 0.85
OKFunction · 0.85
init_statusMethod · 0.80
setRecvTimeoutMethod · 0.80
setSendTimeoutMethod · 0.80
setConnTimeoutMethod · 0.80
OpenWithRetryMethod · 0.80
okMethod · 0.45
IncrementMethod · 0.45

Tested by

no test coverage detected