Use concurrent collection for the thread safety.

Reviewed in https://codereview.appspot.com/10715045/