Package alluxio.grpc

Class GrpcChannel

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class GrpcChannel
    extends io.grpc.Channel
    implements java.lang.AutoCloseable
    Used to gather gRPC level resources and indexes together.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GrpcChannel​(GrpcChannelKey channelKey, io.grpc.ManagedChannel managedChannel)
      Creates a new connection object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void authenticate​(AuthType authType, javax.security.auth.Subject subject, AlluxioConfiguration config)  
      java.lang.String authority()  
      void close()
      Releases the connection to the pool.
      boolean equals​(java.lang.Object other)  
      io.grpc.Channel getChannel()  
      GrpcChannelKey getChannelKey()  
      int hashCode()  
      void intercept​(io.grpc.ClientInterceptor interceptor)
      Registers interceptor to the channel.
      boolean isHealthy()  
      boolean isShutdown()  
      <RequestT,​ResponseT>
      io.grpc.ClientCall<RequestT,​ResponseT>
      newCall​(io.grpc.MethodDescriptor<RequestT,​ResponseT> methodDescriptor, io.grpc.CallOptions callOptions)  
      void shutdown()
      Shuts down the channel.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrpcChannel

        protected GrpcChannel​(GrpcChannelKey channelKey,
                              io.grpc.ManagedChannel managedChannel)
        Creates a new connection object.
        Parameters:
        channelKey - gRPC channel key
        managedChannel - the underlying gRPC ManagedChannel
    • Method Detail

      • getChannelKey

        public GrpcChannelKey getChannelKey()
        Returns:
        the hannel key that owns the connection
      • getChannel

        public io.grpc.Channel getChannel()
        Returns:
        the channel
      • newCall

        public <RequestT,​ResponseT> io.grpc.ClientCall<RequestT,​ResponseT> newCall​(io.grpc.MethodDescriptor<RequestT,​ResponseT> methodDescriptor,
                                                                                               io.grpc.CallOptions callOptions)
        Specified by:
        newCall in class io.grpc.Channel
      • authority

        public java.lang.String authority()
        Specified by:
        authority in class io.grpc.Channel
      • intercept

        public void intercept​(io.grpc.ClientInterceptor interceptor)
        Registers interceptor to the channel.
        Parameters:
        interceptor - the gRPC client interceptor
      • shutdown

        public void shutdown()
        Shuts down the channel. Shutdown should be thread safe as it could be called concurrently due to: - Authentication long polling - gRPC messaging stream.
      • isShutdown

        public boolean isShutdown()
        Returns:
        true if the channel has been shut down
      • isHealthy

        public boolean isHealthy()
        Returns:
        true if channel is healthy
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • close

        public void close()
        Releases the connection to the pool.
        Specified by:
        close in interface java.lang.AutoCloseable