ClusterJoinManager clusterJoinManager = node.clusterService.getClusterJoinManager();
long joinStartTime = Clock.currentTimeMillis();
long maxJoinMillis = getMaxJoinMillis();
while (node.isRunning() && !node.joined()
&& (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
<BUG>try {
lookupMasterAddress();
if (node.getThisAddress().equals(masterAddress)) {
node.setJoined();</BUG>
node.setAsMaster();

ClusterJoinManager clusterJoinManager = node.clusterService.getClusterJoinManager();
long joinStartTime = Clock.currentTimeMillis();
long maxJoinMillis = getMaxJoinMillis();
while (node.isRunning() && !node.joined()
&& (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
try {
if (masterAddress == null) {
lookupMasterAddress();
}
if (node.getThisAddress().equals(masterAddress)) {
logger.fine("This node is found as master, no need to join.");
node.setJoined();
node.setAsMaster();
