diff --git a/docs/src/main/java/io/helidon/docs/se/grpc/ServerSnippets.java b/docs/src/main/java/io/helidon/docs/se/grpc/ServerSnippets.java index 2d8c64e74f2..6f9e7ff24ef 100644 --- a/docs/src/main/java/io/helidon/docs/se/grpc/ServerSnippets.java +++ b/docs/src/main/java/io/helidon/docs/se/grpc/ServerSnippets.java @@ -23,7 +23,7 @@ import com.google.protobuf.Descriptors; import io.grpc.stub.StreamObserver; -import static io.helidon.webserver.grpc.ResponseHelper.complete; +import static io.helidon.grpc.core.ResponseHelper.complete; @SuppressWarnings("ALL") class ServerSnippets { diff --git a/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java deleted file mode 100644 index f555589c705..00000000000 --- a/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.grpc; - -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.CompletionStage; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import java.util.function.Supplier; -import java.util.stream.Stream; - -import io.grpc.stub.StreamObserver; - -/** - * A number of helper methods to handle sending responses to a {@link io.grpc.stub.StreamObserver}. - */ -public final class ResponseHelper { - private ResponseHelper() { - } - - /** - * Complete a gRPC request. - *
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * specified value then calling {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param value the value to use when calling {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.CompletionStage} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param future the {@link java.util.concurrent.CompletionStage} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.CompletionStage} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * The execution will take place asynchronously on the fork-join thread pool.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param future the {@link java.util.concurrent.CompletionStage} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.CompletionStage} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param future the {@link java.util.concurrent.CompletionStage} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.Callable} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.Callable#call()} method throws an exception then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param callable the {@link java.util.concurrent.Callable} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.Callable} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.Callable#call()} method throws an exception then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * The execution will take place asynchronously on the fork-join thread pool.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param callable the {@link java.util.concurrent.Callable} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * The request will be completed by calling {@link io.grpc.stub.StreamObserver#onNext(Object)} using the
- * result obtained on completion of the specified {@link java.util.concurrent.Callable} and then calling
- * {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * If the {@link java.util.concurrent.Callable#call()} method throws an exception then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param callable the {@link java.util.concurrent.Callable} to use to obtain the value to use to call
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param
- * If the {@link Runnable#run()} method throws an exception then {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param task the {@link Runnable} to execute
- * @param result the result to pass to {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * If the {@link Runnable#run()} method throws an exception then {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * The task and and request completion will be executed on the fork-join thread pool.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param task the {@link Runnable} to execute
- * @param result the result to pass to {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * If the {@link Runnable#run()} method throws an exception then {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param task the {@link Runnable} to execute
- * @param result the result to pass to {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param
- * If an error occurs whilst streaming results then {@link io.grpc.stub.StreamObserver#onError(Throwable)} will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param stream the {@link java.util.stream.Stream} of results to send to
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * If an error occurs whilst streaming results then {@link io.grpc.stub.StreamObserver#onError(Throwable)} will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param stream the {@link java.util.stream.Stream} of results to send to
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param
- * If an error occurs whilst streaming results then {@link io.grpc.stub.StreamObserver#onError(Throwable)} will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param supplier the {@link java.util.function.Supplier} of the {@link java.util.stream.Stream} of results to send to
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param
- * If an error occurs whilst streaming results then {@link io.grpc.stub.StreamObserver#onError(Throwable)} will be called.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to complete
- * @param supplier the {@link java.util.function.Supplier} of the {@link java.util.stream.Stream} of results to send to
- * {@link io.grpc.stub.StreamObserver#onNext(Object)}
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called instead of {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to send values to and complete when the
- * {@link java.util.concurrent.CompletionStage} completes
- * @param stage the {@link java.util.concurrent.CompletionStage} to await completion of
- * @param
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called instead of {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to send values to and complete when the
- * {@link java.util.concurrent.CompletionStage} completes
- * @param stage the {@link java.util.concurrent.CompletionStage} to await completion of
- * @param
- * If the {@link java.util.concurrent.CompletionStage} completes with an error then
- * {@link io.grpc.stub.StreamObserver#onError(Throwable)}
- * will be called instead of {@link io.grpc.stub.StreamObserver#onCompleted()}.
- *
- * @param observer the {@link io.grpc.stub.StreamObserver} to send values to and complete when the
- * {@link java.util.concurrent.CompletionStage} completes
- * @param stage the {@link java.util.concurrent.CompletionStage} to await completion of
- * @param executor the {@link java.util.concurrent.Executor} on which to execute the asynchronous
- * request completion
- * @param