T
- the type of client to exposepublic class RpcClient<T extends io.grpc.stub.AbstractBlockingStub<T>> extends Object implements AutoCloseable
Constructor and Description |
---|
RpcClient(AlluxioConfiguration conf,
InetSocketAddress connectAddress,
java.util.function.Function<io.grpc.Channel,T> channelFactory,
java.util.function.Supplier<RetryPolicy> policySupplier)
Create a new instance of the
RpcClient . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static GrpcChannel |
createChannel(InetSocketAddress addr,
AlluxioConfiguration conf)
Creates a gRPC channel that uses NOSASL for security authentication type.
|
T |
get()
Create if necessary a new client if necessary, then return the client.
|
InetSocketAddress |
getAddress() |
public RpcClient(AlluxioConfiguration conf, InetSocketAddress connectAddress, java.util.function.Function<io.grpc.Channel,T> channelFactory, java.util.function.Supplier<RetryPolicy> policySupplier)
RpcClient
.conf
- the configuration used to make the connectionconnectAddress
- the address to connect tochannelFactory
- the factory method used create a new gRPC client around the channelpolicySupplier
- the a supplier of policies to use when attempting to create new channelspublic static GrpcChannel createChannel(InetSocketAddress addr, AlluxioConfiguration conf) throws AlluxioStatusException
addr
- the address to connect toconf
- the configuration used to make the connectionGrpcChannel
AlluxioStatusException
public T get() throws AlluxioStatusException
AlluxioStatusException
- if a connection to the endpoint can't be madepublic InetSocketAddress getAddress()
public void close()
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.