Created
July 4, 2012 11:53
-
-
Save shigeki/3046956 to your computer and use it in GitHub Desktop.
Domain Stack Sample #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// domain stack sample #3 | |
var domain = require('domain'); | |
var d1 = domain.create(); | |
var d2 = domain.create(); | |
var d3 = domain.create(); | |
d1.on('error', function(err) { | |
console.log('d1:', err.message); | |
}); | |
d2.on('error', function(err) { | |
console.log('d2:', err.message); | |
}); | |
d3.on('error', function(err) { | |
console.log('d3:', err.message); | |
}); | |
var arg = +process.argv[2]; | |
var a = null; | |
d1.add(process); | |
if(arg === 1) { | |
a.hoge; | |
} | |
d2.add(process); | |
if (arg == 2) { | |
a.hoge; | |
} | |
d3.add(process); | |
if (arg == 3) { | |
a.hoge; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> node domain_stack3.js 1 | |
d1: Cannot read property 'hoge' of null | |
> node domain_stack3.js 2 | |
d2: Cannot read property 'hoge' of null | |
> node domain_stack3.js 3 | |
d3: Cannot read property 'hoge' of nul |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment