diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/util/GrpcUtil.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/util/GrpcUtil.java index 940d84da862..3031cfae6db 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/util/GrpcUtil.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/util/GrpcUtil.java @@ -112,10 +112,25 @@ private static void safelyExecuteLocked(final StreamObserver observer, } } + /** + * Sends one message to the stream, ignoring any errors that may happen during that call. + * + * @param observer the stream to complete + * @param message the message to send on this stream + * @param the type of message that the stream handles + */ public static void safelyOnNext(StreamObserver observer, T message) { safelyExecuteLocked(observer, () -> observer.onNext(message)); } + /** + * Sends one message and then completes the stream, ignoring any errors that may happen during these calls. Useful + * for unary responses. + * + * @param observer the stream to complete + * @param message the last message to send on this stream before completing + * @param the type of message that the stream handles + */ public static void safelyComplete(StreamObserver observer, T message) { safelyExecuteLocked(observer, () -> { observer.onNext(message); @@ -123,6 +138,11 @@ public static void safelyComplete(StreamObserver observer, T message) { }); } + /** + * Completes the stream, ignoring any errors that may happen during this call. + * + * @param observer the stream to complete + */ public static void safelyComplete(StreamObserver observer) { safelyExecuteLocked(observer, observer::onCompleted); }