nl.topicus.jdbc.shaded.io.grpc.stub.ClientCallStreamObserver Maven / Gradle / Ivy
Show all versions of spanner-jdbc Show documentation
/*
* Copyright 2016, gRPC Authors All rights reserved.
*
* 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 nl.topicus.jdbc.shaded.io.grpc.stub;
import nl.topicus.jdbc.shaded.com.google.errorprone.annotations.DoNotMock;
import nl.topicus.jdbc.shaded.io.grpc.ExperimentalApi;
import nl.topicus.jdbc.shaded.javax.annotation.Nullable;
/**
* A refinement of {@link CallStreamObserver} that allows for lower-level interaction with
* client calls.
*
* Like {@code StreamObserver}, implementations are not required to be thread-safe; if multiple
* threads will be writing to an instance concurrently, the application must synchronize its calls.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1788")
@DoNotMock
public abstract class ClientCallStreamObserver extends CallStreamObserver {
/**
* Prevent any further processing for this {@code ClientCallStreamObserver}. No further messages
* will be received. The server is informed of cancellations, but may not stop processing the
* call. Cancelling an already
* {@code cancel()}ed {@code ClientCallStreamObserver} has no effect.
*
* No other methods on this class can be called after this method has been called.
*
*
It is recommended that at least one of the arguments to be non-{@code null}, to provide
* useful debug information. Both argument being null may log warnings and result in suboptimal
* performance. Also note that the provided information will not be sent to the server.
*
* @param message if not {@code null}, will appear as the description of the CANCELLED status
* @param cause if not {@code null}, will appear as the cause of the CANCELLED status
*/
public abstract void cancel(@Nullable String message, @Nullable Throwable cause);
}