Using atomic/CAS for collections.

This is in preparation for atomic swapping of the collections,
such as for future changes which implement compaction.