public function flush() { if (\hacklib_cast_as_boolean($this->randomize_)) { shuffle($this->servers_); } foreach ($this->servers_ as $server) { $this->host_ = $server[0]; $this->port_ = $server[1]; $j = $this->numTries_; while ($j > 0) { try { parent::flush(); return; } catch (TTransportException $e) { if (\hacklib_cast_as_boolean($this->debug_)) { call_user_func($this->debugHandler_, $e->getMessage()); } --$j; } } } $this->host_ = ""; $this->port_ = 0; $error = "THttpClientPool: Could not connect to any of the servers " . "in the pool"; throw new TTransportException($error, TTransportException::NOT_OPEN); }
/** * Trys to open a connection and send the actual HTTP request to the first * available server in the pool. */ public function flush() { if ($this->randomize_) { shuffle($this->servers_); } foreach ($this->servers_ as $server) { $this->host_ = $server['host']; $this->port_ = $server['port']; $j = $this->numTries_; while ($j > 0) { try { parent::flush(); return; } catch (TTransportException $e) { if ($this->debug_) { call_user_func($this->debugHandler_, $e->getMessage()); } --$j; } } } $this->host_ = null; $this->port_ = null; $error = 'THttpClientPool: Could not connect to any of the servers ' . 'in the pool'; throw new TTransportException($error, TTransportException::NOT_OPEN); }