Updated synchronization logic around distdatastore handler factory to deal with possible race conditions