Fix bug #1333098. Concurrent access to the objectCache needs to be protected.

We add a Mutex around the objectCache map.

While there, I discovered a difference race condition in the api Watcher code.
So I fixed that in passing.

The new test fails if you run under '-race', and the tests in cmd/jujud/*TestMachineAgentRsyslog* used
to fail with the race detector and now pass.
I went with removing the "wg" from the global object and instead only using it as a local variable inside the commonLoop code.
All the tests still pass, and the race detector is happy.