replicationServerInfo.getServerState(),
replicationServerInfo.getDegradedStatusThreshold(),
this.getGenerationID());
// Perform session start (handshake phase 2)
TopologyMsg topologyMsg = performPhaseTwoHandshake(
replicationServerInfo.getServerURL(), initStatus);
if (topologyMsg != null) // Handshake phase 2 exchange went well
{
try
{
/*
* If we just connected to a RS with a different group id than us
* (because for instance a RS with our group id was unreachable
* while connecting to each RS) but the just received TopologyMsg
* shows that in the same time a RS with our group id connected,
* we must give up the connection to force reconnection that will
* certainly go back to a server with our group id as server with
* our group id have a greater priority for connection (in
* computeBestReplicationServer). In other words, we disconnect to
* connect to a server with our group id. If a server with our
* group id comes back later in the topology, we will be advised
* upon reception of a new TopologyMsg message and we will force
* reconnection at that time to retrieve a server with our group
* id.
*/
byte tmpRsGroupId = replicationServerInfo.getGroupId();
boolean someServersWithSameGroupId =
hasSomeServerWithSameGroupId(topologyMsg.getRsList());
// Really no other server with our group id ?
if ((tmpRsGroupId == groupId) ||
((tmpRsGroupId != groupId) && !someServersWithSameGroupId))
{