/** * 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( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { alluxio.grpc.GetServiceVersionPRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (alluxio.grpc.GetServiceVersionPRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_;
/** * <code>optional .alluxio.grpc.version.ServiceType serviceType = 1;</code> */ public Builder setServiceType(alluxio.grpc.ServiceType value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; serviceType_ = value.getNumber(); onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
public static Builder newBuilder(alluxio.grpc.GetServiceVersionPRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
/** * <code>optional .alluxio.grpc.version.ServiceType serviceType = 1;</code> */ public Builder clearServiceType() { bitField0_ = (bitField0_ & ~0x00000001); serviceType_ = 0; onChanged(); return this; } public final Builder setUnknownFields(
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof alluxio.grpc.GetServiceVersionPRequest) { return mergeFrom((alluxio.grpc.GetServiceVersionPRequest)other); } else { super.mergeFrom(other); return this; } }
@java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() {
public alluxio.grpc.GetServiceVersionPRequest buildPartial() { alluxio.grpc.GetServiceVersionPRequest result = new alluxio.grpc.GetServiceVersionPRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.serviceType_ = serviceType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
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(); }
public Long call() { return mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(); } });
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 alluxio.grpc.GetServiceVersionPRequest build() { alluxio.grpc.GetServiceVersionPRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }