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.
This change will fix the race, but isn't ideal because the watcher goroutine might
still be going, although it will undoubtedly finish very soon, so perhaps we
don't care so much. If we do care, then the right solution is to wait
for the channel to be closed after detecting the tomb dying.