@@ -24,9 +24,6 @@ var events = require('events');
24
24
var EventEmitter = events . EventEmitter ;
25
25
var inherits = util . inherits ;
26
26
27
- // methods that are called when trying to shut down explicitly bound EEs
28
- var endMethods = [ 'end' , 'abort' , 'destroy' , 'destroySoon' ] ;
29
-
30
27
// communicate with events module, but don't require that
31
28
// module to have to load this one, since this module has
32
29
// a few side effects.
@@ -259,53 +256,19 @@ Domain.prototype.bind = function(cb, interceptError) {
259
256
return b ;
260
257
} ;
261
258
262
- Domain . prototype . dispose = function ( ) {
259
+ Domain . prototype . dispose = util . deprecate ( function ( ) {
263
260
if ( this . _disposed ) return ;
264
261
265
262
// if we're the active domain, then get out now.
266
263
this . exit ( ) ;
267
264
268
- this . emit ( 'dispose' ) ;
269
-
270
- // remove error handlers.
271
- this . removeAllListeners ( ) ;
272
- this . on ( 'error' , function ( ) { } ) ;
273
-
274
- // try to kill all the members.
275
- // XXX There should be more consistent ways
276
- // to shut down things!
277
- this . members . forEach ( function ( m ) {
278
- // if it's a timeout or interval, cancel it.
279
- clearTimeout ( m ) ;
280
-
281
- // drop all event listeners.
282
- if ( m instanceof EventEmitter ) {
283
- m . removeAllListeners ( ) ;
284
- // swallow errors
285
- m . on ( 'error' , function ( ) { } ) ;
286
- }
287
-
288
- // Be careful!
289
- // By definition, we're likely in error-ridden territory here,
290
- // so it's quite possible that calling some of these methods
291
- // might cause additional exceptions to be thrown.
292
- endMethods . forEach ( function ( method ) {
293
- if ( util . isFunction ( m [ method ] ) ) {
294
- try {
295
- m [ method ] ( ) ;
296
- } catch ( er ) { }
297
- }
298
- } ) ;
299
-
300
- } ) ;
301
-
302
265
// remove from parent domain, if there is one.
303
266
if ( this . domain ) this . domain . remove ( this ) ;
304
267
305
268
// kill the references so that they can be properly gc'ed.
306
269
this . members . length = 0 ;
307
270
308
- // finally, mark this domain as 'no longer relevant'
271
+ // mark this domain as 'no longer relevant'
309
272
// so that it can't be entered or activated.
310
273
this . _disposed = true ;
311
- } ;
274
+ } ) ;
0 commit comments