summaryrefslogtreecommitdiff
path: root/lib/domain.js
AgeCommit message (Collapse)Author
2014-01-15domains: exit() only affects active domainsRyan Graham
domain.create().exit() should not clear the domain stack if the domain instance does not exist within the stack. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-01-09domain: fix off-by-one in Domain.exit()Ryan Graham
We want to clear the found domain and the domains after it. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-01-09src: revert domain using AsyncListenersTrevor Norris
This is a slightly modified revert of bc39bdd. Getting domains to use AsyncListeners became too much of a challenge with many edge cases. While this is still a goal, it will have to be deferred for now until more test coverage can be provided.
2014-01-03node: change AsyncListener APITrevor Norris
There was a flaw in the old API that has been fixed. Now the asyncListener callback is now the "create" object property in the callback object, and is optional.
2013-10-31domain: use AsyncListener APITrevor Norris
The domain module has been switched over to use the domain module API as much as currently possible. There are still some hooks in the EventEmitter, but hopefully we can remove those in the future.
2013-08-27domains: deprecate domain.dispose().Forrest L Norvell
Follows @isaacs's recommendations in joyent/node#5018. Includes some updates to documentation but not examples. Conflicts: lib/domain.js
2013-08-23domain: move error handling directly into instanceTrevor Norris
Instead of doing all the domain handling in core, allow the domain to set an error handler that'll take care of it all. This way the domain error handling can be abstracted enough for any user to use it.
2013-08-19fixes #6031 spelling errorsMatthew Aynalem
explictly => explicitly accesss => access througput => throughput epxression => expression communiction => communication becuase => because repersent => represent condonitions => conditions decompresion => decompression intentially => intentionally eventes => events listning => listening resicved => received becuase => because fundimental => fundamental colapse => collapse privlages => privileges sufficently => sufficiently hapepns => happens expliclitly => explicitly thier => their shold => should
2013-08-09domain: share object and state with native landTrevor Norris
Change process.domain to use a getter/setter and access that property via an array index. These are much faster to get from c++, and it can be passed to _setupDomainUse and stored as a Persistent<Array>. InDomain() and GetDomain() as trivial ways to access the domain information in the native layer. Important because we'll be able to quickly access if a domain is active. Instead of just whether the domain module has been loaded.
2013-08-01src: Replace macros with util functionsisaacs
2013-07-24lib: macro-ify type checksBen Noordhuis
Increases the grep factor. Makes it easier to harmonize type checks across the code base.
2013-04-10domain: change name for domain setupTrevor Norris
The name UsingDomains is misleading for a function that initializes domains for use.
2013-03-26domain: fix domain callback from MakeCallbackTrevor Norris
Since _tickCallback and _tickDomainCallback were both called from MakeCallback, it was possible for a callback to be called that required a domain directly to _tickCallback. The fix was to implement process.usingDomains(). This will set all applicable functions to their domain counterparts, and set a flag in cc to let MakeCallback know domain callbacks always need to be checked. Added test in own file. It's important that the test remains isolated.
2013-02-27process: separate nextTick domain logicTrevor Norris
It's cleaner to only load domain ticker logic when the domains are being used. This makes execution slightly quicker in both cases, and simpler from the spinner since there is no need to check if the latest callback requires use of domains.
2012-12-29domain: use camelCase instead of snake_caseisaacs
While it's true that error objects have a history of getting snake_case properties attached by the host system, it's a point of confusion to Node users that comes up a lot. It's still 'experimental', so best to change this sooner rather than later.
2012-12-29domain: Do not use uncaughtException handlerisaacs
This adds a process._fatalException method which is called into from C++ in order to either emit the 'uncaughtException' method, or emit 'error' on the active domain. The 'uncaughtException' event is an implementation detail that it would be nice to deprecate one day, so exposing it as part of the domain machinery is not ideal. Fix #4375
2012-12-27domain: speed up domain.createRyunosuke SATO
Use `EventEmitter.call` instead of `EventEmitter.apply` because of performance.
2012-09-25domain: Remove stray console.logisaacs
2012-09-21domain: Properly exit() on domain disposalisaacs
This addresses #4034. There are two problems happening: 1. The domain is not exited automatically when calling dispose() on it. Then, since the domain is disposed, attempting to exit it again will do nothing. 2. The active domain is stored on process.domain. Since thrown errors call `process.emit('uncaughtException', er)`, and the process is an event emitter with a `.domain` member, it re-enters the domain a second time before calling the error handler, pushing it onto the stack again. Thus, if the handler calls `domain.dispose()`, then the domain is now on the stack twice, and cannot be exited properly. Since the domain is disposed, any subsequent IO will be no-op'ed, since we've declared that this context is done and best forgotten. The solution here is twofold: 1. In EventEmitter.emit, do not enter the domain if `this===process`. 2. Automatically exit the domain when calling `domain.dispose()`.
2012-07-16domain: Fix stack leak on errorisaacs
2012-07-09domain: Remove first arg from intercepted fnToshihiro Nakamura
Fix to remove the first-arg, in case arguments length is more than 2 Add domain.intercept() test about first-arg removal
2012-06-09domain: run now return callback resultAndreas Madsen
both domain.bind and domain.intercept act this way
2012-06-09domain: dry decorate using util._extendAndreas Madsen
2012-06-08Fix #3379 prevent domain.intercept passing 1st arg to cbMarc Harter
2012-04-17lintisaacs
2012-04-17Domain featureisaacs
This is a squashed commit of the main work done on the domains-wip branch. The original commit messages are preserved for posterity: * Implicitly add EventEmitters to active domain * Implicitly add timers to active domain * domain: add members, remove ctor cb * Don't hijack bound callbacks for Domain error events * Add dispose method * Add domain.remove(ee) method * A test of multiple domains in process at once * Put the active domain on the process object * Only intercept error arg if explicitly requested * Typo * Don't auto-add new domains to the current domain While an automatic parent/child relationship is sort of neat, and leads to some nice error-bubbling characteristics, it also results in keeping a reference to every EE and timer created, unless domains are explicitly disposed of. * Explicitly adding one domain to another is still fine, of course. * Don't allow circular domain->domain memberships * Disposing of a domain removes it from its parent * Domain disposal turns functions into no-ops * More documentation of domains * More thorough dispose() semantics * An example using domains in an HTTP server * Don't handle errors on a disposed domain * Need to push, even if the same domain is entered multiple times * Array.push is too slow for the EE Ctor * lint domain * domain: docs * Also call abort and destroySoon to clean up event emitters * domain: Wrap destroy methods in a try/catch * Attach tick callbacks to active domain * domain: Only implicitly bind timers, not explicitly * domain: Don't fire timers when disposed. * domain: Simplify naming so that MakeCallback works on Timers * Add setInterval and nextTick to domain test * domain: Make stack private