mirror of https://github.com/grpc/grpc-java.git
Remove references to Throwable.propagate
This commit is contained in:
parent
99a6d8de27
commit
65d3847d14
|
|
@ -37,7 +37,6 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
|
|
||||||
|
|
@ -407,8 +406,10 @@ public final class GrpcUtil {
|
||||||
method.invoke(service, true);
|
method.invoke(service, true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
// no op
|
// no op
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw Throwables.propagate(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ import static io.grpc.internal.GrpcUtil.MESSAGE_ACCEPT_ENCODING_KEY;
|
||||||
import static io.grpc.internal.GrpcUtil.MESSAGE_ENCODING_KEY;
|
import static io.grpc.internal.GrpcUtil.MESSAGE_ENCODING_KEY;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
|
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.Codec;
|
import io.grpc.Codec;
|
||||||
|
|
@ -158,9 +157,12 @@ final class ServerCallImpl<ReqT, RespT> extends ServerCall<RespT> {
|
||||||
InputStream resp = method.streamResponse(message);
|
InputStream resp = method.streamResponse(message);
|
||||||
stream.writeMessage(resp);
|
stream.writeMessage(resp);
|
||||||
stream.flush();
|
stream.flush();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
close(Status.fromThrowable(e), new Metadata());
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
close(Status.fromThrowable(t), new Metadata());
|
close(Status.fromThrowable(t), new Metadata());
|
||||||
throw Throwables.propagate(t);
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import static io.grpc.internal.GrpcUtil.TIMEOUT_KEY;
|
||||||
import static io.grpc.internal.GrpcUtil.TIMER_SERVICE;
|
import static io.grpc.internal.GrpcUtil.TIMER_SERVICE;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.MoreExecutors;
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
|
|
||||||
|
|
@ -324,10 +323,14 @@ public final class ServerImpl extends io.grpc.Server {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
listener = startCall(stream, methodName, method, timeout, headers, context);
|
listener = startCall(stream, methodName, method, timeout, headers, context);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
stream.close(Status.fromThrowable(e), new Metadata());
|
||||||
|
timeout.cancel(true);
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
stream.close(Status.fromThrowable(t), new Metadata());
|
stream.close(Status.fromThrowable(t), new Metadata());
|
||||||
timeout.cancel(true);
|
timeout.cancel(true);
|
||||||
throw Throwables.propagate(t);
|
throw new RuntimeException(t);
|
||||||
} finally {
|
} finally {
|
||||||
jumpListener.setListener(listener);
|
jumpListener.setListener(listener);
|
||||||
}
|
}
|
||||||
|
|
@ -441,9 +444,12 @@ public final class ServerImpl extends io.grpc.Server {
|
||||||
public void runInContext() {
|
public void runInContext() {
|
||||||
try {
|
try {
|
||||||
getListener().messageRead(message);
|
getListener().messageRead(message);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
internalClose(Status.fromThrowable(e), new Metadata());
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
internalClose(Status.fromThrowable(t), new Metadata());
|
internalClose(Status.fromThrowable(t), new Metadata());
|
||||||
throw Throwables.propagate(t);
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -456,9 +462,12 @@ public final class ServerImpl extends io.grpc.Server {
|
||||||
public void runInContext() {
|
public void runInContext() {
|
||||||
try {
|
try {
|
||||||
getListener().halfClosed();
|
getListener().halfClosed();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
internalClose(Status.fromThrowable(e), new Metadata());
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
internalClose(Status.fromThrowable(t), new Metadata());
|
internalClose(Status.fromThrowable(t), new Metadata());
|
||||||
throw Throwables.propagate(t);
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
|
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.Channel;
|
import io.grpc.Channel;
|
||||||
|
|
@ -43,8 +42,8 @@ import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.ResolvedServerInfo;
|
import io.grpc.ResolvedServerInfo;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.TransportManager.InterimTransport;
|
|
||||||
import io.grpc.TransportManager;
|
import io.grpc.TransportManager;
|
||||||
|
import io.grpc.TransportManager.InterimTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.stub.StreamObserver;
|
import io.grpc.stub.StreamObserver;
|
||||||
|
|
@ -296,7 +295,7 @@ class GrpclbLoadBalancer<T> extends LoadBalancer<T> {
|
||||||
newServerMap.put(address, new ResolvedServerInfo(address, Attributes.EMPTY));
|
newServerMap.put(address, new ResolvedServerInfo(address, Attributes.EMPTY));
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
Throwables.propagate(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
package io.grpc.testing.integration;
|
package io.grpc.testing.integration;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.util.concurrent.MoreExecutors;
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
|
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
|
|
@ -138,7 +137,7 @@ public class ConcurrencyTest {
|
||||||
startBarrier.await();
|
startBarrier.await();
|
||||||
clientStub.streamingOutputCall(request, new SignalingResponseObserver(responsesDoneSignal));
|
clientStub.streamingOutputCall(request, new SignalingResponseObserver(responsesDoneSignal));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Throwables.propagate(e);
|
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
package io.grpc.netty;
|
package io.grpc.netty;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
|
|
||||||
import io.grpc.internal.AbstractReadableBuffer;
|
import io.grpc.internal.AbstractReadableBuffer;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
@ -42,9 +41,9 @@ import java.io.OutputStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Buffer} implementation that is backed by a Netty {@link ByteBuf}. This class does not
|
* A {@link java.nio.Buffer} implementation that is backed by a Netty {@link ByteBuf}. This class
|
||||||
* call {@link ByteBuf#retain}, so if that is needed it should be called prior to creating this
|
* does not call {@link ByteBuf#retain}, so if that is needed it should be called prior to creating
|
||||||
* buffer.
|
* this buffer.
|
||||||
*/
|
*/
|
||||||
class NettyReadableBuffer extends AbstractReadableBuffer {
|
class NettyReadableBuffer extends AbstractReadableBuffer {
|
||||||
private final ByteBuf buffer;
|
private final ByteBuf buffer;
|
||||||
|
|
@ -88,7 +87,7 @@ class NettyReadableBuffer extends AbstractReadableBuffer {
|
||||||
try {
|
try {
|
||||||
buffer.readBytes(dest, length);
|
buffer.readBytes(dest, length);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw Throwables.propagate(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
package io.grpc.stub;
|
package io.grpc.stub;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.util.concurrent.AbstractFuture;
|
import com.google.common.util.concurrent.AbstractFuture;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
|
@ -115,7 +114,7 @@ public class ClientCalls {
|
||||||
return getUnchecked(futureUnaryCall(call, param));
|
return getUnchecked(futureUnaryCall(call, param));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
call.cancel();
|
call.cancel();
|
||||||
throw Throwables.propagate(t);
|
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +140,7 @@ public class ClientCalls {
|
||||||
return getUnchecked(responseFuture);
|
return getUnchecked(responseFuture);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
call.cancel();
|
call.cancel();
|
||||||
throw Throwables.propagate(t);
|
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,7 +227,7 @@ public class ClientCalls {
|
||||||
call.halfClose();
|
call.halfClose();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
call.cancel();
|
call.cancel();
|
||||||
throw Throwables.propagate(t);
|
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue