mirror of https://github.com/grpc/grpc-java.git
core: fix boq conformance failures (#8281)
Fix false alarm to please boq conformance verifications, ref. go/boq-conformance-violations/BLOCKING#what-should-i-do-instead.
This commit is contained in:
parent
c092d94255
commit
c1ad5de135
|
|
@ -28,6 +28,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import io.grpc.Attributes;
|
||||
|
|
@ -53,7 +54,6 @@ import io.grpc.ServerMethodDefinition;
|
|||
import io.grpc.ServerServiceDefinition;
|
||||
import io.grpc.ServerTransportFilter;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.StatusException;
|
||||
import io.perfmark.Link;
|
||||
import io.perfmark.PerfMark;
|
||||
import io.perfmark.Tag;
|
||||
|
|
@ -606,17 +606,11 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
|||
|
||||
private void runInternal() {
|
||||
ServerStreamListener listener = NOOP_LISTENER;
|
||||
ServerCallParameters<?,?> callParameters;
|
||||
try {
|
||||
if (future.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (!future.isDone() || (callParameters = future.get()) == null) {
|
||||
Status status = Status.INTERNAL.withDescription(
|
||||
"Unexpected failure retrieving server call parameters.");
|
||||
throw new StatusException(status);
|
||||
}
|
||||
listener = startWrappedCall(methodName, callParameters, headers);
|
||||
listener = startWrappedCall(methodName, Futures.getDone(future), headers);
|
||||
} catch (Throwable ex) {
|
||||
stream.close(Status.fromThrowable(ex), new Metadata());
|
||||
context.cancel(null);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ import io.grpc.ServerStreamTracer;
|
|||
import io.grpc.ServerTransportFilter;
|
||||
import io.grpc.ServiceDescriptor;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.Status.Code;
|
||||
import io.grpc.StringMarshaller;
|
||||
import io.grpc.internal.ServerImpl.JumpToApplicationThreadServerStreamListener;
|
||||
import io.grpc.internal.ServerImplBuilder.ClientTransportServersBuilder;
|
||||
|
|
@ -533,6 +534,7 @@ public class ServerImplTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("CheckReturnValue")
|
||||
public void executorSupplierFutureNotSet() throws Exception {
|
||||
builder.executorSupplier = new ServerCallExecutorSupplier() {
|
||||
@Override
|
||||
|
|
@ -575,7 +577,8 @@ public class ServerImplTest {
|
|||
assertThat(callReference.get()).isNull();
|
||||
verify(stream, times(2)).close(statusCaptor.capture(), any(Metadata.class));
|
||||
Status status = statusCaptor.getAllValues().get(1);
|
||||
assertEquals(Status.Code.INTERNAL, status.getCode());
|
||||
assertEquals(Code.UNKNOWN, status.getCode());
|
||||
assertThat(status.getCause() instanceof IllegalStateException);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue