@@ -24,9 +24,6 @@ var events = require('events');
2424var EventEmitter = events . EventEmitter ;
2525var inherits = util . inherits ;
2626
27- // methods that are called when trying to shut down explicitly bound EEs
28- var endMethods = [ 'end' , 'abort' , 'destroy' , 'destroySoon' ] ;
29-
3027// communicate with events module, but don't require that
3128// module to have to load this one, since this module has
3229// a few side effects.
@@ -259,53 +256,19 @@ Domain.prototype.bind = function(cb, interceptError) {
259256 return b ;
260257} ;
261258
262- Domain . prototype . dispose = function ( ) {
259+ Domain . prototype . dispose = util . deprecate ( function ( ) {
263260 if ( this . _disposed ) return ;
264261
265262 // if we're the active domain, then get out now.
266263 this . exit ( ) ;
267264
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-
302265 // remove from parent domain, if there is one.
303266 if ( this . domain ) this . domain . remove ( this ) ;
304267
305268 // kill the references so that they can be properly gc'ed.
306269 this . members . length = 0 ;
307270
308- // finally, mark this domain as 'no longer relevant'
271+ // mark this domain as 'no longer relevant'
309272 // so that it can't be entered or activated.
310273 this . _disposed = true ;
311- } ;
274+ } ) ;
0 commit comments