| 28 | { |
| 29 | |
| 30 | Connection::Connection(int num_io_threads) |
| 31 | : io_() |
| 32 | , cluster_(io_) |
| 33 | , io_threads_() |
| 34 | , connected_(false) |
| 35 | { |
| 36 | for (int i = 0; i < num_io_threads; ++i) { |
| 37 | io_threads_.emplace_back([this]() { |
| 38 | try { |
| 39 | io_.run(); |
| 40 | } catch (const std::exception& e) { |
| 41 | CB_LOG_ERROR(e.what()); |
| 42 | throw; |
| 43 | } catch (...) { |
| 44 | CB_LOG_ERROR("Unknown exception"); |
| 45 | throw; |
| 46 | } |
| 47 | }); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | Connection::~Connection() |
| 52 | { |