Beispiel #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 'cluster' not in connection_kwargs:
            connection_kwargs['cluster'] = _get_cluster(
                timeout=kwargs.get('timeout'))

        for _ in six.moves.range(size):
            connection = Connection(**connection_kwargs)
            self._queue.put(connection)
Beispiel #2
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 'cluster' not in connection_kwargs:
            connection_kwargs['cluster'] = _get_cluster(
                timeout=kwargs.get('timeout'))

        for _ in six.moves.range(size):
            connection = Connection(**connection_kwargs)
            self._queue.put(connection)
Beispiel #3
0
 def _callFUT(self, timeout=None):
     from gcloud.bigtable.happybase.connection import _get_cluster
     return _get_cluster(timeout=timeout)
Beispiel #4
0
 def _callFUT(self, timeout=None):
     from gcloud.bigtable.happybase.connection import _get_cluster
     return _get_cluster(timeout=timeout)