CouchDB: Changes to allow loading to working in parallel

Synchronize the init function on a lock over all instances of the class.
The first thread was creating the database and subsequent threads were
crashing on it expecting to also need to create the database.