Refactor State to be 100% thread safe
Merge pull request #2798 from dotcloud/fix_state_race

Refactor State to be 100% thread safe