ldap3.strategy.reusable module

class ldap3.strategy.reusable.ReusableStrategy(ldap_connection)

Bases: ldap3.strategy.base.BaseStrategy

A pool of reusable SyncWaitRestartable connections with lazy behaviour and limited lifetime. The connection using this strategy presents itself as a normal connection, but internally the strategy has a pool of connections that can be used as needed. Each connection lives in its own thread and has a busy/available status. The strategy performs the requested operation on the first available connection. The pool of connections is instantiated at strategy initialization. Strategy has two customizable properties, the total number of connections in the pool and the lifetime of each connection. When lifetime is expired the connection is closed and will be open again when needed.

class ConnectionPool(connection)

Bases: object

Container for the Connection Threads

create_pool()
get_info_from_server()
rebind_pool()
start_pool()
terminate_pool()
class ReusableStrategy.PooledConnectionThread(worker, master_connection)

Bases: threading.Thread

The thread that holds the Reusable connection and receive operation request via the queue Result are sent back in the pool._incoming list when ready

run()
class ReusableStrategy.PooledConnectionWorker(connection, request_queue)

Bases: object

Container for the restartable connection. it includes a thread and a lock to execute the connection in the pool

new_connection()
ReusableStrategy.get_response(counter, timeout=None, get_request=False)
ReusableStrategy.get_stream()
ReusableStrategy.open(reset_usage=True, read_server_info=True)
ReusableStrategy.pools = {}
ReusableStrategy.post_send_single_response(counter)
ReusableStrategy.receiving()
ReusableStrategy.send(message_type, request, controls=None)
ReusableStrategy.set_stream(value)
ReusableStrategy.terminate()
ReusableStrategy.validate_bind(controls)