Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ private[spark] class Client(
private class DriverEndpointsReadyWatcher(resolvedDriverEndpoints: SettableFuture[Endpoints])
extends Watcher[Endpoints] {
override def eventReceived(action: Action, endpoints: Endpoints): Unit = {
if ((action == Action.ADDED) || (action == Action.MODIFIED)
if ((action == Action.ADDED || action == Action.MODIFIED)
&& (endpoints != null)
&& (endpoints.getSubsets != null)
&& endpoints.getSubsets.asScala.nonEmpty
&& endpoints.getSubsets.asScala.exists(_.getAddresses.asScala.nonEmpty)
&& !resolvedDriverEndpoints.isDone) {
Expand All @@ -554,7 +556,7 @@ private[spark] class Client(
private class DriverServiceReadyWatcher(resolvedDriverService: SettableFuture[Service])
extends Watcher[Service] {
override def eventReceived(action: Action, service: Service): Unit = {
if ((action == Action.ADDED) || (action == Action.MODIFIED)
if ((action == Action.ADDED || action == Action.MODIFIED)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parentheses change slightly modifies the evaluation order of these expressions, and the new ordering seems correct.

Java precedence for boolean expressions is ! then && then || so previously this was evaluating the && first and then the ||

&& !resolvedDriverService.isDone) {
resolvedDriverService.set(service)
}
Expand Down