logToFile.initializeReplicationSlaveRole();
// Retry to setup a connection with the master until a
// connection has been established or until we are no longer
// in replication slave mode
receiver = new ReplicationMessageReceive(slaveAddr, dbname);
while (!setupConnection()) {
if (!inReplicationSlaveMode) {
// If we get here, another thread has called
// stopSlave() while we waited for a connection with
// the master. The thread shutting the slave down will