protected function _initConnections()
{
$connections = [];
foreach ($this->getConfig('connections') as $connection) {
$connections[] = Connection::create($this->_prepareConnectionParams($connection));
}
if (isset($this->_config['servers'])) {
foreach ($this->getConfig('servers') as $server) {
$connections[] = Connection::create($this->_prepareConnectionParams($server));
}
}
// If no connections set, create default connection
if (empty($connections)) {
$connections[] = Connection::create($this->_prepareConnectionParams($this->getConfig()));
}
if (!isset($this->_config['connectionStrategy'])) {
if ($this->getConfig('roundRobin') === true) {
$this->setConfigValue('connectionStrategy', 'RoundRobin');
} else {
$this->setConfigValue('connectionStrategy', 'Simple');
}
}
$strategy = Connection\Strategy\StrategyFactory::create($this->getConfig('connectionStrategy'));
$this->_connectionPool = new Connection\ConnectionPool($connections, $strategy, $this->_callback);
}