Package alluxio.grpc
Class GrpcChannel
- java.lang.Object
-
- io.grpc.Channel
-
- alluxio.grpc.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.
-
-
-
Constructor Detail
-
GrpcChannel
protected GrpcChannel(GrpcChannelKey channelKey, io.grpc.ManagedChannel managedChannel)
Creates a new connection object.- Parameters:
channelKey
- gRPC channel keymanagedChannel
- the underlying gRPCManagedChannel
-
-
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 classio.grpc.Channel
-
authority
public java.lang.String authority()
- Specified by:
authority
in classio.grpc.Channel
-
authenticate
protected void authenticate(AuthType authType, javax.security.auth.Subject subject, AlluxioConfiguration config) throws AlluxioStatusException
- Throws:
AlluxioStatusException
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
close
public void close()
Releases the connection to the pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-