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

Function WaitForServer

be/src/rpc/thrift-util.cc:250–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250Status WaitForServer(const string& host, int port, int num_retries,
251 int retry_interval_ms) {
252 int retry_count = 0;
253 while (retry_count < num_retries) {
254 try {
255 TSocket socket(host, port);
256 // Timeout is in ms
257 socket.setConnTimeout(500);
258 socket.open();
259 socket.close();
260 return Status::OK();
261 } catch (const TException& e) {
262 VLOG_QUERY << "Connection failed: " << e.what();
263 }
264 ++retry_count;
265 VLOG_QUERY << "Waiting " << retry_interval_ms << "ms for Thrift server at "
266 << host << ":" << port
267 << " to come up, failed attempt " << retry_count
268 << " of " << num_retries;
269 SleepForMs(retry_interval_ms);
270 }
271 return Status("Server did not come up");
272}
273
274void PrintTColumnValue(std::ostream& out, const TColumnValue& colval) {
275 if (colval.__isset.bool_val) {

Callers 4

mainFunction · 0.85
SetupMethod · 0.85
WaitForLocalServerFunction · 0.85

Calls 5

OKFunction · 0.85
setConnTimeoutMethod · 0.80
openMethod · 0.65
closeMethod · 0.65
StatusClass · 0.50

Tested by 1

mainFunction · 0.68