|
@@ -100,7 +100,8 @@ public class FLEBackwardElectionRoundTest extends ZKTestCase {
|
|
|
port[i] = clientport;
|
|
|
}
|
|
|
|
|
|
- ByteBuffer initialMsg = FLETestUtils.createMsg(ServerState.FOLLOWING.ordinal(), 0, 0, 1);
|
|
|
+ ByteBuffer initialMsg0 = getMsg();
|
|
|
+ ByteBuffer initialMsg1 = getMsg();
|
|
|
|
|
|
/*
|
|
|
* Start server 0
|
|
@@ -117,7 +118,7 @@ public class FLEBackwardElectionRoundTest extends ZKTestCase {
|
|
|
cnxManagers[0] = new QuorumCnxManager(mockPeer);
|
|
|
cnxManagers[0].listener.start();
|
|
|
|
|
|
- cnxManagers[0].toSend(0l, initialMsg);
|
|
|
+ cnxManagers[0].toSend(0l, initialMsg0);
|
|
|
|
|
|
/*
|
|
|
* Start mock server 2
|
|
@@ -126,7 +127,7 @@ public class FLEBackwardElectionRoundTest extends ZKTestCase {
|
|
|
cnxManagers[1] = new QuorumCnxManager(mockPeer);
|
|
|
cnxManagers[1].listener.start();
|
|
|
|
|
|
- cnxManagers[1].toSend(0l, initialMsg);
|
|
|
+ cnxManagers[1].toSend(0l, initialMsg1);
|
|
|
|
|
|
/*
|
|
|
* Run another instance of leader election.
|
|
@@ -138,8 +139,8 @@ public class FLEBackwardElectionRoundTest extends ZKTestCase {
|
|
|
/*
|
|
|
* Send the same messages, this time should not make 0 the leader.
|
|
|
*/
|
|
|
- cnxManagers[0].toSend(0l, initialMsg);
|
|
|
- cnxManagers[1].toSend(0l, initialMsg);
|
|
|
+ cnxManagers[0].toSend(0l, initialMsg0);
|
|
|
+ cnxManagers[1].toSend(0l, initialMsg1);
|
|
|
|
|
|
thread.join(5000);
|
|
|
|
|
@@ -148,4 +149,8 @@ public class FLEBackwardElectionRoundTest extends ZKTestCase {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private ByteBuffer getMsg() {
|
|
|
+ return FLETestUtils.createMsg(ServerState.FOLLOWING.ordinal(), 0, 0, 1);
|
|
|
+ }
|
|
|
}
|