use of alluxio.grpc.GrpcServerAddress in project alluxio by Alluxio.
the class FileSystemContext method acquireBlockWorkerClientInternal.
private CloseableResource<BlockWorkerClient> acquireBlockWorkerClientInternal(final WorkerNetAddress workerNetAddress, final ClientContext context, UserState userState) throws IOException {
SocketAddress address = NetworkAddressUtils.getDataPortSocketAddress(workerNetAddress, context.getClusterConf());
GrpcServerAddress serverAddress = GrpcServerAddress.create(workerNetAddress.getHost(), address);
ClientPoolKey key = new ClientPoolKey(address, AuthenticationUserUtils.getImpersonationUser(userState.getSubject(), context.getClusterConf()));
final ConcurrentHashMap<ClientPoolKey, BlockWorkerClientPool> poolMap = mBlockWorkerClientPoolMap;
return new CloseableResource<BlockWorkerClient>(poolMap.computeIfAbsent(key, k -> new BlockWorkerClientPool(userState, serverAddress, context.getClusterConf().getInt(PropertyKey.USER_BLOCK_WORKER_CLIENT_POOL_MIN), context.getClusterConf().getInt(PropertyKey.USER_BLOCK_WORKER_CLIENT_POOL_MAX), context.getClusterConf())).acquire()) {
// Save the reference to the original pool map.
@Override
public void closeResource() {
releaseBlockWorkerClient(workerNetAddress, get(), context, poolMap);
}
};
}
Aggregations