mongodb/mongo-cxx-driver — pull request #156 by amidvidy (2014-09-12 14:54:17+00:00)
Title: CXX-334 Remove StaticObserver and all uses in ReplicaSetMonitor

This is kind of a hacky way of doing it, but I don't see a better way without refactoring/redesigning RSM to not rely on a global ReplicaSetMonitorWatcher instance.

I added an initialize() method that starts the RSMW, and I actually now run the RSMW destructor when cleanup() is called. This is an attempt to fix the ordering issues between the client::shutdown() method and the RSMW destructor.

I also added a bit of logic to make initialize() and cleanup() OK to be called repeatedly. This shouldn't ever be a thing in production code, but we reply on it in our tests. I also inserted calls to initialize() where needed in the dbclient_rs and replica_set_monitor tests.