Skip to content

Commit c1c952f

Browse files
committed
Fix unit test failure.
1 parent f07bcae commit c1c952f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/src/main/java/io/grpc/internal/ManagedChannelImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,13 @@ public boolean isTerminated() {
808808
@Override
809809
public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
810810
CallOptions callOptions) {
811+
// If we have no interceptors, we don't need to populate the executor in CallOptions
812+
// yet. This avoids mutating CallOptions unnecessarily and breaking tests that
813+
// expect exact instance equality. The executor will still be safeguarded when
814+
// creating the actual ClientCallImpl.
815+
if (interceptorChannel == realChannel) {
816+
return realChannel.newCall(method, callOptions);
817+
}
811818
Executor executor = callOptions.getExecutor();
812819
if (executor == null) {
813820
executor = this.executor;

0 commit comments

Comments
 (0)