• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package io.grpc.benchmarks.proto;
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/testing/services.proto")
10 @io.grpc.stub.annotations.GrpcGenerated
11 public final class BenchmarkServiceGrpc {
12 
BenchmarkServiceGrpc()13   private BenchmarkServiceGrpc() {}
14 
15   public static final String SERVICE_NAME = "grpc.testing.BenchmarkService";
16 
17   // Static method descriptors that strictly reflect the proto.
18   private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
19       io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod;
20 
21   @io.grpc.stub.annotations.RpcMethod(
22       fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
23       requestType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class,
24       responseType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class,
25       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
26   public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
getUnaryCallMethod()27       io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod() {
28     io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod;
29     if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) {
30       synchronized (BenchmarkServiceGrpc.class) {
31         if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) {
32           BenchmarkServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
33               io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
34               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
35               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
36               .setSampledToLocalTracing(true)
37               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
38                   io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
39               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
40                   io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
41               .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("UnaryCall"))
42               .build();
43         }
44       }
45     }
46     return getUnaryCallMethod;
47   }
48 
49   private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
50       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod;
51 
52   @io.grpc.stub.annotations.RpcMethod(
53       fullMethodName = SERVICE_NAME + '/' + "StreamingCall",
54       requestType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class,
55       responseType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class,
56       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
57   public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
getStreamingCallMethod()58       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod() {
59     io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod;
60     if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) {
61       synchronized (BenchmarkServiceGrpc.class) {
62         if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) {
63           BenchmarkServiceGrpc.getStreamingCallMethod = getStreamingCallMethod =
64               io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
65               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
66               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingCall"))
67               .setSampledToLocalTracing(true)
68               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
69                   io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
70               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
71                   io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
72               .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingCall"))
73               .build();
74         }
75       }
76     }
77     return getStreamingCallMethod;
78   }
79 
80   private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
81       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod;
82 
83   @io.grpc.stub.annotations.RpcMethod(
84       fullMethodName = SERVICE_NAME + '/' + "StreamingFromClient",
85       requestType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class,
86       responseType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class,
87       methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
88   public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
getStreamingFromClientMethod()89       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod() {
90     io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod;
91     if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) {
92       synchronized (BenchmarkServiceGrpc.class) {
93         if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) {
94           BenchmarkServiceGrpc.getStreamingFromClientMethod = getStreamingFromClientMethod =
95               io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
96               .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
97               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingFromClient"))
98               .setSampledToLocalTracing(true)
99               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
100                   io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
101               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
102                   io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
103               .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromClient"))
104               .build();
105         }
106       }
107     }
108     return getStreamingFromClientMethod;
109   }
110 
111   private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
112       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod;
113 
114   @io.grpc.stub.annotations.RpcMethod(
115       fullMethodName = SERVICE_NAME + '/' + "StreamingFromServer",
116       requestType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class,
117       responseType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class,
118       methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
119   public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
getStreamingFromServerMethod()120       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod() {
121     io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod;
122     if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) {
123       synchronized (BenchmarkServiceGrpc.class) {
124         if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) {
125           BenchmarkServiceGrpc.getStreamingFromServerMethod = getStreamingFromServerMethod =
126               io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
127               .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
128               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingFromServer"))
129               .setSampledToLocalTracing(true)
130               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
131                   io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
132               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
133                   io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
134               .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromServer"))
135               .build();
136         }
137       }
138     }
139     return getStreamingFromServerMethod;
140   }
141 
142   private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
143       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod;
144 
145   @io.grpc.stub.annotations.RpcMethod(
146       fullMethodName = SERVICE_NAME + '/' + "StreamingBothWays",
147       requestType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class,
148       responseType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class,
149       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
150   public static io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
getStreamingBothWaysMethod()151       io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod() {
152     io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod;
153     if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) {
154       synchronized (BenchmarkServiceGrpc.class) {
155         if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) {
156           BenchmarkServiceGrpc.getStreamingBothWaysMethod = getStreamingBothWaysMethod =
157               io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
158               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
159               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingBothWays"))
160               .setSampledToLocalTracing(true)
161               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
162                   io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
163               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
164                   io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
165               .setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingBothWays"))
166               .build();
167         }
168       }
169     }
170     return getStreamingBothWaysMethod;
171   }
172 
173   /**
174    * Creates a new async stub that supports all call types for the service
175    */
newStub(io.grpc.Channel channel)176   public static BenchmarkServiceStub newStub(io.grpc.Channel channel) {
177     io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceStub> factory =
178       new io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceStub>() {
179         @java.lang.Override
180         public BenchmarkServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
181           return new BenchmarkServiceStub(channel, callOptions);
182         }
183       };
184     return BenchmarkServiceStub.newStub(factory, channel);
185   }
186 
187   /**
188    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
189    */
newBlockingStub( io.grpc.Channel channel)190   public static BenchmarkServiceBlockingStub newBlockingStub(
191       io.grpc.Channel channel) {
192     io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceBlockingStub> factory =
193       new io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceBlockingStub>() {
194         @java.lang.Override
195         public BenchmarkServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
196           return new BenchmarkServiceBlockingStub(channel, callOptions);
197         }
198       };
199     return BenchmarkServiceBlockingStub.newStub(factory, channel);
200   }
201 
202   /**
203    * Creates a new ListenableFuture-style stub that supports unary calls on the service
204    */
newFutureStub( io.grpc.Channel channel)205   public static BenchmarkServiceFutureStub newFutureStub(
206       io.grpc.Channel channel) {
207     io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceFutureStub> factory =
208       new io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceFutureStub>() {
209         @java.lang.Override
210         public BenchmarkServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
211           return new BenchmarkServiceFutureStub(channel, callOptions);
212         }
213       };
214     return BenchmarkServiceFutureStub.newStub(factory, channel);
215   }
216 
217   /**
218    */
219   public interface AsyncService {
220 
221     /**
222      * <pre>
223      * One request followed by one response.
224      * The server returns the client payload as-is.
225      * </pre>
226      */
unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)227     default void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
228         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
229       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
230     }
231 
232     /**
233      * <pre>
234      * Repeated sequence of one request followed by one response.
235      * Should be called streaming ping-pong
236      * The server returns the client payload as-is on each response
237      * </pre>
238      */
streamingCall( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)239     default io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall(
240         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
241       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamingCallMethod(), responseObserver);
242     }
243 
244     /**
245      * <pre>
246      * Single-sided unbounded streaming from client to server
247      * The server returns the client payload as-is once the client does WritesDone
248      * </pre>
249      */
streamingFromClient( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)250     default io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingFromClient(
251         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
252       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamingFromClientMethod(), responseObserver);
253     }
254 
255     /**
256      * <pre>
257      * Single-sided unbounded streaming from server to client
258      * The server repeatedly returns the client payload as-is
259      * </pre>
260      */
streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)261     default void streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
262         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
263       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStreamingFromServerMethod(), responseObserver);
264     }
265 
266     /**
267      * <pre>
268      * Two-sided unbounded streaming between server to client
269      * Both sides send the content of their own choice to the other
270      * </pre>
271      */
streamingBothWays( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)272     default io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingBothWays(
273         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
274       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamingBothWaysMethod(), responseObserver);
275     }
276   }
277 
278   /**
279    * Base class for the server implementation of the service BenchmarkService.
280    */
281   public static abstract class BenchmarkServiceImplBase
282       implements io.grpc.BindableService, AsyncService {
283 
bindService()284     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
285       return BenchmarkServiceGrpc.bindService(this);
286     }
287   }
288 
289   /**
290    * A stub to allow clients to do asynchronous rpc calls to service BenchmarkService.
291    */
292   public static final class BenchmarkServiceStub
293       extends io.grpc.stub.AbstractAsyncStub<BenchmarkServiceStub> {
BenchmarkServiceStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)294     private BenchmarkServiceStub(
295         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
296       super(channel, callOptions);
297     }
298 
299     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)300     protected BenchmarkServiceStub build(
301         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
302       return new BenchmarkServiceStub(channel, callOptions);
303     }
304 
305     /**
306      * <pre>
307      * One request followed by one response.
308      * The server returns the client payload as-is.
309      * </pre>
310      */
unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)311     public void unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
312         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
313       io.grpc.stub.ClientCalls.asyncUnaryCall(
314           getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
315     }
316 
317     /**
318      * <pre>
319      * Repeated sequence of one request followed by one response.
320      * Should be called streaming ping-pong
321      * The server returns the client payload as-is on each response
322      * </pre>
323      */
streamingCall( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)324     public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingCall(
325         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
326       return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
327           getChannel().newCall(getStreamingCallMethod(), getCallOptions()), responseObserver);
328     }
329 
330     /**
331      * <pre>
332      * Single-sided unbounded streaming from client to server
333      * The server returns the client payload as-is once the client does WritesDone
334      * </pre>
335      */
streamingFromClient( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)336     public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingFromClient(
337         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
338       return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
339           getChannel().newCall(getStreamingFromClientMethod(), getCallOptions()), responseObserver);
340     }
341 
342     /**
343      * <pre>
344      * Single-sided unbounded streaming from server to client
345      * The server repeatedly returns the client payload as-is
346      * </pre>
347      */
streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)348     public void streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request,
349         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
350       io.grpc.stub.ClientCalls.asyncServerStreamingCall(
351           getChannel().newCall(getStreamingFromServerMethod(), getCallOptions()), request, responseObserver);
352     }
353 
354     /**
355      * <pre>
356      * Two-sided unbounded streaming between server to client
357      * Both sides send the content of their own choice to the other
358      * </pre>
359      */
streamingBothWays( io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver)360     public io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleRequest> streamingBothWays(
361         io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse> responseObserver) {
362       return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
363           getChannel().newCall(getStreamingBothWaysMethod(), getCallOptions()), responseObserver);
364     }
365   }
366 
367   /**
368    * A stub to allow clients to do synchronous rpc calls to service BenchmarkService.
369    */
370   public static final class BenchmarkServiceBlockingStub
371       extends io.grpc.stub.AbstractBlockingStub<BenchmarkServiceBlockingStub> {
BenchmarkServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)372     private BenchmarkServiceBlockingStub(
373         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
374       super(channel, callOptions);
375     }
376 
377     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)378     protected BenchmarkServiceBlockingStub build(
379         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
380       return new BenchmarkServiceBlockingStub(channel, callOptions);
381     }
382 
383     /**
384      * <pre>
385      * One request followed by one response.
386      * The server returns the client payload as-is.
387      * </pre>
388      */
unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request)389     public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
390       return io.grpc.stub.ClientCalls.blockingUnaryCall(
391           getChannel(), getUnaryCallMethod(), getCallOptions(), request);
392     }
393 
394     /**
395      * <pre>
396      * Single-sided unbounded streaming from server to client
397      * The server repeatedly returns the client payload as-is
398      * </pre>
399      */
streamingFromServer( io.grpc.benchmarks.proto.Messages.SimpleRequest request)400     public java.util.Iterator<io.grpc.benchmarks.proto.Messages.SimpleResponse> streamingFromServer(
401         io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
402       return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
403           getChannel(), getStreamingFromServerMethod(), getCallOptions(), request);
404     }
405   }
406 
407   /**
408    * A stub to allow clients to do ListenableFuture-style rpc calls to service BenchmarkService.
409    */
410   public static final class BenchmarkServiceFutureStub
411       extends io.grpc.stub.AbstractFutureStub<BenchmarkServiceFutureStub> {
BenchmarkServiceFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)412     private BenchmarkServiceFutureStub(
413         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
414       super(channel, callOptions);
415     }
416 
417     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)418     protected BenchmarkServiceFutureStub build(
419         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
420       return new BenchmarkServiceFutureStub(channel, callOptions);
421     }
422 
423     /**
424      * <pre>
425      * One request followed by one response.
426      * The server returns the client payload as-is.
427      * </pre>
428      */
unaryCall( io.grpc.benchmarks.proto.Messages.SimpleRequest request)429     public com.google.common.util.concurrent.ListenableFuture<io.grpc.benchmarks.proto.Messages.SimpleResponse> unaryCall(
430         io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
431       return io.grpc.stub.ClientCalls.futureUnaryCall(
432           getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
433     }
434   }
435 
436   private static final int METHODID_UNARY_CALL = 0;
437   private static final int METHODID_STREAMING_FROM_SERVER = 1;
438   private static final int METHODID_STREAMING_CALL = 2;
439   private static final int METHODID_STREAMING_FROM_CLIENT = 3;
440   private static final int METHODID_STREAMING_BOTH_WAYS = 4;
441 
442   private static final class MethodHandlers<Req, Resp> implements
443       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
444       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
445       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
446       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
447     private final AsyncService serviceImpl;
448     private final int methodId;
449 
MethodHandlers(AsyncService serviceImpl, int methodId)450     MethodHandlers(AsyncService serviceImpl, int methodId) {
451       this.serviceImpl = serviceImpl;
452       this.methodId = methodId;
453     }
454 
455     @java.lang.Override
456     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)457     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
458       switch (methodId) {
459         case METHODID_UNARY_CALL:
460           serviceImpl.unaryCall((io.grpc.benchmarks.proto.Messages.SimpleRequest) request,
461               (io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse>) responseObserver);
462           break;
463         case METHODID_STREAMING_FROM_SERVER:
464           serviceImpl.streamingFromServer((io.grpc.benchmarks.proto.Messages.SimpleRequest) request,
465               (io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse>) responseObserver);
466           break;
467         default:
468           throw new AssertionError();
469       }
470     }
471 
472     @java.lang.Override
473     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)474     public io.grpc.stub.StreamObserver<Req> invoke(
475         io.grpc.stub.StreamObserver<Resp> responseObserver) {
476       switch (methodId) {
477         case METHODID_STREAMING_CALL:
478           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingCall(
479               (io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse>) responseObserver);
480         case METHODID_STREAMING_FROM_CLIENT:
481           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingFromClient(
482               (io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse>) responseObserver);
483         case METHODID_STREAMING_BOTH_WAYS:
484           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingBothWays(
485               (io.grpc.stub.StreamObserver<io.grpc.benchmarks.proto.Messages.SimpleResponse>) responseObserver);
486         default:
487           throw new AssertionError();
488       }
489     }
490   }
491 
bindService(AsyncService service)492   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
493     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
494         .addMethod(
495           getUnaryCallMethod(),
496           io.grpc.stub.ServerCalls.asyncUnaryCall(
497             new MethodHandlers<
498               io.grpc.benchmarks.proto.Messages.SimpleRequest,
499               io.grpc.benchmarks.proto.Messages.SimpleResponse>(
500                 service, METHODID_UNARY_CALL)))
501         .addMethod(
502           getStreamingCallMethod(),
503           io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
504             new MethodHandlers<
505               io.grpc.benchmarks.proto.Messages.SimpleRequest,
506               io.grpc.benchmarks.proto.Messages.SimpleResponse>(
507                 service, METHODID_STREAMING_CALL)))
508         .addMethod(
509           getStreamingFromClientMethod(),
510           io.grpc.stub.ServerCalls.asyncClientStreamingCall(
511             new MethodHandlers<
512               io.grpc.benchmarks.proto.Messages.SimpleRequest,
513               io.grpc.benchmarks.proto.Messages.SimpleResponse>(
514                 service, METHODID_STREAMING_FROM_CLIENT)))
515         .addMethod(
516           getStreamingFromServerMethod(),
517           io.grpc.stub.ServerCalls.asyncServerStreamingCall(
518             new MethodHandlers<
519               io.grpc.benchmarks.proto.Messages.SimpleRequest,
520               io.grpc.benchmarks.proto.Messages.SimpleResponse>(
521                 service, METHODID_STREAMING_FROM_SERVER)))
522         .addMethod(
523           getStreamingBothWaysMethod(),
524           io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
525             new MethodHandlers<
526               io.grpc.benchmarks.proto.Messages.SimpleRequest,
527               io.grpc.benchmarks.proto.Messages.SimpleResponse>(
528                 service, METHODID_STREAMING_BOTH_WAYS)))
529         .build();
530   }
531 
532   private static abstract class BenchmarkServiceBaseDescriptorSupplier
533       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
BenchmarkServiceBaseDescriptorSupplier()534     BenchmarkServiceBaseDescriptorSupplier() {}
535 
536     @java.lang.Override
getFileDescriptor()537     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
538       return io.grpc.benchmarks.proto.Services.getDescriptor();
539     }
540 
541     @java.lang.Override
getServiceDescriptor()542     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
543       return getFileDescriptor().findServiceByName("BenchmarkService");
544     }
545   }
546 
547   private static final class BenchmarkServiceFileDescriptorSupplier
548       extends BenchmarkServiceBaseDescriptorSupplier {
BenchmarkServiceFileDescriptorSupplier()549     BenchmarkServiceFileDescriptorSupplier() {}
550   }
551 
552   private static final class BenchmarkServiceMethodDescriptorSupplier
553       extends BenchmarkServiceBaseDescriptorSupplier
554       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
555     private final String methodName;
556 
BenchmarkServiceMethodDescriptorSupplier(String methodName)557     BenchmarkServiceMethodDescriptorSupplier(String methodName) {
558       this.methodName = methodName;
559     }
560 
561     @java.lang.Override
getMethodDescriptor()562     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
563       return getServiceDescriptor().findMethodByName(methodName);
564     }
565   }
566 
567   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
568 
getServiceDescriptor()569   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
570     io.grpc.ServiceDescriptor result = serviceDescriptor;
571     if (result == null) {
572       synchronized (BenchmarkServiceGrpc.class) {
573         result = serviceDescriptor;
574         if (result == null) {
575           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
576               .setSchemaDescriptor(new BenchmarkServiceFileDescriptorSupplier())
577               .addMethod(getUnaryCallMethod())
578               .addMethod(getStreamingCallMethod())
579               .addMethod(getStreamingFromClientMethod())
580               .addMethod(getStreamingFromServerMethod())
581               .addMethod(getStreamingBothWaysMethod())
582               .build();
583         }
584       }
585     }
586     return result;
587   }
588 }
589