/** * Test if the input address is serving an Alluxio service. This method make use of the * gRPC protocol for performing service communication. * * @param address the network address to ping * @param serviceType the Alluxio service type * @param conf Alluxio configuration * @throws UnauthenticatedException If the user is not authenticated * @throws StatusRuntimeException If the host not reachable or does not serve the given service */ public static void pingService(InetSocketAddress address, alluxio.grpc.ServiceType serviceType, AlluxioConfiguration conf) throws UnauthenticatedException, UnavailableException { Preconditions.checkNotNull(address, "address"); Preconditions.checkNotNull(serviceType, "serviceType"); GrpcChannel channel = GrpcChannelBuilder.newBuilder(address, conf).build(); ServiceVersionClientServiceGrpc.ServiceVersionClientServiceBlockingStub versionClient = ServiceVersionClientServiceGrpc.newBlockingStub(channel); versionClient.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(serviceType).build()); channel.shutdown(); } }
public Builder mergeFrom(alluxio.grpc.GetServiceVersionPRequest other) { if (other == alluxio.grpc.GetServiceVersionPRequest.getDefaultInstance()) return this; if (other.hasServiceType()) { setServiceType(other.getServiceType()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public Long call() { return mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(); } });
private void pingMetaService(InetSocketAddress address) throws UnauthenticatedException, UnavailableException { GrpcChannel channel = GrpcChannelBuilder.newBuilder(address, mConfiguration).build(); ServiceVersionClientServiceGrpc.ServiceVersionClientServiceBlockingStub versionClient = ServiceVersionClientServiceGrpc.newBlockingStub(channel); versionClient.getServiceVersion(GetServiceVersionPRequest.newBuilder() .setServiceType(ServiceType.META_MASTER_CLIENT_SERVICE).build()); channel.shutdown(); }