File tree Expand file tree Collapse file tree 5 files changed +13
-81
lines changed Expand file tree Collapse file tree 5 files changed +13
-81
lines changed Original file line number Diff line number Diff line change 1
1
"""A eventlet based handler."""
2
2
from __future__ import absolute_import
3
3
4
+ import atexit
5
+
4
6
import contextlib
5
7
import logging
6
8
12
14
from eventlet import queue as green_queue
13
15
14
16
from kazoo .handlers import utils
15
- import kazoo .python2atexit as python2atexit
16
17
from kazoo .handlers .utils import selector_select
17
18
18
19
LOG = logging .getLogger (__name__ )
@@ -140,15 +141,15 @@ def start(self):
140
141
w = eventlet .spawn (self ._process_callback_queue )
141
142
self ._workers .append ((w , self .callback_queue ))
142
143
self ._started = True
143
- python2atexit .register (self .stop )
144
+ atexit .register (self .stop )
144
145
145
146
def stop (self ):
146
147
while self ._workers :
147
148
w , q = self ._workers .pop ()
148
149
q .put (_STOP )
149
150
w .wait ()
150
151
self ._started = False
151
- python2atexit .unregister (self .stop )
152
+ atexit .unregister (self .stop )
152
153
153
154
def socket (self , * args , ** kwargs ):
154
155
return utils .create_tcp_socket (green_socket )
Original file line number Diff line number Diff line change 1
1
"""A gevent based handler."""
2
2
from __future__ import absolute_import
3
3
4
+ import atexit
5
+
4
6
import logging
5
7
6
8
import gevent
19
21
from gevent .coros import Semaphore , RLock
20
22
21
23
from kazoo .handlers import utils
22
- from kazoo import python2atexit
23
24
24
25
_using_libevent = gevent .__version__ .startswith ("0." )
25
26
@@ -104,7 +105,7 @@ def start(self):
104
105
for queue in (self .callback_queue ,):
105
106
w = self ._create_greenlet_worker (queue )
106
107
self ._workers .append (w )
107
- python2atexit .register (self .stop )
108
+ atexit .register (self .stop )
108
109
109
110
def stop (self ):
110
111
"""Stop the greenlet workers and empty all queues."""
@@ -124,7 +125,7 @@ def stop(self):
124
125
# Clear the queues
125
126
self .callback_queue = self .queue_impl () # pragma: nocover
126
127
127
- python2atexit .unregister (self .stop )
128
+ atexit .unregister (self .stop )
128
129
129
130
def select (self , * args , ** kwargs ):
130
131
return selector_select (
Original file line number Diff line number Diff line change 12
12
"""
13
13
from __future__ import absolute_import
14
14
15
+ import atexit
16
+
15
17
import logging
16
18
import socket
17
19
import threading
18
20
import time
19
21
20
- import kazoo .python2atexit as python2atexit
21
22
from kazoo .handlers import utils
22
23
from kazoo .handlers .utils import selector_select
23
24
@@ -141,7 +142,7 @@ def start(self):
141
142
w = self ._create_thread_worker (work_queue )
142
143
self ._workers .append (w )
143
144
self ._running = True
144
- python2atexit .register (self .stop )
145
+ atexit .register (self .stop )
145
146
146
147
def stop (self ):
147
148
"""Stop the worker threads and empty all queues."""
@@ -162,7 +163,7 @@ def stop(self):
162
163
# Clear the queues
163
164
self .callback_queue = self .queue_impl ()
164
165
self .completion_queue = self .queue_impl ()
165
- python2atexit .unregister (self .stop )
166
+ atexit .unregister (self .stop )
166
167
167
168
def select (self , * args , ** kwargs ):
168
169
return selector_select (* args , ** kwargs )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
"""Kazoo testing harnesses"""
2
+ import atexit
2
3
import logging
3
4
import os
4
5
import uuid
5
6
import unittest
6
7
7
- from kazoo import python2atexit as atexit
8
8
from kazoo .client import KazooClient
9
9
from kazoo .exceptions import KazooException
10
10
from kazoo .protocol .connection import _CONNECTION_DROP , _SESSION_EXPIRED
You can’t perform that action at this time.
0 commit comments