def commit(self):
self._check_thread()<EOL>if self.state != _STATE_ACTIVE:<EOL><INDENT>raise TransactionError("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>self._check_timeout()<EOL>request = transaction_commit_codec.encode_request(self.id, self.thread_id)<EOL>self.client.invoker.invoke_on_connection(request, self.connection).result()<EOL>self.state = _STATE_COMMITTED<EOL><DEDENT>except:<EOL><INDENT>self.state = _STATE_PARTIAL_COMMIT<EOL>raise<EOL><DEDENT>finally:<EOL><INDENT>self._locals.transaction_exists = False<EOL><DEDENT>
Commits this transaction.