@@ -304,7 +304,7 @@ public OperationsFutureStub newStub(
304
304
* so developers can have a consistent client experience.
305
305
* </pre>
306
306
*/
307
- public abstract static class OperationsImplBase implements io . grpc . BindableService {
307
+ public interface AsyncService {
308
308
309
309
/**
310
310
*
@@ -321,7 +321,7 @@ public abstract static class OperationsImplBase implements io.grpc.BindableServi
321
321
* is the parent resource, without the operations collection id.
322
322
* </pre>
323
323
*/
324
- public void listOperations (
324
+ default void listOperations (
325
325
com .google .longrunning .ListOperationsRequest request ,
326
326
io .grpc .stub .StreamObserver <com .google .longrunning .ListOperationsResponse >
327
327
responseObserver ) {
@@ -338,7 +338,7 @@ public void listOperations(
338
338
* service.
339
339
* </pre>
340
340
*/
341
- public void getOperation (
341
+ default void getOperation (
342
342
com .google .longrunning .GetOperationRequest request ,
343
343
io .grpc .stub .StreamObserver <com .google .longrunning .Operation > responseObserver ) {
344
344
io .grpc .stub .ServerCalls .asyncUnimplementedUnaryCall (
@@ -355,7 +355,7 @@ public void getOperation(
355
355
* `google.rpc.Code.UNIMPLEMENTED`.
356
356
* </pre>
357
357
*/
358
- public void deleteOperation (
358
+ default void deleteOperation (
359
359
com .google .longrunning .DeleteOperationRequest request ,
360
360
io .grpc .stub .StreamObserver <com .google .protobuf .Empty > responseObserver ) {
361
361
io .grpc .stub .ServerCalls .asyncUnimplementedUnaryCall (
@@ -378,7 +378,7 @@ public void deleteOperation(
378
378
* corresponding to `Code.CANCELLED`.
379
379
* </pre>
380
380
*/
381
- public void cancelOperation (
381
+ default void cancelOperation (
382
382
com .google .longrunning .CancelOperationRequest request ,
383
383
io .grpc .stub .StreamObserver <com .google .protobuf .Empty > responseObserver ) {
384
384
io .grpc .stub .ServerCalls .asyncUnimplementedUnaryCall (
@@ -400,53 +400,38 @@ public void cancelOperation(
400
400
* immediate response is no guarantee that the operation is done.
401
401
* </pre>
402
402
*/
403
- public void waitOperation (
403
+ default void waitOperation (
404
404
com .google .longrunning .WaitOperationRequest request ,
405
405
io .grpc .stub .StreamObserver <com .google .longrunning .Operation > responseObserver ) {
406
406
io .grpc .stub .ServerCalls .asyncUnimplementedUnaryCall (
407
407
getWaitOperationMethod (), responseObserver );
408
408
}
409
+ }
410
+
411
+ /**
412
+ * Base class for the server implementation of the service Operations.
413
+ *
414
+ * <pre>
415
+ * Manages long-running operations with an API service.
416
+ * When an API method normally takes long time to complete, it can be designed
417
+ * to return [Operation][google.longrunning.Operation] to the client, and the client can use this
418
+ * interface to receive the real response asynchronously by polling the
419
+ * operation resource, or pass the operation resource to another API (such as
420
+ * Google Cloud Pub/Sub API) to receive the response. Any API service that
421
+ * returns long-running operations should implement the `Operations` interface
422
+ * so developers can have a consistent client experience.
423
+ * </pre>
424
+ */
425
+ public abstract static class OperationsImplBase implements io .grpc .BindableService , AsyncService {
409
426
410
427
@ java .lang .Override
411
428
public final io .grpc .ServerServiceDefinition bindService () {
412
- return io .grpc .ServerServiceDefinition .builder (getServiceDescriptor ())
413
- .addMethod (
414
- getListOperationsMethod (),
415
- io .grpc .stub .ServerCalls .asyncUnaryCall (
416
- new MethodHandlers <
417
- com .google .longrunning .ListOperationsRequest ,
418
- com .google .longrunning .ListOperationsResponse >(
419
- this , METHODID_LIST_OPERATIONS )))
420
- .addMethod (
421
- getGetOperationMethod (),
422
- io .grpc .stub .ServerCalls .asyncUnaryCall (
423
- new MethodHandlers <
424
- com .google .longrunning .GetOperationRequest , com .google .longrunning .Operation >(
425
- this , METHODID_GET_OPERATION )))
426
- .addMethod (
427
- getDeleteOperationMethod (),
428
- io .grpc .stub .ServerCalls .asyncUnaryCall (
429
- new MethodHandlers <
430
- com .google .longrunning .DeleteOperationRequest , com .google .protobuf .Empty >(
431
- this , METHODID_DELETE_OPERATION )))
432
- .addMethod (
433
- getCancelOperationMethod (),
434
- io .grpc .stub .ServerCalls .asyncUnaryCall (
435
- new MethodHandlers <
436
- com .google .longrunning .CancelOperationRequest , com .google .protobuf .Empty >(
437
- this , METHODID_CANCEL_OPERATION )))
438
- .addMethod (
439
- getWaitOperationMethod (),
440
- io .grpc .stub .ServerCalls .asyncUnaryCall (
441
- new MethodHandlers <
442
- com .google .longrunning .WaitOperationRequest ,
443
- com .google .longrunning .Operation >(this , METHODID_WAIT_OPERATION )))
444
- .build ();
429
+ return OperationsGrpc .bindService (this );
445
430
}
446
431
}
447
432
448
433
/**
449
- *
434
+ * A stub to allow clients to do asynchronous rpc calls to service Operations.
450
435
*
451
436
* <pre>
452
437
* Manages long-running operations with an API service.
@@ -582,7 +567,7 @@ public void waitOperation(
582
567
}
583
568
584
569
/**
585
- *
570
+ * A stub to allow clients to do synchronous rpc calls to service Operations.
586
571
*
587
572
* <pre>
588
573
* Manages long-running operations with an API service.
@@ -704,7 +689,7 @@ public com.google.longrunning.Operation waitOperation(
704
689
}
705
690
706
691
/**
707
- *
692
+ * A stub to allow clients to do ListenableFuture-style rpc calls to service Operations.
708
693
*
709
694
* <pre>
710
695
* Manages long-running operations with an API service.
@@ -836,10 +821,10 @@ private static final class MethodHandlers<Req, Resp>
836
821
io .grpc .stub .ServerCalls .ServerStreamingMethod <Req , Resp >,
837
822
io .grpc .stub .ServerCalls .ClientStreamingMethod <Req , Resp >,
838
823
io .grpc .stub .ServerCalls .BidiStreamingMethod <Req , Resp > {
839
- private final OperationsImplBase serviceImpl ;
824
+ private final AsyncService serviceImpl ;
840
825
private final int methodId ;
841
826
842
- MethodHandlers (OperationsImplBase serviceImpl , int methodId ) {
827
+ MethodHandlers (AsyncService serviceImpl , int methodId ) {
843
828
this .serviceImpl = serviceImpl ;
844
829
this .methodId = methodId ;
845
830
}
@@ -890,6 +875,42 @@ public io.grpc.stub.StreamObserver<Req> invoke(
890
875
}
891
876
}
892
877
878
+ public static final io .grpc .ServerServiceDefinition bindService (AsyncService service ) {
879
+ return io .grpc .ServerServiceDefinition .builder (getServiceDescriptor ())
880
+ .addMethod (
881
+ getListOperationsMethod (),
882
+ io .grpc .stub .ServerCalls .asyncUnaryCall (
883
+ new MethodHandlers <
884
+ com .google .longrunning .ListOperationsRequest ,
885
+ com .google .longrunning .ListOperationsResponse >(
886
+ service , METHODID_LIST_OPERATIONS )))
887
+ .addMethod (
888
+ getGetOperationMethod (),
889
+ io .grpc .stub .ServerCalls .asyncUnaryCall (
890
+ new MethodHandlers <
891
+ com .google .longrunning .GetOperationRequest , com .google .longrunning .Operation >(
892
+ service , METHODID_GET_OPERATION )))
893
+ .addMethod (
894
+ getDeleteOperationMethod (),
895
+ io .grpc .stub .ServerCalls .asyncUnaryCall (
896
+ new MethodHandlers <
897
+ com .google .longrunning .DeleteOperationRequest , com .google .protobuf .Empty >(
898
+ service , METHODID_DELETE_OPERATION )))
899
+ .addMethod (
900
+ getCancelOperationMethod (),
901
+ io .grpc .stub .ServerCalls .asyncUnaryCall (
902
+ new MethodHandlers <
903
+ com .google .longrunning .CancelOperationRequest , com .google .protobuf .Empty >(
904
+ service , METHODID_CANCEL_OPERATION )))
905
+ .addMethod (
906
+ getWaitOperationMethod (),
907
+ io .grpc .stub .ServerCalls .asyncUnaryCall (
908
+ new MethodHandlers <
909
+ com .google .longrunning .WaitOperationRequest , com .google .longrunning .Operation >(
910
+ service , METHODID_WAIT_OPERATION )))
911
+ .build ();
912
+ }
913
+
893
914
private abstract static class OperationsBaseDescriptorSupplier
894
915
implements io .grpc .protobuf .ProtoFileDescriptorSupplier ,
895
916
io .grpc .protobuf .ProtoServiceDescriptorSupplier {
0 commit comments