(self, host, host_distance, session)
| 598 | _keyspace = None |
| 599 | |
| 600 | def __init__(self, host, host_distance, session): |
| 601 | self.host = host |
| 602 | self.host_distance = host_distance |
| 603 | |
| 604 | self._session = weakref.proxy(session) |
| 605 | self._lock = RLock() |
| 606 | self._conn_available_condition = Condition() |
| 607 | |
| 608 | log.debug("Initializing new connection pool for host %s", self.host) |
| 609 | core_conns = session.cluster.get_core_connections_per_host(host_distance) |
| 610 | self._connections = [session.cluster.connection_factory(host.endpoint, on_orphaned_stream_released=self.on_orphaned_stream_released) |
| 611 | for i in range(core_conns)] |
| 612 | |
| 613 | self._keyspace = session.keyspace |
| 614 | if self._keyspace: |
| 615 | for conn in self._connections: |
| 616 | conn.set_keyspace_blocking(self._keyspace) |
| 617 | |
| 618 | self._trash = set() |
| 619 | self._next_trash_allowed_at = time.time() |
| 620 | self.open_count = core_conns |
| 621 | log.debug("Finished initializing new connection pool for host %s", self.host) |
| 622 | |
| 623 | def borrow_connection(self, timeout): |
| 624 | if self.is_shutdown: |
nothing calls this directly
no test coverage detected