Add ReadWrite lock to improve performance of getAttributes()

getAttributes() blocks when reading attributes even though this is a
safe operation. This causes blocks in a threaded environment under
load. Added a ReadWrite lock to allow access to the attributes unless
writes are being made.