Cleanup of callback handling and tpc_vote().
There are two kinds of callbacks, commit actions and close actions. It is assumed that the use of these callbacks is infrequent. As a result, the implementation used tuples defined as class attributes to avoid creation of instance variables to hold callbacks in the common case. This implementation is complicated because tuples are immutable. Unfortunately, the instance variables were actually created anyway in tpc_abort() and tpc_vote(). This implementation changes the class attributes __onCloseCallbacks and __onCommitCallbacks to default to None. If a callback is registered with an instance, a list is bound to an instance attribute of the same name. When the transaction commits or aborts, the instance attribute is deleted. tpc_vote(): Remove the default arguments since they are unused in the body of the method.
Showing
Please register or sign in to comment