Use transactions in threading test.

Change-Id: I3d8f688340d3a47e17011b158d57433c8d6fbdb9