Exemplo n.º 1
0
    def __init__(self, size, **kwargs):
        if not isinstance(size, six.integer_types):
            raise TypeError("Pool size arg must be an integer")

        if size < _MIN_POOL_SIZE:
            raise ValueError("Pool size must be positive")

        self._lock = threading.Lock()
        self._queue = six.moves.queue.LifoQueue(maxsize=size)
        self._thread_connections = threading.local()

        connection_kwargs = kwargs
        connection_kwargs["autoconnect"] = False
        if "instance" not in connection_kwargs:
            connection_kwargs["instance"] = _get_instance()

        for _ in six.moves.range(size):
            connection = Connection(**connection_kwargs)
            self._queue.put(connection)
Exemplo n.º 2
0
    def _call_fut(self):
        from google.cloud.happybase.connection import _get_instance

        return _get_instance()
Exemplo n.º 3
0
 def _callFUT(self, timeout=None):
     from google.cloud.happybase.connection import _get_instance
     return _get_instance(timeout=timeout)