Class ProxyServiceChannel

java.lang.Object
com.oracle.coherence.grpc.proxy.common.ProxyServiceChannel
All Implemented Interfaces:
io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>

public class ProxyServiceChannel extends Object implements io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
A bidirectional gRPC channel that handles requests for a gRPC proxy and sends responses back down the channel.
  • Constructor Details

    • ProxyServiceChannel

      public ProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer)
      Parameters:
      service - the parent GrpcService
      observer - the StreamObserver to send responses to
    • ProxyServiceChannel

      protected ProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer, Supplier<Member> memberSupplier)
      Parameters:
      service - the parent GrpcService
      observer - the StreamObserver to send responses to
      memberSupplier - a Supplier to supply the local Member
  • Method Details

    • onNext

      public void onNext(com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest request)
      Specified by:
      onNext in interface io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
    • onCompleted

      public void onCompleted()
      Specified by:
      onCompleted in interface io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
    • getSerializer

      public Serializer getSerializer()
      Return the serializer being used by the protocol.
      Returns:
      the serializer being used by the protocol
    • async

      protected io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest> async(Executor executor)
      Return an async wrapper around this channel.
      Parameters:
      executor - the Executor to use to execute tasks
      Returns:
      an async wrapper around this channel
    • init

      protected void init(long nId, com.oracle.coherence.grpc.messages.proxy.v1.InitRequest request)
      Initialise this channel.
      Parameters:
      nId - the message id of the init request
      request - the InitRequest to use for initialisation
    • assertInit

      protected void assertInit()
      Assert that this channel has received an InitRequest.
      Throws:
      IllegalStateException - if this channel has not been initialized
    • sendError

      protected void sendError(long nId, Throwable thrown)
      Send an error message down the channel.
      Parameters:
      nId - the identifier of the request that the error corresponds to
      thrown - the error to send
    • loadProtocol

      protected static Optional<GrpcServiceProtocol> loadProtocol(String sProtocol)
      Load the requested GrpcServiceProtocol.
      Parameters:
      sProtocol - the name of the protocol to load
      Returns:
      the requested protocol, or an empty optional if the protocol cannot be loaded