void ReplicationCoordinatorExternalStateImpl::shutdown() {
     _syncSourceFeedback.shutdown();
     BackgroundSync* bgsync = BackgroundSync::get();
     bgsync->shutdown();
     _syncSourceFeedbackThread->join();
     _backgroundSyncThread->join();
     _producerThread->join();
 }
 void ReplicationCoordinatorExternalStateImpl::shutdown() {
     boost::lock_guard<boost::mutex> lk(_threadMutex);
     if (_startedThreads) {
         log() << "Stopping replication applier threads";
         _syncSourceFeedback.shutdown();
         _syncSourceFeedbackThread->join();
         _applierThread->join();
         BackgroundSync* bgsync = BackgroundSync::get();
         bgsync->shutdown();
         _producerThread->join();
     }
 }
void ReplicationCoordinatorExternalStateImpl::shutdown() {
    stdx::lock_guard<stdx::mutex> lk(_threadMutex);
    if (_startedThreads) {
        log() << "Stopping replication applier threads";
        if (_syncSourceFeedbackThread) {
            _syncSourceFeedback.shutdown();
            _syncSourceFeedbackThread->join();
        }
        if (_applierThread) {
            _applierThread->join();
        }

        if (_producerThread) {
            BackgroundSync* bgsync = BackgroundSync::get();
            if (bgsync) {
                bgsync->shutdown();
            }
            _producerThread->join();
        }
        if (_snapshotThread)
            _snapshotThread->shutdown();
    }
}