/** * 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(); } }
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(); }
@java.lang.Override protected ServiceVersionClientServiceBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new ServiceVersionClientServiceBlockingStub(channel, callOptions); }
public Long call() { return mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(); } });
/** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ public static ServiceVersionClientServiceBlockingStub newBlockingStub( io.grpc.Channel channel) { return new ServiceVersionClientServiceBlockingStub(channel); }
/** * <pre> ** * Returns the version of the master service. * NOTE: The version should be updated every time a backwards incompatible API change occurs. * </pre> */ public alluxio.grpc.GetServiceVersionPResponse getServiceVersion(alluxio.grpc.GetServiceVersionPRequest request) { return blockingUnaryCall( getChannel(), getGetServiceVersionMethod(), getCallOptions(), request); } }