1 package io.grpc.health.v1; 2 3 import static io.grpc.MethodDescriptor.generateFullMethodName; 4 5 /** 6 */ 7 @javax.annotation.Generated( 8 value = "by gRPC proto compiler", 9 comments = "Source: grpc/health/v1/health.proto") 10 @io.grpc.stub.annotations.GrpcGenerated 11 public final class HealthGrpc { 12 HealthGrpc()13 private HealthGrpc() {} 14 15 public static final String SERVICE_NAME = "grpc.health.v1.Health"; 16 17 // Static method descriptors that strictly reflect the proto. 18 private static volatile io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, 19 io.grpc.health.v1.HealthCheckResponse> getCheckMethod; 20 21 @io.grpc.stub.annotations.RpcMethod( 22 fullMethodName = SERVICE_NAME + '/' + "Check", 23 requestType = io.grpc.health.v1.HealthCheckRequest.class, 24 responseType = io.grpc.health.v1.HealthCheckResponse.class, 25 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 26 public static io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, getCheckMethod()27 io.grpc.health.v1.HealthCheckResponse> getCheckMethod() { 28 io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, io.grpc.health.v1.HealthCheckResponse> getCheckMethod; 29 if ((getCheckMethod = HealthGrpc.getCheckMethod) == null) { 30 synchronized (HealthGrpc.class) { 31 if ((getCheckMethod = HealthGrpc.getCheckMethod) == null) { 32 HealthGrpc.getCheckMethod = getCheckMethod = 33 io.grpc.MethodDescriptor.<io.grpc.health.v1.HealthCheckRequest, io.grpc.health.v1.HealthCheckResponse>newBuilder() 34 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 35 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Check")) 36 .setSampledToLocalTracing(true) 37 .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( 38 io.grpc.health.v1.HealthCheckRequest.getDefaultInstance())) 39 .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( 40 io.grpc.health.v1.HealthCheckResponse.getDefaultInstance())) 41 .setSchemaDescriptor(new HealthMethodDescriptorSupplier("Check")) 42 .build(); 43 } 44 } 45 } 46 return getCheckMethod; 47 } 48 49 private static volatile io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, 50 io.grpc.health.v1.HealthCheckResponse> getWatchMethod; 51 52 @io.grpc.stub.annotations.RpcMethod( 53 fullMethodName = SERVICE_NAME + '/' + "Watch", 54 requestType = io.grpc.health.v1.HealthCheckRequest.class, 55 responseType = io.grpc.health.v1.HealthCheckResponse.class, 56 methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) 57 public static io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, getWatchMethod()58 io.grpc.health.v1.HealthCheckResponse> getWatchMethod() { 59 io.grpc.MethodDescriptor<io.grpc.health.v1.HealthCheckRequest, io.grpc.health.v1.HealthCheckResponse> getWatchMethod; 60 if ((getWatchMethod = HealthGrpc.getWatchMethod) == null) { 61 synchronized (HealthGrpc.class) { 62 if ((getWatchMethod = HealthGrpc.getWatchMethod) == null) { 63 HealthGrpc.getWatchMethod = getWatchMethod = 64 io.grpc.MethodDescriptor.<io.grpc.health.v1.HealthCheckRequest, io.grpc.health.v1.HealthCheckResponse>newBuilder() 65 .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) 66 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Watch")) 67 .setSampledToLocalTracing(true) 68 .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( 69 io.grpc.health.v1.HealthCheckRequest.getDefaultInstance())) 70 .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( 71 io.grpc.health.v1.HealthCheckResponse.getDefaultInstance())) 72 .setSchemaDescriptor(new HealthMethodDescriptorSupplier("Watch")) 73 .build(); 74 } 75 } 76 } 77 return getWatchMethod; 78 } 79 80 /** 81 * Creates a new async stub that supports all call types for the service 82 */ newStub(io.grpc.Channel channel)83 public static HealthStub newStub(io.grpc.Channel channel) { 84 io.grpc.stub.AbstractStub.StubFactory<HealthStub> factory = 85 new io.grpc.stub.AbstractStub.StubFactory<HealthStub>() { 86 @java.lang.Override 87 public HealthStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 88 return new HealthStub(channel, callOptions); 89 } 90 }; 91 return HealthStub.newStub(factory, channel); 92 } 93 94 /** 95 * Creates a new blocking-style stub that supports unary and streaming output calls on the service 96 */ newBlockingStub( io.grpc.Channel channel)97 public static HealthBlockingStub newBlockingStub( 98 io.grpc.Channel channel) { 99 io.grpc.stub.AbstractStub.StubFactory<HealthBlockingStub> factory = 100 new io.grpc.stub.AbstractStub.StubFactory<HealthBlockingStub>() { 101 @java.lang.Override 102 public HealthBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 103 return new HealthBlockingStub(channel, callOptions); 104 } 105 }; 106 return HealthBlockingStub.newStub(factory, channel); 107 } 108 109 /** 110 * Creates a new ListenableFuture-style stub that supports unary calls on the service 111 */ newFutureStub( io.grpc.Channel channel)112 public static HealthFutureStub newFutureStub( 113 io.grpc.Channel channel) { 114 io.grpc.stub.AbstractStub.StubFactory<HealthFutureStub> factory = 115 new io.grpc.stub.AbstractStub.StubFactory<HealthFutureStub>() { 116 @java.lang.Override 117 public HealthFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 118 return new HealthFutureStub(channel, callOptions); 119 } 120 }; 121 return HealthFutureStub.newStub(factory, channel); 122 } 123 124 /** 125 */ 126 public interface AsyncService { 127 128 /** 129 * <pre> 130 * If the requested service is unknown, the call will fail with status 131 * NOT_FOUND. 132 * </pre> 133 */ check(io.grpc.health.v1.HealthCheckRequest request, io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver)134 default void check(io.grpc.health.v1.HealthCheckRequest request, 135 io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) { 136 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCheckMethod(), responseObserver); 137 } 138 139 /** 140 * <pre> 141 * Performs a watch for the serving status of the requested service. 142 * The server will immediately send back a message indicating the current 143 * serving status. It will then subsequently send a new message whenever 144 * the service's serving status changes. 145 * If the requested service is unknown when the call is received, the 146 * server will send a message setting the serving status to 147 * SERVICE_UNKNOWN but will *not* terminate the call. If at some 148 * future point, the serving status of the service becomes known, the 149 * server will send a new message with the service's serving status. 150 * If the call terminates with status UNIMPLEMENTED, then clients 151 * should assume this method is not supported and should not retry the 152 * call. If the call terminates with any other status (including OK), 153 * clients should retry the call with appropriate exponential backoff. 154 * </pre> 155 */ watch(io.grpc.health.v1.HealthCheckRequest request, io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver)156 default void watch(io.grpc.health.v1.HealthCheckRequest request, 157 io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) { 158 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getWatchMethod(), responseObserver); 159 } 160 } 161 162 /** 163 * Base class for the server implementation of the service Health. 164 */ 165 public static abstract class HealthImplBase 166 implements io.grpc.BindableService, AsyncService { 167 bindService()168 @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { 169 return HealthGrpc.bindService(this); 170 } 171 } 172 173 /** 174 * A stub to allow clients to do asynchronous rpc calls to service Health. 175 */ 176 public static final class HealthStub 177 extends io.grpc.stub.AbstractAsyncStub<HealthStub> { HealthStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)178 private HealthStub( 179 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 180 super(channel, callOptions); 181 } 182 183 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)184 protected HealthStub build( 185 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 186 return new HealthStub(channel, callOptions); 187 } 188 189 /** 190 * <pre> 191 * If the requested service is unknown, the call will fail with status 192 * NOT_FOUND. 193 * </pre> 194 */ check(io.grpc.health.v1.HealthCheckRequest request, io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver)195 public void check(io.grpc.health.v1.HealthCheckRequest request, 196 io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) { 197 io.grpc.stub.ClientCalls.asyncUnaryCall( 198 getChannel().newCall(getCheckMethod(), getCallOptions()), request, responseObserver); 199 } 200 201 /** 202 * <pre> 203 * Performs a watch for the serving status of the requested service. 204 * The server will immediately send back a message indicating the current 205 * serving status. It will then subsequently send a new message whenever 206 * the service's serving status changes. 207 * If the requested service is unknown when the call is received, the 208 * server will send a message setting the serving status to 209 * SERVICE_UNKNOWN but will *not* terminate the call. If at some 210 * future point, the serving status of the service becomes known, the 211 * server will send a new message with the service's serving status. 212 * If the call terminates with status UNIMPLEMENTED, then clients 213 * should assume this method is not supported and should not retry the 214 * call. If the call terminates with any other status (including OK), 215 * clients should retry the call with appropriate exponential backoff. 216 * </pre> 217 */ watch(io.grpc.health.v1.HealthCheckRequest request, io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver)218 public void watch(io.grpc.health.v1.HealthCheckRequest request, 219 io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse> responseObserver) { 220 io.grpc.stub.ClientCalls.asyncServerStreamingCall( 221 getChannel().newCall(getWatchMethod(), getCallOptions()), request, responseObserver); 222 } 223 } 224 225 /** 226 * A stub to allow clients to do synchronous rpc calls to service Health. 227 */ 228 public static final class HealthBlockingStub 229 extends io.grpc.stub.AbstractBlockingStub<HealthBlockingStub> { HealthBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)230 private HealthBlockingStub( 231 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 232 super(channel, callOptions); 233 } 234 235 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)236 protected HealthBlockingStub build( 237 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 238 return new HealthBlockingStub(channel, callOptions); 239 } 240 241 /** 242 * <pre> 243 * If the requested service is unknown, the call will fail with status 244 * NOT_FOUND. 245 * </pre> 246 */ check(io.grpc.health.v1.HealthCheckRequest request)247 public io.grpc.health.v1.HealthCheckResponse check(io.grpc.health.v1.HealthCheckRequest request) { 248 return io.grpc.stub.ClientCalls.blockingUnaryCall( 249 getChannel(), getCheckMethod(), getCallOptions(), request); 250 } 251 252 /** 253 * <pre> 254 * Performs a watch for the serving status of the requested service. 255 * The server will immediately send back a message indicating the current 256 * serving status. It will then subsequently send a new message whenever 257 * the service's serving status changes. 258 * If the requested service is unknown when the call is received, the 259 * server will send a message setting the serving status to 260 * SERVICE_UNKNOWN but will *not* terminate the call. If at some 261 * future point, the serving status of the service becomes known, the 262 * server will send a new message with the service's serving status. 263 * If the call terminates with status UNIMPLEMENTED, then clients 264 * should assume this method is not supported and should not retry the 265 * call. If the call terminates with any other status (including OK), 266 * clients should retry the call with appropriate exponential backoff. 267 * </pre> 268 */ watch( io.grpc.health.v1.HealthCheckRequest request)269 public java.util.Iterator<io.grpc.health.v1.HealthCheckResponse> watch( 270 io.grpc.health.v1.HealthCheckRequest request) { 271 return io.grpc.stub.ClientCalls.blockingServerStreamingCall( 272 getChannel(), getWatchMethod(), getCallOptions(), request); 273 } 274 } 275 276 /** 277 * A stub to allow clients to do ListenableFuture-style rpc calls to service Health. 278 */ 279 public static final class HealthFutureStub 280 extends io.grpc.stub.AbstractFutureStub<HealthFutureStub> { HealthFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)281 private HealthFutureStub( 282 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 283 super(channel, callOptions); 284 } 285 286 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)287 protected HealthFutureStub build( 288 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 289 return new HealthFutureStub(channel, callOptions); 290 } 291 292 /** 293 * <pre> 294 * If the requested service is unknown, the call will fail with status 295 * NOT_FOUND. 296 * </pre> 297 */ check( io.grpc.health.v1.HealthCheckRequest request)298 public com.google.common.util.concurrent.ListenableFuture<io.grpc.health.v1.HealthCheckResponse> check( 299 io.grpc.health.v1.HealthCheckRequest request) { 300 return io.grpc.stub.ClientCalls.futureUnaryCall( 301 getChannel().newCall(getCheckMethod(), getCallOptions()), request); 302 } 303 } 304 305 private static final int METHODID_CHECK = 0; 306 private static final int METHODID_WATCH = 1; 307 308 private static final class MethodHandlers<Req, Resp> implements 309 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, 310 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, 311 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, 312 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { 313 private final AsyncService serviceImpl; 314 private final int methodId; 315 MethodHandlers(AsyncService serviceImpl, int methodId)316 MethodHandlers(AsyncService serviceImpl, int methodId) { 317 this.serviceImpl = serviceImpl; 318 this.methodId = methodId; 319 } 320 321 @java.lang.Override 322 @java.lang.SuppressWarnings("unchecked") invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)323 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { 324 switch (methodId) { 325 case METHODID_CHECK: 326 serviceImpl.check((io.grpc.health.v1.HealthCheckRequest) request, 327 (io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse>) responseObserver); 328 break; 329 case METHODID_WATCH: 330 serviceImpl.watch((io.grpc.health.v1.HealthCheckRequest) request, 331 (io.grpc.stub.StreamObserver<io.grpc.health.v1.HealthCheckResponse>) responseObserver); 332 break; 333 default: 334 throw new AssertionError(); 335 } 336 } 337 338 @java.lang.Override 339 @java.lang.SuppressWarnings("unchecked") invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)340 public io.grpc.stub.StreamObserver<Req> invoke( 341 io.grpc.stub.StreamObserver<Resp> responseObserver) { 342 switch (methodId) { 343 default: 344 throw new AssertionError(); 345 } 346 } 347 } 348 bindService(AsyncService service)349 public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { 350 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) 351 .addMethod( 352 getCheckMethod(), 353 io.grpc.stub.ServerCalls.asyncUnaryCall( 354 new MethodHandlers< 355 io.grpc.health.v1.HealthCheckRequest, 356 io.grpc.health.v1.HealthCheckResponse>( 357 service, METHODID_CHECK))) 358 .addMethod( 359 getWatchMethod(), 360 io.grpc.stub.ServerCalls.asyncServerStreamingCall( 361 new MethodHandlers< 362 io.grpc.health.v1.HealthCheckRequest, 363 io.grpc.health.v1.HealthCheckResponse>( 364 service, METHODID_WATCH))) 365 .build(); 366 } 367 368 private static abstract class HealthBaseDescriptorSupplier 369 implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { HealthBaseDescriptorSupplier()370 HealthBaseDescriptorSupplier() {} 371 372 @java.lang.Override getFileDescriptor()373 public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { 374 return io.grpc.health.v1.HealthProto.getDescriptor(); 375 } 376 377 @java.lang.Override getServiceDescriptor()378 public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { 379 return getFileDescriptor().findServiceByName("Health"); 380 } 381 } 382 383 private static final class HealthFileDescriptorSupplier 384 extends HealthBaseDescriptorSupplier { HealthFileDescriptorSupplier()385 HealthFileDescriptorSupplier() {} 386 } 387 388 private static final class HealthMethodDescriptorSupplier 389 extends HealthBaseDescriptorSupplier 390 implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { 391 private final String methodName; 392 HealthMethodDescriptorSupplier(String methodName)393 HealthMethodDescriptorSupplier(String methodName) { 394 this.methodName = methodName; 395 } 396 397 @java.lang.Override getMethodDescriptor()398 public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { 399 return getServiceDescriptor().findMethodByName(methodName); 400 } 401 } 402 403 private static volatile io.grpc.ServiceDescriptor serviceDescriptor; 404 getServiceDescriptor()405 public static io.grpc.ServiceDescriptor getServiceDescriptor() { 406 io.grpc.ServiceDescriptor result = serviceDescriptor; 407 if (result == null) { 408 synchronized (HealthGrpc.class) { 409 result = serviceDescriptor; 410 if (result == null) { 411 serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) 412 .setSchemaDescriptor(new HealthFileDescriptorSupplier()) 413 .addMethod(getCheckMethod()) 414 .addMethod(getWatchMethod()) 415 .build(); 416 } 417 } 418 } 419 return result; 420 } 421 } 422