| 71 | |
| 72 | |
| 73 | class ConnectionHandler(ConnectionPoolListener): |
| 74 | def connection_created(self, event): |
| 75 | global open_connections |
| 76 | open_connections += 1 |
| 77 | print("connection created") |
| 78 | |
| 79 | def connection_ready(self, event): |
| 80 | pass |
| 81 | |
| 82 | def connection_closed(self, event): |
| 83 | global open_connections |
| 84 | open_connections -= 1 |
| 85 | print("connection closed") |
| 86 | |
| 87 | def connection_check_out_started(self, event): |
| 88 | pass |
| 89 | |
| 90 | def connection_check_out_failed(self, event): |
| 91 | pass |
| 92 | |
| 93 | def connection_checked_out(self, event): |
| 94 | pass |
| 95 | |
| 96 | def connection_checked_in(self, event): |
| 97 | pass |
| 98 | |
| 99 | def pool_created(self, event): |
| 100 | pass |
| 101 | |
| 102 | def pool_ready(self, event): |
| 103 | pass |
| 104 | |
| 105 | def pool_cleared(self, event): |
| 106 | pass |
| 107 | |
| 108 | def pool_closed(self, event): |
| 109 | pass |
| 110 | |
| 111 | |
| 112 | listeners = [CommandHandler(), ServerHeartbeatHandler(), ConnectionHandler()] |