entrendipity/gremlin-node — pull request #37 by inolen (2013-10-28 17:27:49+00:00)
Title: manually manage transactions

from the commit:

Transactions in TransactionalGraph's are often, by default, bound against the
executing thread (e.g. as a ThreadLocal variable). This behavior is not very
helpful in JavaScript because while the main execution is in fact performed
on a single thread, often a pool of threads exist to service asynchronous tasks,
making our tasks often operate on an incorrect transaction instance.

Due to this, we try and avoid this default thread-bound functionality and manage
our own life-cycle if the supplied graph instance provides the interface to create
a transaction independent of the executing thread.

part of what I was discussing in https://github.com/entrendipity/gremlin-node/issues/30#issuecomment-27206947

This seems like a pretty sane, and db agnostic way to handle this issue. Also, this means gremlin-node will work out of the box for people trying to wrap titan graphs. They no longer need to know to actually wrap newTransactionSync(), not the graph instance as it'll be automatically handled (and the instance will be reused, providing caching if it hasn't been committed or rolled back).