Skip to content

Commit

Permalink
Discovery: Removed unnecessary DiscoveryService reference from LocalD…
Browse files Browse the repository at this point in the history
…iscover, which causes circular Guice dependencies errors.
  • Loading branch information
martijnvg committed Nov 12, 2014
1 parent 7590629 commit 0b15859
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem

private final TransportService transportService;
private final ClusterService clusterService;
private final DiscoveryService discoveryService;
private final DiscoveryNodeService discoveryNodeService;
private AllocationService allocationService;
private final ClusterName clusterName;
Expand All @@ -78,15 +77,14 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem

@Inject
public LocalDiscovery(Settings settings, ClusterName clusterName, TransportService transportService, ClusterService clusterService,
DiscoveryNodeService discoveryNodeService, Version version, DiscoverySettings discoverySettings, DiscoveryService discoveryService) {
DiscoveryNodeService discoveryNodeService, Version version, DiscoverySettings discoverySettings) {
super(settings);
this.clusterName = clusterName;
this.clusterService = clusterService;
this.transportService = transportService;
this.discoveryNodeService = discoveryNodeService;
this.version = version;
this.discoverySettings = discoverySettings;
this.discoveryService = discoveryService;
}

@Override
Expand Down Expand Up @@ -308,7 +306,7 @@ private void publish(LocalDiscovery[] members, ClusterState clusterState, final
// ignore cluster state messages that do not include "me", not in the game yet...
if (nodeSpecificClusterState.nodes().localNode() != null) {
assert nodeSpecificClusterState.nodes().masterNode() != null : "received a cluster state without a master";
assert !nodeSpecificClusterState.blocks().hasGlobalBlock(discoveryService.getNoMasterBlock()) : "received a cluster state with a master block";
assert !nodeSpecificClusterState.blocks().hasGlobalBlock(discoverySettings.getNoMasterBlock()) : "received a cluster state with a master block";

discovery.clusterService.submitStateUpdateTask("local-disco-receive(from master)", new ProcessedClusterStateNonMasterUpdateTask() {
@Override
Expand All @@ -317,7 +315,7 @@ public ClusterState execute(ClusterState currentState) {
return currentState;
}

if (currentState.blocks().hasGlobalBlock(discoveryService.getNoMasterBlock())) {
if (currentState.blocks().hasGlobalBlock(discoverySettings.getNoMasterBlock())) {
// its a fresh update from the master as we transition from a start of not having a master to having one
logger.debug("got first state from fresh master [{}]", nodeSpecificClusterState.nodes().masterNodeId());
return nodeSpecificClusterState;
Expand Down

0 comments on commit 0b15859

Please sign in to comment.