MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / _cleanup

Method _cleanup

cassandra/io/asyncorereactor.py:283–307  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

281 self.wake_loop()
282
283 def _cleanup(self):
284 global _dispatcher_map
285
286 self._shutdown = True
287 if not self._thread:
288 return
289
290 log.debug("Waiting for event loop thread to join...")
291 self._thread.join(timeout=1.0)
292 if self._thread.is_alive():
293 log.warning(
294 "Event loop thread could not be joined, so shutdown may not be clean. "
295 "Please call Cluster.shutdown() to avoid this.")
296
297 log.debug("Event loop thread was joined")
298
299 # Ensure all connections are closed and in-flight requests cancelled
300 for conn in tuple(_dispatcher_map.values()):
301 if conn is not self._loop_dispatcher:
302 conn.close()
303 self._timers.service_timeouts()
304 # Once all the connections are closed, close the dispatcher
305 self._loop_dispatcher.close()
306
307 log.debug("Dispatchers were closed")
308
309
310_global_loop = None

Callers 2

_cleanupFunction · 0.45
handle_forkMethod · 0.45

Calls 3

valuesMethod · 0.45
closeMethod · 0.45
service_timeoutsMethod · 0.45

Tested by

no test coverage detected