core: Remove useless NPE check for syncContext in PF

It will never throw, because it would only throw if helper is null, but
helper is checkNotNull()ed in the constructor. It could have checked for
a null return value instead; since it hasn't been, it is clear we don't
need this check.
This commit is contained in:
Eric Anderson 2024-08-17 10:20:14 -07:00
parent 8bd97953ad
commit 33687d3983
1 changed files with 1 additions and 11 deletions

View File

@ -33,7 +33,6 @@ import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup;
import io.grpc.LoadBalancer;
import io.grpc.Status;
import io.grpc.SynchronizationContext;
import io.grpc.SynchronizationContext.ScheduledHandle;
import java.net.SocketAddress;
import java.util.ArrayList;
@ -426,16 +425,7 @@ final class PickFirstLeafLoadBalancer extends LoadBalancer {
}
}
SynchronizationContext synchronizationContext = null;
try {
synchronizationContext = helper.getSynchronizationContext();
} catch (NullPointerException e) {
// All helpers should have a sync context, but if one doesn't (ex. user had a custom test)
// we don't want to break previously working functionality.
return;
}
scheduleConnectionTask = synchronizationContext.schedule(
scheduleConnectionTask = helper.getSynchronizationContext().schedule(
new StartNextConnection(),
CONNECTION_DELAY_INTERVAL_MS,
TimeUnit.MILLISECONDS,