use concurrent map instead of thread local map
Merge pull request #4198 from wmtan/AvoidThreadLocals

Avoid thread locals.