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

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.
all api life methods take names.Tag
make the WaitGroup a local var, which leaves the tests passing, and avoids the possible race condition.
Merge branch 'master' of https://github.com/juju/juju into 112-state-life-takes-a-tag
state methods take a tag as a string, not an id
Fix test failure
Do not allow the peergrouper worker to publish empty/nil api server addresses
Merge pull request #153 from davecheney/112-state-life-takes-a-tag

api, apiserver: internal life methods now take a names.Tag
Merge pull request #155 from wallyworld/peergrouper-publish-ignore-empty

Do not allow the peergrouper worker to publish empty/nil api server addresses

This is an attempt to fix bug https://bugs.launchpad.net/juju-core/+bug/1333682

Something is writing empty api server addresses to state, which are then propagated to the machine agents, which then update the agent.conf file and boom, the apiaddresses entry is deleted. So I've disallowed the peergrouper worker from publishing empty addresses.
Merge pull request #146 from jameinel/api-concurrent-caching-1333098

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.