1
2
3
4
5
6
7
9
10 - def __init__(self, keepalive=10, timeout=300):
11 """ abstract class from which all connection
12 pool should inherit.
13 """
14 if type(timeout) != type(1):
15 raise ValueError("Pool timeout isn't an integer")
16 self.keepalive = keepalive
17 self.timeout = timeout
18 self.alive = True
19
20 - def get(self, netloc):
21 """ method used to return a connection from the pool"""
22 raise NotImplementedError
23
24 - def put(self, netloc, conn):
25 """ Put an item back into the pool, when done """
26 raise NotImplementedError
27
29 """ method to clear all connections from host """
30 raise NotImplementedError
31
33 """ method used to release all connections """
34 raise NotImplementedError
35
37 """ close the pool monitoring and clear all connections """
38 self.alive = False
39 self.clear()
40