Remove DiscoveryNodes#masterNode in favour of existing DiscoveryNodes#getMasterNode

Original commit: elastic/x-pack-elasticsearch@070850c49f
This commit is contained in:
javanna 2016-03-30 15:19:41 +02:00 committed by Luca Cavanna
parent 9f87fd5fc7
commit 9461dde896
2 changed files with 3 additions and 3 deletions

View File

@ -749,7 +749,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
final ClusterState clusterState = clusterService.state();
if (clusterService.lifecycleState() == Lifecycle.State.STARTED
&& clusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK) == false
&& clusterState.nodes().masterNode() != null) {
&& clusterState.nodes().getMasterNode() != null) {
final LicensesMetaData currentMetaData = clusterState.metaData().custom(LicensesMetaData.TYPE);
if (currentMetaData == null || currentMetaData.getLicense() == null) {
// triggers a cluster changed event
@ -762,7 +762,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
}
private void requestTrialLicense(final ClusterState currentState) {
DiscoveryNode masterNode = currentState.nodes().masterNode();
DiscoveryNode masterNode = currentState.nodes().getMasterNode();
if (masterNode == null) {
throw new IllegalStateException("master not available when registering auto-generated license");
}

View File

@ -100,7 +100,7 @@ public class ClusterStateTests extends MarvelIntegTestCase {
logger.debug("--> ensure that the 'nodes' attributes of the cluster state document is not indexed");
assertHitCount(client().prepareSearch().setSize(0)
.setTypes(ClusterStateResolver.TYPE)
.setQuery(matchQuery("cluster_state.nodes." + nodes.getMasterNodeId() + ".name", nodes.masterNode().getName())).get(), 0L);
.setQuery(matchQuery("cluster_state.nodes." + nodes.getMasterNodeId() + ".name", nodes.getMasterNode().getName())).get(), 0L);
}
public void testClusterStateNodes() throws Exception {