File tree Expand file tree Collapse file tree 5 files changed +10
-81
lines changed Expand file tree Collapse file tree 5 files changed +10
-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
4
5
import contextlib
5
6
import logging
6
7
12
13
from eventlet import queue as green_queue
13
14
14
15
from kazoo .handlers import utils
15
- import kazoo .python2atexit as python2atexit
16
16
from kazoo .handlers .utils import selector_select
17
17
18
18
LOG = logging .getLogger (__name__ )
@@ -140,15 +140,15 @@ def start(self):
140
140
w = eventlet .spawn (self ._process_callback_queue )
141
141
self ._workers .append ((w , self .callback_queue ))
142
142
self ._started = True
143
- python2atexit .register (self .stop )
143
+ atexit .register (self .stop )
144
144
145
145
def stop (self ):
146
146
while self ._workers :
147
147
w , q = self ._workers .pop ()
148
148
q .put (_STOP )
149
149
w .wait ()
150
150
self ._started = False
151
- python2atexit .unregister (self .stop )
151
+ atexit .unregister (self .stop )
152
152
153
153
def socket (self , * args , ** kwargs ):
154
154
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
4
5
import logging
5
6
6
7
import gevent
19
20
from gevent .coros import Semaphore , RLock
20
21
21
22
from kazoo .handlers import utils
22
- from kazoo import python2atexit
23
23
24
24
_using_libevent = gevent .__version__ .startswith ("0." )
25
25
@@ -104,7 +104,7 @@ def start(self):
104
104
for queue in (self .callback_queue ,):
105
105
w = self ._create_greenlet_worker (queue )
106
106
self ._workers .append (w )
107
- python2atexit .register (self .stop )
107
+ atexit .register (self .stop )
108
108
109
109
def stop (self ):
110
110
"""Stop the greenlet workers and empty all queues."""
@@ -124,7 +124,7 @@ def stop(self):
124
124
# Clear the queues
125
125
self .callback_queue = self .queue_impl () # pragma: nocover
126
126
127
- python2atexit .unregister (self .stop )
127
+ atexit .unregister (self .stop )
128
128
129
129
def select (self , * args , ** kwargs ):
130
130
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
15
16
import logging
16
17
import queue
17
18
import socket
18
19
import threading
19
20
import time
20
21
21
- import kazoo .python2atexit as python2atexit
22
22
from kazoo .handlers import utils
23
23
from kazoo .handlers .utils import selector_select
24
24
@@ -141,7 +141,7 @@ def start(self):
141
141
w = self ._create_thread_worker (work_queue )
142
142
self ._workers .append (w )
143
143
self ._running = True
144
- python2atexit .register (self .stop )
144
+ atexit .register (self .stop )
145
145
146
146
def stop (self ):
147
147
"""Stop the worker threads and empty all queues."""
@@ -162,7 +162,7 @@ def stop(self):
162
162
# Clear the queues
163
163
self .callback_queue = self .queue_impl ()
164
164
self .completion_queue = self .queue_impl ()
165
- python2atexit .unregister (self .stop )
165
+ atexit .unregister (self .stop )
166
166
167
167
def select (self , * args , ** kwargs ):
168
168
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