[gettler] Replace the library wide mutex with individual mutexes on certain data structures.