mirror of https://github.com/grpc/grpc-java.git
Bidi Blocking Stub (#10318)
This commit is contained in:
parent
7b29111cd0
commit
ea8c31c305
|
|
@ -60,6 +60,21 @@ public final class HandshakerServiceGrpc {
|
|||
return HandshakerServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static HandshakerServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public HandshakerServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new HandshakerServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return HandshakerServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -157,6 +172,40 @@ public final class HandshakerServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service HandshakerService.
|
||||
*/
|
||||
public static final class HandshakerServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingV2Stub> {
|
||||
private HandshakerServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected HandshakerServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new HandshakerServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Handshaker service accepts a stream of handshaker request, returning a
|
||||
* stream of handshaker response. Client is expected to send exactly one
|
||||
* message with either client_start or server_start followed by one or more
|
||||
* messages with next. Each time client sends a request, the handshaker
|
||||
* service expects to respond. Client does not have to wait for service's
|
||||
* response before sending next request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp>
|
||||
doHandshake() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getDoHandshakeMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service HandshakerService.
|
||||
*/
|
||||
public static final class HandshakerServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingStub> {
|
||||
private HandshakerServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
return LoadBalancerStatsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static LoadBalancerStatsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public LoadBalancerStatsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return LoadBalancerStatsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -212,6 +227,46 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingV2Stub> {
|
||||
private LoadBalancerStatsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected LoadBalancerStatsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the backend distribution for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the accumulated stats for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientAccumulatedStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service LoadBalancerStatsService.
|
||||
* <pre>
|
||||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
|
||||
private LoadBalancerStatsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -89,6 +89,21 @@ public final class MetricsServiceGrpc {
|
|||
return MetricsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static MetricsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public MetricsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MetricsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -199,6 +214,46 @@ public final class MetricsServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingV2Stub> {
|
||||
private MetricsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MetricsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the values of all the gauges that are currently being maintained by
|
||||
* the service
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Metrics.GaugeResponse>
|
||||
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the value of one gauge
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
|
||||
private MetricsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class ReconnectServiceGrpc {
|
|||
return ReconnectServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ReconnectServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ReconnectServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ReconnectServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -200,6 +215,40 @@ public final class ReconnectServiceGrpc {
|
|||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingV2Stub> {
|
||||
private ReconnectServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ReconnectServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStartMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ReconnectService.
|
||||
* <pre>
|
||||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingStub> {
|
||||
private ReconnectServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -273,6 +273,21 @@ public final class TestServiceGrpc {
|
|||
return TestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -543,6 +558,125 @@ public final class TestServiceGrpc {
|
|||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingV2Stub> {
|
||||
private TestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One empty request followed by one empty response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEmptyCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response. Response has cache control
|
||||
* headers set such that a caching HTTP proxy (such as GFE) can
|
||||
* satisfy subsequent requests.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getCacheableUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
* The server returns the payload with client desired type and sizes.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse>
|
||||
streamingInputCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingInputCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
* As one request could lead to multiple responses, this interface
|
||||
* demonstrates the idea of full duplexing.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
fullDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getFullDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by a sequence of responses.
|
||||
* The server buffers all the client requests and then serves them in order. A
|
||||
* stream of responses are returned to the client when the server starts with
|
||||
* first request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
halfDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getHalfDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The test server will not implement this method. It will be used
|
||||
* to test the behavior when clients call unimplemented methods.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestService.
|
||||
* <pre>
|
||||
* A simple service to test the various types of RPCs and experiment with
|
||||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
|
||||
private TestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class UnimplementedServiceGrpc {
|
|||
return UnimplementedServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static UnimplementedServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public UnimplementedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return UnimplementedServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -166,6 +181,37 @@ public final class UnimplementedServiceGrpc {
|
|||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingV2Stub> {
|
||||
private UnimplementedServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected UnimplementedServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A call that no server should implement
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service UnimplementedService.
|
||||
* <pre>
|
||||
* A simple service NOT implemented at servers so clients can test for
|
||||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingStub> {
|
||||
private UnimplementedServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -62,6 +62,21 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
return XdsUpdateClientConfigureServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateClientConfigureServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateClientConfigureServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateClientConfigureServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -161,6 +176,36 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingV2Stub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateClientConfigureServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Update the tes client's configuration.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ClientConfigureResponse configure(io.grpc.testing.integration.Messages.ClientConfigureRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getConfigureMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateClientConfigureService.
|
||||
* <pre>
|
||||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingStub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
return XdsUpdateHealthServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateHealthServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateHealthServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateHealthServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -200,6 +215,40 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingV2Stub> {
|
||||
private XdsUpdateHealthServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateHealthServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setNotServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetNotServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateHealthService.
|
||||
* <pre>
|
||||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingStub> {
|
||||
private XdsUpdateHealthServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
return LoadBalancerStatsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static LoadBalancerStatsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public LoadBalancerStatsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return LoadBalancerStatsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -212,6 +227,46 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingV2Stub> {
|
||||
private LoadBalancerStatsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected LoadBalancerStatsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the backend distribution for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the accumulated stats for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientAccumulatedStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service LoadBalancerStatsService.
|
||||
* <pre>
|
||||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
|
||||
private LoadBalancerStatsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -89,6 +89,21 @@ public final class MetricsServiceGrpc {
|
|||
return MetricsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static MetricsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public MetricsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MetricsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -199,6 +214,46 @@ public final class MetricsServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingV2Stub> {
|
||||
private MetricsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MetricsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the values of all the gauges that are currently being maintained by
|
||||
* the service
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Metrics.GaugeResponse>
|
||||
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the value of one gauge
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
|
||||
private MetricsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class ReconnectServiceGrpc {
|
|||
return ReconnectServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ReconnectServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ReconnectServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ReconnectServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -200,6 +215,40 @@ public final class ReconnectServiceGrpc {
|
|||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingV2Stub> {
|
||||
private ReconnectServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ReconnectServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStartMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ReconnectService.
|
||||
* <pre>
|
||||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingStub> {
|
||||
private ReconnectServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -273,6 +273,21 @@ public final class TestServiceGrpc {
|
|||
return TestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -543,6 +558,125 @@ public final class TestServiceGrpc {
|
|||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingV2Stub> {
|
||||
private TestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One empty request followed by one empty response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEmptyCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response. Response has cache control
|
||||
* headers set such that a caching HTTP proxy (such as GFE) can
|
||||
* satisfy subsequent requests.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getCacheableUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
* The server returns the payload with client desired type and sizes.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse>
|
||||
streamingInputCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingInputCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
* As one request could lead to multiple responses, this interface
|
||||
* demonstrates the idea of full duplexing.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
fullDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getFullDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by a sequence of responses.
|
||||
* The server buffers all the client requests and then serves them in order. A
|
||||
* stream of responses are returned to the client when the server starts with
|
||||
* first request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
halfDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getHalfDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The test server will not implement this method. It will be used
|
||||
* to test the behavior when clients call unimplemented methods.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestService.
|
||||
* <pre>
|
||||
* A simple service to test the various types of RPCs and experiment with
|
||||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
|
||||
private TestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class UnimplementedServiceGrpc {
|
|||
return UnimplementedServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static UnimplementedServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public UnimplementedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return UnimplementedServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -166,6 +181,37 @@ public final class UnimplementedServiceGrpc {
|
|||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingV2Stub> {
|
||||
private UnimplementedServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected UnimplementedServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A call that no server should implement
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service UnimplementedService.
|
||||
* <pre>
|
||||
* A simple service NOT implemented at servers so clients can test for
|
||||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingStub> {
|
||||
private UnimplementedServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -62,6 +62,21 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
return XdsUpdateClientConfigureServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateClientConfigureServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateClientConfigureServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateClientConfigureServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -161,6 +176,36 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingV2Stub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateClientConfigureServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Update the tes client's configuration.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ClientConfigureResponse configure(io.grpc.testing.integration.Messages.ClientConfigureRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getConfigureMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateClientConfigureService.
|
||||
* <pre>
|
||||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingStub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -92,6 +92,21 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
return XdsUpdateHealthServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateHealthServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateHealthServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateHealthServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -200,6 +215,40 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingV2Stub> {
|
||||
private XdsUpdateHealthServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateHealthServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setNotServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetNotServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateHealthService.
|
||||
* <pre>
|
||||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingStub> {
|
||||
private XdsUpdateHealthServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -184,6 +184,21 @@ public final class BenchmarkServiceGrpc {
|
|||
return BenchmarkServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static BenchmarkServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<BenchmarkServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public BenchmarkServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new BenchmarkServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return BenchmarkServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -367,6 +382,87 @@ public final class BenchmarkServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service BenchmarkService.
|
||||
*/
|
||||
public static final class BenchmarkServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<BenchmarkServiceBlockingV2Stub> {
|
||||
private BenchmarkServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected BenchmarkServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new BenchmarkServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* The server returns the client payload as-is.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.benchmarks.proto.Messages.SimpleResponse unaryCall(io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Repeated sequence of one request followed by one response.
|
||||
* Should be called streaming ping-pong
|
||||
* The server returns the client payload as-is on each response
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>
|
||||
streamingCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamingCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Single-sided unbounded streaming from client to server
|
||||
* The server returns the client payload as-is once the client does WritesDone
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>
|
||||
streamingFromClient() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingFromClientMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Single-sided unbounded streaming from server to client
|
||||
* The server repeatedly returns the client payload as-is
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.benchmarks.proto.Messages.SimpleResponse>
|
||||
streamingFromServer(io.grpc.benchmarks.proto.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingFromServerMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Two-sided unbounded streaming between server to client
|
||||
* Both sides send the content of their own choice to the other
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>
|
||||
streamingBothWays() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamingBothWaysMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service BenchmarkService.
|
||||
*/
|
||||
public static final class BenchmarkServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<BenchmarkServiceBlockingStub> {
|
||||
private BenchmarkServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class ReportQpsScenarioServiceGrpc {
|
|||
return ReportQpsScenarioServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ReportQpsScenarioServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ReportQpsScenarioServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ReportQpsScenarioServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ReportQpsScenarioServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReportQpsScenarioServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ReportQpsScenarioServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -147,6 +162,33 @@ public final class ReportQpsScenarioServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service ReportQpsScenarioService.
|
||||
*/
|
||||
public static final class ReportQpsScenarioServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReportQpsScenarioServiceBlockingV2Stub> {
|
||||
private ReportQpsScenarioServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ReportQpsScenarioServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReportQpsScenarioServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Report results of a QPS test benchmark scenario.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.benchmarks.proto.Control.Void reportScenario(io.grpc.benchmarks.proto.Control.ScenarioResult request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getReportScenarioMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ReportQpsScenarioService.
|
||||
*/
|
||||
public static final class ReportQpsScenarioServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReportQpsScenarioServiceBlockingStub> {
|
||||
private ReportQpsScenarioServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -153,6 +153,21 @@ public final class WorkerServiceGrpc {
|
|||
return WorkerServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static WorkerServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<WorkerServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<WorkerServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public WorkerServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new WorkerServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return WorkerServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -323,6 +338,77 @@ public final class WorkerServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service WorkerService.
|
||||
*/
|
||||
public static final class WorkerServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<WorkerServiceBlockingV2Stub> {
|
||||
private WorkerServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected WorkerServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new WorkerServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Start server with specified workload.
|
||||
* First request sent specifies the ServerConfig followed by ServerStatus
|
||||
* response. After that, a "Mark" can be sent anytime to request the latest
|
||||
* stats. Closing the stream will initiate shutdown of the test server
|
||||
* and once the shutdown has finished, the OK status is sent to terminate
|
||||
* this RPC.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.benchmarks.proto.Control.ServerArgs, io.grpc.benchmarks.proto.Control.ServerStatus>
|
||||
runServer() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getRunServerMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Start client with specified workload.
|
||||
* First request sent specifies the ClientConfig followed by ClientStatus
|
||||
* response. After that, a "Mark" can be sent anytime to request the latest
|
||||
* stats. Closing the stream will initiate shutdown of the test client
|
||||
* and once the shutdown has finished, the OK status is sent to terminate
|
||||
* this RPC.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.benchmarks.proto.Control.ClientArgs, io.grpc.benchmarks.proto.Control.ClientStatus>
|
||||
runClient() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getRunClientMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Just return the core count - unary call
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.benchmarks.proto.Control.CoreResponse coreCount(io.grpc.benchmarks.proto.Control.CoreRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getCoreCountMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Quit this worker
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.benchmarks.proto.Control.Void quitWorker(io.grpc.benchmarks.proto.Control.Void request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getQuitWorkerMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service WorkerService.
|
||||
*/
|
||||
public static final class WorkerServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<WorkerServiceBlockingStub> {
|
||||
private WorkerServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -355,13 +355,15 @@ enum StubType {
|
|||
BLOCKING_CLIENT_IMPL = 5,
|
||||
FUTURE_CLIENT_IMPL = 6,
|
||||
ABSTRACT_CLASS = 7,
|
||||
NONE = 8,
|
||||
BLOCKING_V2_CLIENT_IMPL = 8,
|
||||
NONE = 999,
|
||||
};
|
||||
|
||||
enum CallType {
|
||||
ASYNC_CALL = 0,
|
||||
BLOCKING_CALL = 1,
|
||||
FUTURE_CALL = 2
|
||||
FUTURE_CALL = 2,
|
||||
BLOCKING_V2_CALL = 3,
|
||||
};
|
||||
|
||||
// TODO(nmittler): Remove once protobuf includes javadoc methods in distribution.
|
||||
|
|
@ -410,6 +412,9 @@ static void GrpcWriteServiceDocComment(Printer* printer,
|
|||
printer->Print(vars, " * A stub to allow clients to do asynchronous rpc calls to service $service$.\n");
|
||||
break;
|
||||
case BLOCKING_CLIENT_IMPL:
|
||||
printer->Print(vars, " * A stub to allow clients to do llimited synchronous rpc calls to service $service$.\n");
|
||||
break;
|
||||
case BLOCKING_V2_CLIENT_IMPL:
|
||||
printer->Print(vars, " * A stub to allow clients to do synchronous rpc calls to service $service$.\n");
|
||||
break;
|
||||
case FUTURE_CLIENT_IMPL:
|
||||
|
|
@ -555,6 +560,9 @@ static void PrintStubFactory(
|
|||
case BLOCKING_CLIENT_IMPL:
|
||||
stub_type_name = "Blocking";
|
||||
break;
|
||||
case BLOCKING_V2_CLIENT_IMPL:
|
||||
stub_type_name = "BlockingV2";
|
||||
break;
|
||||
default:
|
||||
GRPC_CODEGEN_FAIL << "Cannot generate StubFactory for StubType: " << type;
|
||||
}
|
||||
|
|
@ -597,6 +605,11 @@ static void PrintStub(
|
|||
stub_name += "BlockingStub";
|
||||
stub_base_class_name = "AbstractBlockingStub";
|
||||
break;
|
||||
case BLOCKING_V2_CLIENT_IMPL:
|
||||
call_type = BLOCKING_V2_CALL;
|
||||
stub_name += "BlockingV2Stub";
|
||||
stub_base_class_name = "AbstractBlockingStub";
|
||||
break;
|
||||
case FUTURE_CLIENT_IMPL:
|
||||
call_type = FUTURE_CALL;
|
||||
stub_name += "FutureStub";
|
||||
|
|
@ -679,13 +692,17 @@ static void PrintStub(
|
|||
|
||||
// Method signature
|
||||
p->Print("\n");
|
||||
// TODO(nmittler): Replace with WriteMethodDocComment once included by the protobuf distro.
|
||||
GrpcWriteMethodDocComment(p, method);
|
||||
|
||||
if (method->options().deprecated()) {
|
||||
p->Print(*vars, "@$Deprecated$\n");
|
||||
}
|
||||
|
||||
if ((call_type == BLOCKING_CALL && client_streaming && server_streaming)
|
||||
|| (call_type == BLOCKING_V2_CALL && (client_streaming || server_streaming))) {
|
||||
p->Print(*vars, "@io.grpc.ExperimentalApi(\"https://github.com/grpc/grpc-java/issues/10918\")\n");
|
||||
}
|
||||
|
||||
if (!interface) {
|
||||
p->Print("public ");
|
||||
} else {
|
||||
|
|
@ -695,7 +712,12 @@ static void PrintStub(
|
|||
case BLOCKING_CALL:
|
||||
GRPC_CODEGEN_CHECK(!client_streaming)
|
||||
<< "Blocking client interface with client streaming is unavailable";
|
||||
if (server_streaming) {
|
||||
if (client_streaming && server_streaming) {
|
||||
p->Print(
|
||||
*vars,
|
||||
"$BlockingClientCall$<$input_type$, $output_type$>\n"
|
||||
" $lower_method_name$()");
|
||||
} else if (server_streaming) {
|
||||
// Server streaming
|
||||
p->Print(
|
||||
*vars,
|
||||
|
|
@ -708,6 +730,25 @@ static void PrintStub(
|
|||
"$output_type$ $lower_method_name$($input_type$ request)");
|
||||
}
|
||||
break;
|
||||
case BLOCKING_V2_CALL:
|
||||
if (client_streaming) { // Both Bidi and Client Streaming
|
||||
p->Print(
|
||||
*vars,
|
||||
"$BlockingClientCall$<$input_type$, $output_type$>\n"
|
||||
" $lower_method_name$()");
|
||||
} else if (server_streaming) {
|
||||
// Server streaming
|
||||
p->Print(
|
||||
*vars,
|
||||
"$BlockingClientCall$<?, $output_type$>\n"
|
||||
" $lower_method_name$($input_type$ request)");
|
||||
} else {
|
||||
// Simple RPC
|
||||
p->Print(
|
||||
*vars,
|
||||
"$output_type$ $lower_method_name$($input_type$ request)");
|
||||
}
|
||||
break;
|
||||
case ASYNC_CALL:
|
||||
if (client_streaming) {
|
||||
// Bidirectional streaming or client streaming
|
||||
|
|
@ -756,7 +797,7 @@ static void PrintStub(
|
|||
switch (call_type) {
|
||||
case BLOCKING_CALL:
|
||||
GRPC_CODEGEN_CHECK(!client_streaming)
|
||||
<< "Blocking client streaming interface is not available";
|
||||
<< "Blocking client and bidi streaming interface are not available";
|
||||
if (server_streaming) {
|
||||
(*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingServerStreamingCall";
|
||||
(*vars)["params"] = "request";
|
||||
|
|
@ -769,6 +810,31 @@ static void PrintStub(
|
|||
"return $calls_method$(\n"
|
||||
" getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
|
||||
break;
|
||||
case BLOCKING_V2_CALL:
|
||||
if (client_streaming) { // client and bidi streaming
|
||||
if (server_streaming) {
|
||||
(*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingBidiStreamingCall";
|
||||
} else {
|
||||
(*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingClientStreamingCall";
|
||||
}
|
||||
p->Print(
|
||||
*vars,
|
||||
"return $calls_method$(\n"
|
||||
" getChannel(), $method_method_name$(), getCallOptions());\n");
|
||||
} else { // server streaming and unary
|
||||
(*vars)["params"] = "request";
|
||||
if (server_streaming) {
|
||||
(*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall";
|
||||
} else {
|
||||
(*vars)["calls_method"] = "io.grpc.stub.ClientCalls.blockingUnaryCall";
|
||||
}
|
||||
|
||||
p->Print(
|
||||
*vars,
|
||||
"return $calls_method$(\n"
|
||||
" getChannel(), $method_method_name$(), getCallOptions(), $params$);\n");
|
||||
}
|
||||
break;
|
||||
case ASYNC_CALL:
|
||||
if (server_streaming) {
|
||||
if (client_streaming) {
|
||||
|
|
@ -1173,6 +1239,21 @@ static void PrintService(const ServiceDescriptor* service,
|
|||
p->Outdent();
|
||||
p->Print("}\n\n");
|
||||
|
||||
// TODO(nmittler): Replace with WriteDocComment once included by protobuf distro.
|
||||
GrpcWriteDocComment(p, " Creates a new blocking-style stub that supports all types of calls "
|
||||
"on the service");
|
||||
p->Print(
|
||||
*vars,
|
||||
"public static $service_name$BlockingV2Stub newBlockingV2Stub(\n"
|
||||
" $Channel$ channel) {\n");
|
||||
p->Indent();
|
||||
PrintStubFactory(service, vars, p, BLOCKING_V2_CLIENT_IMPL);
|
||||
p->Print(
|
||||
*vars,
|
||||
"return $service_name$BlockingV2Stub.newStub(factory, channel);\n");
|
||||
p->Outdent();
|
||||
p->Print("}\n\n");
|
||||
|
||||
// TODO(nmittler): Replace with WriteDocComment once included by protobuf distro.
|
||||
GrpcWriteDocComment(p, " Creates a new blocking-style stub that supports unary and streaming "
|
||||
"output calls on the service");
|
||||
|
|
@ -1206,6 +1287,7 @@ static void PrintService(const ServiceDescriptor* service,
|
|||
PrintStub(service, vars, p, ASYNC_INTERFACE);
|
||||
PrintAbstractClassStub(service, vars, p);
|
||||
PrintStub(service, vars, p, ASYNC_CLIENT_IMPL);
|
||||
PrintStub(service, vars, p, BLOCKING_V2_CLIENT_IMPL);
|
||||
PrintStub(service, vars, p, BLOCKING_CLIENT_IMPL);
|
||||
PrintStub(service, vars, p, FUTURE_CLIENT_IMPL);
|
||||
|
||||
|
|
@ -1257,6 +1339,7 @@ void GenerateService(const ServiceDescriptor* service,
|
|||
vars["RpcMethod"] = "io.grpc.stub.annotations.RpcMethod";
|
||||
vars["MethodDescriptor"] = "io.grpc.MethodDescriptor";
|
||||
vars["StreamObserver"] = "io.grpc.stub.StreamObserver";
|
||||
vars["BlockingClientCall"] = "io.grpc.stub.BlockingClientCall";
|
||||
vars["Iterator"] = "java.util.Iterator";
|
||||
vars["GrpcGenerated"] = "io.grpc.stub.annotations.GrpcGenerated";
|
||||
vars["ListenableFuture"] =
|
||||
|
|
|
|||
|
|
@ -64,6 +64,21 @@ public final class TestDeprecatedServiceGrpc {
|
|||
return TestDeprecatedServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestDeprecatedServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestDeprecatedServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestDeprecatedServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestDeprecatedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestDeprecatedServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -169,6 +184,38 @@ public final class TestDeprecatedServiceGrpc {
|
|||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static final class TestDeprecatedServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestDeprecatedServiceBlockingV2Stub> {
|
||||
private TestDeprecatedServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestDeprecatedServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* An RPC method that has been deprecated and should generate with Java's @Deprecated annotation
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse deprecatedMethod(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getDeprecatedMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestDeprecatedService.
|
||||
* <pre>
|
||||
* Test service that has been deprecated and should generate with Java's @Deprecated annotation
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static final class TestDeprecatedServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestDeprecatedServiceBlockingStub> {
|
||||
private TestDeprecatedServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -282,6 +282,21 @@ public final class TestServiceGrpc {
|
|||
return TestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -546,6 +561,125 @@ public final class TestServiceGrpc {
|
|||
* Test service that supports all call types.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingV2Stub> {
|
||||
private TestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* The server returns the client payload as-is.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
* The server returns the payload with client desired type and sizes.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>
|
||||
streamingInputCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingInputCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
* As one request could lead to multiple responses, this interface
|
||||
* demonstrates the idea of full bidirectionality.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
fullBidiCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getFullBidiCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by a sequence of responses.
|
||||
* The server buffers all the client requests and then serves them in order. A
|
||||
* stream of responses are returned to the client when the server starts with
|
||||
* first request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
halfBidiCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getHalfBidiCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||
* method should have a '_' appended.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>
|
||||
import_() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getImportMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A unary call that is Safe.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse safeCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSafeCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A unary call that is Idempotent.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse idempotentCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getIdempotentCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestService.
|
||||
* <pre>
|
||||
* Test service that supports all call types.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
|
||||
private TestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class TestDeprecatedServiceGrpc {
|
|||
return TestDeprecatedServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestDeprecatedServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestDeprecatedServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestDeprecatedServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestDeprecatedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestDeprecatedServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -165,6 +180,38 @@ public final class TestDeprecatedServiceGrpc {
|
|||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static final class TestDeprecatedServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestDeprecatedServiceBlockingV2Stub> {
|
||||
private TestDeprecatedServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestDeprecatedServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestDeprecatedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* An RPC method that has been deprecated and should generate with Java's @Deprecated annotation
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse deprecatedMethod(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getDeprecatedMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestDeprecatedService.
|
||||
* <pre>
|
||||
* Test service that has been deprecated and should generate with Java's @Deprecated annotation
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static final class TestDeprecatedServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestDeprecatedServiceBlockingStub> {
|
||||
private TestDeprecatedServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -271,6 +271,21 @@ public final class TestServiceGrpc {
|
|||
return TestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -535,6 +550,125 @@ public final class TestServiceGrpc {
|
|||
* Test service that supports all call types.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingV2Stub> {
|
||||
private TestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* The server returns the client payload as-is.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
* The server returns the payload with client desired type and sizes.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>
|
||||
streamingInputCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingInputCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
* As one request could lead to multiple responses, this interface
|
||||
* demonstrates the idea of full bidirectionality.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
fullBidiCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getFullBidiCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by a sequence of responses.
|
||||
* The server buffers all the client requests and then serves them in order. A
|
||||
* stream of responses are returned to the client when the server starts with
|
||||
* first request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>
|
||||
halfBidiCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getHalfBidiCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||
* method should have a '_' appended.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>
|
||||
import_() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getImportMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A unary call that is Safe.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse safeCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSafeCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A unary call that is Idempotent.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.compiler.Test.SimpleResponse idempotentCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getIdempotentCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestService.
|
||||
* <pre>
|
||||
* Test service that supports all call types.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
|
||||
private TestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ createStartScripts('io.grpc.examples.keepalive.KeepAliveClient')
|
|||
createStartScripts('io.grpc.examples.keepalive.KeepAliveServer')
|
||||
createStartScripts('io.grpc.examples.loadbalance.LoadBalanceClient')
|
||||
createStartScripts('io.grpc.examples.loadbalance.LoadBalanceServer')
|
||||
createStartScripts('io.grpc.examples.manualflowcontrol.BidiBlockingClient')
|
||||
createStartScripts('io.grpc.examples.manualflowcontrol.ManualFlowControlClient')
|
||||
createStartScripts('io.grpc.examples.manualflowcontrol.ManualFlowControlServer')
|
||||
createStartScripts('io.grpc.examples.multiplex.MultiplexingServer')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,286 @@
|
|||
/*
|
||||
* Copyright 2023 The gRPC Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.grpc.examples.manualflowcontrol;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.grpc.Grpc;
|
||||
import io.grpc.InsecureChannelCredentials;
|
||||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.StatusException;
|
||||
import io.grpc.examples.manualflowcontrol.StreamingGreeterGrpc.StreamingGreeterBlockingV2Stub;
|
||||
import io.grpc.stub.BlockingClientCall;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* A class that tries multiple ways to do blocking bidi streaming
|
||||
* communication with an echo server
|
||||
*/
|
||||
public class BidiBlockingClient {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(BidiBlockingClient.class.getName());
|
||||
|
||||
/**
|
||||
* Greet server. If provided, the first element of {@code args} is the name to use in the
|
||||
* greeting. The second argument is the target server. You can see the multiplexing in the server
|
||||
* logs.
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tH:%1$tM:%1$tS %5$s%6$s%n");
|
||||
|
||||
// Access a service running on the local machine on port 50051
|
||||
String target = "localhost:50051";
|
||||
// Allow passing in the user and target strings as command line arguments
|
||||
if (args.length > 0) {
|
||||
if ("--help".equals(args[0])) {
|
||||
System.err.println("Usage: [target]\n");
|
||||
System.err.println(" target The server to connect to. Defaults to " + target);
|
||||
System.exit(1);
|
||||
}
|
||||
target = args[0];
|
||||
}
|
||||
|
||||
// Create a communication channel to the server, known as a Channel. Channels are thread-safe
|
||||
// and reusable. It is common to create channels at the beginning of your application and reuse
|
||||
// them until the application shuts down.
|
||||
//
|
||||
// For the example we use plaintext insecure credentials to avoid needing TLS certificates. To
|
||||
// use TLS, use TlsChannelCredentials instead.
|
||||
ManagedChannel channel = Grpc.newChannelBuilder(target, InsecureChannelCredentials.create())
|
||||
.build();
|
||||
StreamingGreeterBlockingV2Stub blockingStub = StreamingGreeterGrpc.newBlockingV2Stub(channel);
|
||||
List<String> echoInput = names();
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
List<String> twoThreadResult = useTwoThreads(blockingStub, echoInput);
|
||||
long finish = System.currentTimeMillis();
|
||||
|
||||
System.out.println("The echo requests and results were:");
|
||||
printResultMessage("Input", echoInput, 0L);
|
||||
printResultMessage("2 threads", twoThreadResult, finish - start);
|
||||
} finally {
|
||||
// ManagedChannels use resources like threads and TCP connections. To prevent leaking these
|
||||
// resources the channel should be shut down when it will no longer be used. If it may be used
|
||||
// again leave it running.
|
||||
channel.shutdownNow().awaitTermination(5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
private static void printResultMessage(String type, List<String> result, long millis) {
|
||||
String msg = String.format("%-32s: %2d, %.3f sec", type, result.size(), millis/1000.0);
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
private static void logMethodStart(String method) {
|
||||
logger.info("--------------------- Starting to process using method: " + method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create 2 threads, one that writes all values, and one that reads until the stream closes.
|
||||
*/
|
||||
private static List<String> useTwoThreads(StreamingGreeterBlockingV2Stub blockingStub,
|
||||
List<String> valuesToWrite) throws InterruptedException {
|
||||
logMethodStart("Two Threads");
|
||||
|
||||
List<String> readValues = new ArrayList<>();
|
||||
final BlockingClientCall<HelloRequest, HelloReply> stream = blockingStub.sayHelloStreaming();
|
||||
|
||||
Thread reader = new Thread(null,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int count = 0;
|
||||
try {
|
||||
while (stream.hasNext()) {
|
||||
readValues.add(stream.read().getMessage());
|
||||
if (++count % 10 == 0) {
|
||||
logger.info("Finished " + count + " reads");
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
stream.cancel("Interrupted", e);
|
||||
} catch (StatusException e) {
|
||||
logger.warning("Encountered error while reading: " + e);
|
||||
}
|
||||
}
|
||||
},"reader");
|
||||
|
||||
Thread writer = new Thread(null,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ByteString padding = createPadding();
|
||||
int count = 0;
|
||||
Iterator<String> iterator = valuesToWrite.iterator();
|
||||
boolean hadProblem = false;
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
if (!stream.write(HelloRequest.newBuilder().setName(iterator.next()).setPadding(padding)
|
||||
.build())) {
|
||||
logger.warning("Stream closed before writes completed");
|
||||
hadProblem = true;
|
||||
break;
|
||||
}
|
||||
if (++count % 10 == 0) {
|
||||
logger.info("Finished " + count + " writes");
|
||||
}
|
||||
}
|
||||
if (!hadProblem) {
|
||||
logger.info("Completed writes");
|
||||
stream.halfClose();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
stream.cancel("Interrupted", e);
|
||||
} catch (StatusException e) {
|
||||
logger.warning("Encountered error while writing: " + e);
|
||||
}
|
||||
}
|
||||
}, "writer");
|
||||
|
||||
writer.start();
|
||||
reader.start();
|
||||
writer.join();
|
||||
reader.join();
|
||||
|
||||
return readValues;
|
||||
}
|
||||
|
||||
private static ByteString createPadding() {
|
||||
int multiple = 50;
|
||||
ByteBuffer data = ByteBuffer.allocate(1024 * multiple);
|
||||
|
||||
for (int i = 0; i < multiple * 1024 / 4; i++) {
|
||||
data.putInt(4 * i, 1111);
|
||||
}
|
||||
|
||||
return ByteString.copyFrom(data);
|
||||
}
|
||||
|
||||
|
||||
private static List<String> names() {
|
||||
return Arrays.asList(
|
||||
"Sophia",
|
||||
"Jackson",
|
||||
"Emma",
|
||||
"Aiden",
|
||||
"Olivia",
|
||||
"Lucas",
|
||||
"Ava",
|
||||
"Liam",
|
||||
"Mia",
|
||||
"Noah",
|
||||
"Isabella",
|
||||
"Ethan",
|
||||
"Riley",
|
||||
"Mason",
|
||||
"Aria",
|
||||
"Caden",
|
||||
"Zoe",
|
||||
"Oliver",
|
||||
"Charlotte",
|
||||
"Elijah",
|
||||
"Lily",
|
||||
"Grayson",
|
||||
"Layla",
|
||||
"Jacob",
|
||||
"Amelia",
|
||||
"Michael",
|
||||
"Emily",
|
||||
"Benjamin",
|
||||
"Madelyn",
|
||||
"Carter",
|
||||
"Aubrey",
|
||||
"James",
|
||||
"Adalyn",
|
||||
"Jayden",
|
||||
"Madison",
|
||||
"Logan",
|
||||
"Chloe",
|
||||
"Alexander",
|
||||
"Harper",
|
||||
"Caleb",
|
||||
"Abigail",
|
||||
"Ryan",
|
||||
"Aaliyah",
|
||||
"Luke",
|
||||
"Avery",
|
||||
"Daniel",
|
||||
"Evelyn",
|
||||
"Jack",
|
||||
"Kaylee",
|
||||
"William",
|
||||
"Ella",
|
||||
"Owen",
|
||||
"Ellie",
|
||||
"Gabriel",
|
||||
"Scarlett",
|
||||
"Matthew",
|
||||
"Arianna",
|
||||
"Connor",
|
||||
"Hailey",
|
||||
"Jayce",
|
||||
"Nora",
|
||||
"Isaac",
|
||||
"Addison",
|
||||
"Sebastian",
|
||||
"Brooklyn",
|
||||
"Henry",
|
||||
"Hannah",
|
||||
"Muhammad",
|
||||
"Mila",
|
||||
"Cameron",
|
||||
"Leah",
|
||||
"Wyatt",
|
||||
"Elizabeth",
|
||||
"Dylan",
|
||||
"Sarah",
|
||||
"Nathan",
|
||||
"Eliana",
|
||||
"Nicholas",
|
||||
"Mackenzie",
|
||||
"Julian",
|
||||
"Peyton",
|
||||
"Eli",
|
||||
"Maria",
|
||||
"Levi",
|
||||
"Grace",
|
||||
"Isaiah",
|
||||
"Adeline",
|
||||
"Landon",
|
||||
"Elena",
|
||||
"David",
|
||||
"Anna",
|
||||
"Christian",
|
||||
"Victoria",
|
||||
"Andrew",
|
||||
"Camilla",
|
||||
"Brayden",
|
||||
"Lillian",
|
||||
"John",
|
||||
"Natalie",
|
||||
"Lincoln"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,6 +72,7 @@ public class ManualFlowControlServer {
|
|||
|
||||
// Give gRPC a StreamObserver that can observe and process incoming requests.
|
||||
return new StreamObserver<HelloRequest>() {
|
||||
int cnt = 0;
|
||||
@Override
|
||||
public void onNext(HelloRequest request) {
|
||||
// Process the request and send a response or an error.
|
||||
|
|
@ -81,7 +82,8 @@ public class ManualFlowControlServer {
|
|||
logger.info("--> " + name);
|
||||
|
||||
// Simulate server "work"
|
||||
Thread.sleep(100);
|
||||
int sleepMillis = ++cnt % 20 == 0 ? 2000 : 100;
|
||||
Thread.sleep(sleepMillis);
|
||||
|
||||
// Send a response.
|
||||
String message = "Hello " + name;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ service StreamingGreeter {
|
|||
// The request message containing the user's name.
|
||||
message HelloRequest {
|
||||
string name = 1;
|
||||
bytes padding = 2;
|
||||
}
|
||||
|
||||
// The response message containing the greetings
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class LoadBalancerGrpc {
|
|||
return LoadBalancerStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static LoadBalancerBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public LoadBalancerBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return LoadBalancerBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -147,6 +162,35 @@ public final class LoadBalancerGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service LoadBalancer.
|
||||
*/
|
||||
public static final class LoadBalancerBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerBlockingV2Stub> {
|
||||
private LoadBalancerBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected LoadBalancerBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Bidirectional rpc to get a list of servers.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.lb.v1.LoadBalanceRequest, io.grpc.lb.v1.LoadBalanceResponse>
|
||||
balanceLoad() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getBalanceLoadMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service LoadBalancer.
|
||||
*/
|
||||
public static final class LoadBalancerBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerBlockingStub> {
|
||||
private LoadBalancerBlockingStub(
|
||||
|
|
|
|||
|
|
@ -94,6 +94,21 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
return LoadBalancerStatsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static LoadBalancerStatsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<LoadBalancerStatsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public LoadBalancerStatsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return LoadBalancerStatsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -214,6 +229,46 @@ public final class LoadBalancerStatsServiceGrpc {
|
|||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingV2Stub> {
|
||||
private LoadBalancerStatsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected LoadBalancerStatsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadBalancerStatsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the backend distribution for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets the accumulated stats for RPCs sent by a test client.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetClientAccumulatedStatsMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service LoadBalancerStatsService.
|
||||
* <pre>
|
||||
* A service used to obtain stats for verifying LB behavior.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class LoadBalancerStatsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
|
||||
private LoadBalancerStatsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -91,6 +91,21 @@ public final class MetricsServiceGrpc {
|
|||
return MetricsServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static MetricsServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MetricsServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public MetricsServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MetricsServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -201,6 +216,46 @@ public final class MetricsServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingV2Stub> {
|
||||
private MetricsServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MetricsServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MetricsServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the values of all the gauges that are currently being maintained by
|
||||
* the service
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Metrics.GaugeResponse>
|
||||
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns the value of one gauge
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service MetricsService.
|
||||
*/
|
||||
public static final class MetricsServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
|
||||
private MetricsServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -94,6 +94,21 @@ public final class ReconnectServiceGrpc {
|
|||
return ReconnectServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ReconnectServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ReconnectServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ReconnectServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ReconnectServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -202,6 +217,40 @@ public final class ReconnectServiceGrpc {
|
|||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingV2Stub> {
|
||||
private ReconnectServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ReconnectServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReconnectServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStartMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ReconnectService.
|
||||
* <pre>
|
||||
* A service used to control reconnect server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ReconnectServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReconnectServiceBlockingStub> {
|
||||
private ReconnectServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -281,6 +281,21 @@ public final class TestServiceGrpc {
|
|||
return TestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static TestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public TestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return TestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -551,6 +566,125 @@ public final class TestServiceGrpc {
|
|||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingV2Stub> {
|
||||
private TestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected TestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new TestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One empty request followed by one empty response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty emptyCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEmptyCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse unaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by one response. Response has cache control
|
||||
* headers set such that a caching HTTP proxy (such as GFE) can
|
||||
* satisfy subsequent requests.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.SimpleResponse cacheableUnaryCall(io.grpc.testing.integration.Messages.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getCacheableUnaryCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
* The server returns the payload with client desired type and sizes.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
streamingOutputCall(io.grpc.testing.integration.Messages.StreamingOutputCallRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingInputCallRequest, io.grpc.testing.integration.Messages.StreamingInputCallResponse>
|
||||
streamingInputCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getStreamingInputCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
* As one request could lead to multiple responses, this interface
|
||||
* demonstrates the idea of full duplexing.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
fullDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getFullDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A sequence of requests followed by a sequence of responses.
|
||||
* The server buffers all the client requests and then serves them in order. A
|
||||
* stream of responses are returned to the client when the server starts with
|
||||
* first request.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.integration.Messages.StreamingOutputCallRequest, io.grpc.testing.integration.Messages.StreamingOutputCallResponse>
|
||||
halfDuplexCall() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getHalfDuplexCallMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The test server will not implement this method. It will be used
|
||||
* to test the behavior when clients call unimplemented methods.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service TestService.
|
||||
* <pre>
|
||||
* A simple service to test the various types of RPCs and experiment with
|
||||
* performance with various types of payload.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class TestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
|
||||
private TestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -64,6 +64,21 @@ public final class UnimplementedServiceGrpc {
|
|||
return UnimplementedServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static UnimplementedServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<UnimplementedServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public UnimplementedServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return UnimplementedServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -167,6 +182,37 @@ public final class UnimplementedServiceGrpc {
|
|||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingV2Stub> {
|
||||
private UnimplementedServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected UnimplementedServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new UnimplementedServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A call that no server should implement
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty unimplementedCall(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnimplementedCallMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service UnimplementedService.
|
||||
* <pre>
|
||||
* A simple service NOT implemented at servers so clients can test for
|
||||
* that case.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class UnimplementedServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<UnimplementedServiceBlockingStub> {
|
||||
private UnimplementedServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
return XdsUpdateClientConfigureServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateClientConfigureServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateClientConfigureServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateClientConfigureServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateClientConfigureServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -162,6 +177,36 @@ public final class XdsUpdateClientConfigureServiceGrpc {
|
|||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingV2Stub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateClientConfigureServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateClientConfigureServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Update the tes client's configuration.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.integration.Messages.ClientConfigureResponse configure(io.grpc.testing.integration.Messages.ClientConfigureRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getConfigureMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateClientConfigureService.
|
||||
* <pre>
|
||||
* A service to dynamically update the configuration of an xDS test client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateClientConfigureServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateClientConfigureServiceBlockingStub> {
|
||||
private XdsUpdateClientConfigureServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -94,6 +94,21 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
return XdsUpdateHealthServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static XdsUpdateHealthServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<XdsUpdateHealthServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public XdsUpdateHealthServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return XdsUpdateHealthServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -202,6 +217,40 @@ public final class XdsUpdateHealthServiceGrpc {
|
|||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingV2Stub> {
|
||||
private XdsUpdateHealthServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected XdsUpdateHealthServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new XdsUpdateHealthServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.testing.integration.EmptyProtos.Empty setNotServing(io.grpc.testing.integration.EmptyProtos.Empty request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetNotServingMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service XdsUpdateHealthService.
|
||||
* <pre>
|
||||
* A service to remotely control health status of an xDS test server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class XdsUpdateHealthServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<XdsUpdateHealthServiceBlockingStub> {
|
||||
private XdsUpdateHealthServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -91,6 +91,21 @@ public final class EchoTestServiceGrpc {
|
|||
return EchoTestServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static EchoTestServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public EchoTestServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new EchoTestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return EchoTestServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -187,6 +202,37 @@ public final class EchoTestServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service EchoTestService.
|
||||
*/
|
||||
public static final class EchoTestServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<EchoTestServiceBlockingV2Stub> {
|
||||
private EchoTestServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected EchoTestServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new EchoTestServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.istio.test.Echo.EchoResponse echo(io.istio.test.Echo.EchoRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEchoMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.istio.test.Echo.ForwardEchoResponse forwardEcho(io.istio.test.Echo.ForwardEchoRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getForwardEchoMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service EchoTestService.
|
||||
*/
|
||||
public static final class EchoTestServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<EchoTestServiceBlockingStub> {
|
||||
private EchoTestServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class RouteLookupServiceGrpc {
|
|||
return RouteLookupServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static RouteLookupServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<RouteLookupServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<RouteLookupServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public RouteLookupServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new RouteLookupServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return RouteLookupServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -147,6 +162,33 @@ public final class RouteLookupServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service RouteLookupService.
|
||||
*/
|
||||
public static final class RouteLookupServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<RouteLookupServiceBlockingV2Stub> {
|
||||
private RouteLookupServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected RouteLookupServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new RouteLookupServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Lookup returns a target for a single key.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.lookup.v1.RouteLookupResponse routeLookup(io.grpc.lookup.v1.RouteLookupRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getRouteLookupMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service RouteLookupService.
|
||||
*/
|
||||
public static final class RouteLookupServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<RouteLookupServiceBlockingStub> {
|
||||
private RouteLookupServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class S2AServiceGrpc {
|
|||
return S2AServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static S2AServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<S2AServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<S2AServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public S2AServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new S2AServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return S2AServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -149,6 +164,36 @@ public final class S2AServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service S2AService.
|
||||
*/
|
||||
public static final class S2AServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<S2AServiceBlockingV2Stub> {
|
||||
private S2AServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected S2AServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new S2AServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* SetUpSession is a bidirectional stream used by applications to offload
|
||||
* operations from the TLS handshake.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.s2a.internal.handshaker.SessionReq, io.grpc.s2a.internal.handshaker.SessionResp>
|
||||
setUpSession() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getSetUpSessionMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service S2AService.
|
||||
*/
|
||||
public static final class S2AServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<S2AServiceBlockingStub> {
|
||||
private S2AServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -250,6 +250,21 @@ public final class ChannelzGrpc {
|
|||
return ChannelzStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ChannelzBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ChannelzBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ChannelzBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ChannelzBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ChannelzBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ChannelzBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -481,6 +496,98 @@ public final class ChannelzGrpc {
|
|||
* information.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ChannelzBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ChannelzBlockingV2Stub> {
|
||||
private ChannelzBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ChannelzBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ChannelzBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets all root channels (i.e. channels the application has directly
|
||||
* created). This does not include subchannels nor non-top level channels.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetTopChannelsResponse getTopChannels(io.grpc.channelz.v1.GetTopChannelsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetTopChannelsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets all servers that exist in the process.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetServersResponse getServers(io.grpc.channelz.v1.GetServersRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetServersMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns a single Server, or else a NOT_FOUND code.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetServerResponse getServer(io.grpc.channelz.v1.GetServerRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetServerMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Gets all server sockets that exist in the process.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetServerSocketsResponse getServerSockets(io.grpc.channelz.v1.GetServerSocketsRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetServerSocketsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns a single Channel, or else a NOT_FOUND code.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetChannelResponse getChannel(io.grpc.channelz.v1.GetChannelRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetChannelMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns a single Subchannel, or else a NOT_FOUND code.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetSubchannelResponse getSubchannel(io.grpc.channelz.v1.GetSubchannelRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetSubchannelMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Returns a single Socket or else a NOT_FOUND code.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.channelz.v1.GetSocketResponse getSocket(io.grpc.channelz.v1.GetSocketRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetSocketMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service Channelz.
|
||||
* <pre>
|
||||
* Channelz is a service exposed by gRPC servers that provides detailed debug
|
||||
* information.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ChannelzBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ChannelzBlockingStub> {
|
||||
private ChannelzBlockingStub(
|
||||
|
|
|
|||
|
|
@ -91,6 +91,21 @@ public final class HealthGrpc {
|
|||
return HealthStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static HealthBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<HealthBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<HealthBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public HealthBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new HealthBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return HealthBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -225,6 +240,58 @@ public final class HealthGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service Health.
|
||||
*/
|
||||
public static final class HealthBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<HealthBlockingV2Stub> {
|
||||
private HealthBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected HealthBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new HealthBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* If the requested service is unknown, the call will fail with status
|
||||
* NOT_FOUND.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.health.v1.HealthCheckResponse check(io.grpc.health.v1.HealthCheckRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getCheckMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Performs a watch for the serving status of the requested service.
|
||||
* The server will immediately send back a message indicating the current
|
||||
* serving status. It will then subsequently send a new message whenever
|
||||
* the service's serving status changes.
|
||||
* If the requested service is unknown when the call is received, the
|
||||
* server will send a message setting the serving status to
|
||||
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
||||
* future point, the serving status of the service becomes known, the
|
||||
* server will send a new message with the service's serving status.
|
||||
* If the call terminates with status UNIMPLEMENTED, then clients
|
||||
* should assume this method is not supported and should not retry the
|
||||
* call. If the call terminates with any other status (including OK),
|
||||
* clients should retry the call with appropriate exponential backoff.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.health.v1.HealthCheckResponse>
|
||||
watch(io.grpc.health.v1.HealthCheckRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getWatchMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service Health.
|
||||
*/
|
||||
public static final class HealthBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<HealthBlockingStub> {
|
||||
private HealthBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class ServerReflectionGrpc {
|
|||
return ServerReflectionStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ServerReflectionBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ServerReflectionBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ServerReflectionBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ServerReflectionBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ServerReflectionBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ServerReflectionBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -149,6 +164,36 @@ public final class ServerReflectionGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service ServerReflection.
|
||||
*/
|
||||
public static final class ServerReflectionBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ServerReflectionBlockingV2Stub> {
|
||||
private ServerReflectionBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ServerReflectionBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ServerReflectionBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The reflection service is structured as a bidirectional stream, ensuring
|
||||
* all related requests go to a single server.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.reflection.v1.ServerReflectionRequest, io.grpc.reflection.v1.ServerReflectionResponse>
|
||||
serverReflectionInfo() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getServerReflectionInfoMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ServerReflection.
|
||||
*/
|
||||
public static final class ServerReflectionBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ServerReflectionBlockingStub> {
|
||||
private ServerReflectionBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class ServerReflectionGrpc {
|
|||
return ServerReflectionStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ServerReflectionBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ServerReflectionBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ServerReflectionBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ServerReflectionBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ServerReflectionBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ServerReflectionBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -149,6 +164,36 @@ public final class ServerReflectionGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service ServerReflection.
|
||||
*/
|
||||
public static final class ServerReflectionBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ServerReflectionBlockingV2Stub> {
|
||||
private ServerReflectionBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ServerReflectionBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ServerReflectionBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The reflection service is structured as a bidirectional stream, ensuring
|
||||
* all related requests go to a single server.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.reflection.v1alpha.ServerReflectionRequest, io.grpc.reflection.v1alpha.ServerReflectionResponse>
|
||||
serverReflectionInfo() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getServerReflectionInfoMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ServerReflection.
|
||||
*/
|
||||
public static final class ServerReflectionBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ServerReflectionBlockingStub> {
|
||||
private ServerReflectionBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class AnotherDynamicServiceGrpc {
|
|||
return AnotherDynamicServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static AnotherDynamicServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AnotherDynamicServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AnotherDynamicServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public AnotherDynamicServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AnotherDynamicServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AnotherDynamicServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -162,6 +177,36 @@ public final class AnotherDynamicServiceGrpc {
|
|||
* AnotherDynamicService
|
||||
* </pre>
|
||||
*/
|
||||
public static final class AnotherDynamicServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AnotherDynamicServiceBlockingV2Stub> {
|
||||
private AnotherDynamicServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AnotherDynamicServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AnotherDynamicServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A method
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.reflection.testing.DynamicReply method(io.grpc.reflection.testing.DynamicRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service AnotherDynamicService.
|
||||
* <pre>
|
||||
* AnotherDynamicService
|
||||
* </pre>
|
||||
*/
|
||||
public static final class AnotherDynamicServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AnotherDynamicServiceBlockingStub> {
|
||||
private AnotherDynamicServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class AnotherReflectableServiceGrpc {
|
|||
return AnotherReflectableServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static AnotherReflectableServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AnotherReflectableServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AnotherReflectableServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public AnotherReflectableServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AnotherReflectableServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AnotherReflectableServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -141,6 +156,30 @@ public final class AnotherReflectableServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service AnotherReflectableService.
|
||||
*/
|
||||
public static final class AnotherReflectableServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AnotherReflectableServiceBlockingV2Stub> {
|
||||
private AnotherReflectableServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AnotherReflectableServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AnotherReflectableServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.reflection.testing.Reply method(io.grpc.reflection.testing.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service AnotherReflectableService.
|
||||
*/
|
||||
public static final class AnotherReflectableServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AnotherReflectableServiceBlockingStub> {
|
||||
private AnotherReflectableServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class DynamicServiceGrpc {
|
|||
return DynamicServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static DynamicServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<DynamicServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<DynamicServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public DynamicServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new DynamicServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return DynamicServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -162,6 +177,36 @@ public final class DynamicServiceGrpc {
|
|||
* A DynamicService
|
||||
* </pre>
|
||||
*/
|
||||
public static final class DynamicServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<DynamicServiceBlockingV2Stub> {
|
||||
private DynamicServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected DynamicServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new DynamicServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* A method
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.reflection.testing.DynamicReply method(io.grpc.reflection.testing.DynamicRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service DynamicService.
|
||||
* <pre>
|
||||
* A DynamicService
|
||||
* </pre>
|
||||
*/
|
||||
public static final class DynamicServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<DynamicServiceBlockingStub> {
|
||||
private DynamicServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class ReflectableServiceGrpc {
|
|||
return ReflectableServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ReflectableServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ReflectableServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ReflectableServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ReflectableServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReflectableServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ReflectableServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -141,6 +156,30 @@ public final class ReflectableServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service ReflectableService.
|
||||
*/
|
||||
public static final class ReflectableServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReflectableServiceBlockingV2Stub> {
|
||||
private ReflectableServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ReflectableServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ReflectableServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.reflection.testing.Reply method(io.grpc.reflection.testing.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getMethodMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ReflectableService.
|
||||
*/
|
||||
public static final class ReflectableServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ReflectableServiceBlockingStub> {
|
||||
private ReflectableServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,352 @@
|
|||
/*
|
||||
* Copyright 2023 The gRPC Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.grpc.stub;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Predicate;
|
||||
import io.grpc.ClientCall;
|
||||
import io.grpc.ExperimentalApi;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.StatusException;
|
||||
import io.grpc.stub.ClientCalls.ThreadSafeThreadlessExecutor;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Represents a bidirectional streaming call from a client. Allows in a blocking manner, sending
|
||||
* over the stream and receiving from the stream. Also supports terminating the call.
|
||||
* Wraps a ClientCall and converts from async communication to the sync paradigm used by the
|
||||
* various blocking stream methods in {@link ClientCalls} which are used by the generated stubs.
|
||||
*
|
||||
* <p>Supports separate threads for reads and writes, but only 1 of each
|
||||
*
|
||||
* <p>Read methods consist of:
|
||||
* <ul>
|
||||
* <li>{@link #read()}
|
||||
* <li>{@link #read(long timeout, TimeUnit unit)}
|
||||
* <li>{@link #hasNext()}
|
||||
* <li>{@link #cancel(String, Throwable)}
|
||||
* </ul>
|
||||
*
|
||||
* <p>Write methods consist of:
|
||||
* <ul>
|
||||
* <li>{@link #write(Object)}
|
||||
* <li>{@link #write(Object, long timeout, TimeUnit unit)}
|
||||
* <li>{@link #halfClose()}
|
||||
* </ul>
|
||||
*
|
||||
* @param <ReqT> Type of the Request Message
|
||||
* @param <RespT> Type of the Response Message
|
||||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public final class BlockingClientCall<ReqT, RespT> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(BlockingClientCall.class.getName());
|
||||
|
||||
private final BlockingQueue<RespT> buffer;
|
||||
private final ClientCall<ReqT, RespT> call;
|
||||
|
||||
private final ThreadSafeThreadlessExecutor executor;
|
||||
|
||||
private boolean writeClosed;
|
||||
private volatile Status closedStatus; // null if not closed
|
||||
|
||||
BlockingClientCall(ClientCall<ReqT, RespT> call, ThreadSafeThreadlessExecutor executor) {
|
||||
this.call = call;
|
||||
this.executor = executor;
|
||||
buffer = new ArrayBlockingQueue<>(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait if necessary for a value to be available from the server. If there is an available value
|
||||
* return it immediately, if the stream is closed return a null. Otherwise, wait for a value to be
|
||||
* available or the stream to be closed
|
||||
*
|
||||
* @return value from server or null if stream has been closed
|
||||
* @throws StatusException If the stream has closed in an error state
|
||||
*/
|
||||
public RespT read() throws InterruptedException, StatusException {
|
||||
try {
|
||||
return read(true, 0, TimeUnit.NANOSECONDS);
|
||||
} catch (TimeoutException e) {
|
||||
throw new AssertionError("should never happen", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait with timeout, if necessary, for a value to be available from the server. If there is an
|
||||
* available value, return it immediately. If the stream is closed return a null. Otherwise, wait
|
||||
* for a value to be available, the stream to be closed or the timeout to expire.
|
||||
*
|
||||
* @param timeout how long to wait before giving up. Values <= 0 are no wait
|
||||
* @param unit a TimeUnit determining how to interpret the timeout parameter
|
||||
* @return value from server or null (if stream has been closed)
|
||||
* @throws TimeoutException if no read becomes ready before the specified timeout expires
|
||||
* @throws StatusException If the stream has closed in an error state
|
||||
*/
|
||||
public RespT read(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException,
|
||||
StatusException {
|
||||
return read(false, timeout, unit);
|
||||
}
|
||||
|
||||
private RespT read(boolean waitForever, long timeout, TimeUnit unit)
|
||||
throws InterruptedException, TimeoutException, StatusException {
|
||||
long start = System.nanoTime();
|
||||
long end = start + unit.toNanos(timeout);
|
||||
|
||||
Predicate<BlockingClientCall<ReqT, RespT>> predicate = BlockingClientCall::skipWaitingForRead;
|
||||
executor.waitAndDrainWithTimeout(waitForever, end, predicate, this);
|
||||
RespT bufferedValue = buffer.poll();
|
||||
|
||||
if (logger.isLoggable(Level.FINER)) {
|
||||
logger.finer("Client Blocking read had value: " + bufferedValue);
|
||||
}
|
||||
|
||||
Status currentClosedStatus;
|
||||
if (bufferedValue != null) {
|
||||
call.request(1);
|
||||
return bufferedValue;
|
||||
} else if ((currentClosedStatus = closedStatus) == null) {
|
||||
throw new IllegalStateException(
|
||||
"The message disappeared... are you reading from multiple threads?");
|
||||
} else if (!currentClosedStatus.isOk()) {
|
||||
throw currentClosedStatus.asException();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
boolean skipWaitingForRead() {
|
||||
return closedStatus != null || !buffer.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a value to be available from the server. If there is an
|
||||
* available value, return true immediately. If the stream was closed with Status.OK, return
|
||||
* false. If the stream was closed with an error status, throw a StatusException. Otherwise, wait
|
||||
* for a value to be available or the stream to be closed.
|
||||
*
|
||||
* @return True when there is a value to read. Return false if stream closed cleanly.
|
||||
* @throws StatusException If the stream was closed in an error state
|
||||
*/
|
||||
public boolean hasNext() throws InterruptedException, StatusException {
|
||||
executor.waitAndDrain((x) -> !x.buffer.isEmpty() || x.closedStatus != null, this);
|
||||
|
||||
Status currentClosedStatus = closedStatus;
|
||||
if (currentClosedStatus != null && !currentClosedStatus.isOk()) {
|
||||
throw currentClosedStatus.asException();
|
||||
}
|
||||
|
||||
return !buffer.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a value to the stream for sending to server, wait if necessary for the grpc stream to be
|
||||
* ready.
|
||||
*
|
||||
* <p>If write is not legal at the time of call, immediately returns false
|
||||
*
|
||||
* <p><br><b>NOTE: </b>This method will return as soon as it passes the request to the grpc stream
|
||||
* layer. It will not block while the message is being sent on the wire and returning true does
|
||||
* not guarantee that the server gets the message.
|
||||
*
|
||||
* <p><br><b>WARNING: </b>Doing only writes without reads can lead to deadlocks. This is because
|
||||
* flow control, imposed by networks to protect intermediary routers and endpoints that are
|
||||
* operating under resource constraints, requires reads to be done in order to progress writes.
|
||||
* Furthermore, the server closing the stream will only be identified after
|
||||
* the last sent value is read.
|
||||
*
|
||||
* @param request Message to send to the server
|
||||
* @return true if the request is sent to stream, false if skipped
|
||||
* @throws StatusException If the stream has closed in an error state
|
||||
*/
|
||||
public boolean write(ReqT request) throws InterruptedException, StatusException {
|
||||
try {
|
||||
return write(true, request, Integer.MAX_VALUE, TimeUnit.DAYS);
|
||||
} catch (TimeoutException e) {
|
||||
throw new RuntimeException(e); // should never happen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a value to the stream for sending to server, wait if necessary for the grpc stream to be
|
||||
* ready up to specified timeout.
|
||||
*
|
||||
* <p>If write is not legal at the time of call, immediately returns false
|
||||
*
|
||||
* <p><br><b>NOTE: </b>This method will return as soon as it passes the request to the grpc stream
|
||||
* layer. It will not block while the message is being sent on the wire and returning true does
|
||||
* not guarantee that the server gets the message.
|
||||
*
|
||||
* <p><br><b>WARNING: </b>Doing only writes without reads can lead to deadlocks as a result of
|
||||
* flow control. Furthermore, the server closing the stream will only be identified after the
|
||||
* last sent value is read.
|
||||
*
|
||||
* @param request Message to send to the server
|
||||
* @param timeout How long to wait before giving up. Values <= 0 are no wait
|
||||
* @param unit A TimeUnit determining how to interpret the timeout parameter
|
||||
* @return true if the request is sent to stream, false if skipped
|
||||
* @throws TimeoutException if write does not become ready before the specified timeout expires
|
||||
* @throws StatusException If the stream has closed in an error state
|
||||
*/
|
||||
public boolean write(ReqT request, long timeout, TimeUnit unit)
|
||||
throws InterruptedException, TimeoutException, StatusException {
|
||||
return write(false, request, timeout, unit);
|
||||
}
|
||||
|
||||
private boolean write(boolean waitForever, ReqT request, long timeout, TimeUnit unit)
|
||||
throws InterruptedException, TimeoutException, StatusException {
|
||||
|
||||
if (writeClosed) {
|
||||
throw new IllegalStateException("Writes cannot be done after calling halfClose or cancel");
|
||||
}
|
||||
|
||||
long end = System.nanoTime() + unit.toNanos(timeout);
|
||||
|
||||
Predicate<BlockingClientCall<ReqT, RespT>> predicate =
|
||||
(x) -> x.call.isReady() || x.closedStatus != null;
|
||||
executor.waitAndDrainWithTimeout(waitForever, end, predicate, this);
|
||||
Status savedClosedStatus = closedStatus;
|
||||
if (savedClosedStatus == null) {
|
||||
call.sendMessage(request);
|
||||
return true;
|
||||
} else if (savedClosedStatus.isOk()) {
|
||||
return false;
|
||||
} else {
|
||||
// Propagate any errors returned from the server
|
||||
throw savedClosedStatus.asException();
|
||||
}
|
||||
}
|
||||
|
||||
void sendSingleRequest(ReqT request) {
|
||||
call.sendMessage(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel stream and stop any further writes. Note that some reads that are in flight may still
|
||||
* happen after the cancel.
|
||||
*
|
||||
* @param message if not {@code null}, will appear as the description of the CANCELLED status
|
||||
* @param cause if not {@code null}, will appear as the cause of the CANCELLED status
|
||||
*/
|
||||
public void cancel(String message, Throwable cause) {
|
||||
writeClosed = true;
|
||||
call.cancel(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that no more writes will be done and the stream will be closed from the client side.
|
||||
*
|
||||
* @see ClientCall#halfClose()
|
||||
*/
|
||||
public void halfClose() {
|
||||
if (writeClosed) {
|
||||
throw new IllegalStateException(
|
||||
"halfClose cannot be called after already half closed or cancelled");
|
||||
}
|
||||
|
||||
writeClosed = true;
|
||||
call.halfClose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Status that server sent when closing channel from its side.
|
||||
*
|
||||
* @return null if stream not closed by server, otherwise Status sent by server
|
||||
*/
|
||||
@VisibleForTesting
|
||||
Status getClosedStatus() {
|
||||
drainQuietly();
|
||||
return closedStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for whether some action is ready.
|
||||
*
|
||||
* @return True if legal to write and writeOrRead can run without blocking
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isEitherReadOrWriteReady() {
|
||||
return (isWriteLegal() && isWriteReady()) || isReadReady();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there are any values waiting to be read.
|
||||
*
|
||||
* @return true if read will not block
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isReadReady() {
|
||||
drainQuietly();
|
||||
|
||||
return !buffer.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that write hasn't been marked complete and stream is ready to receive a write (so will
|
||||
* not block).
|
||||
*
|
||||
* @return true if legal to write and write will not block
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isWriteReady() {
|
||||
drainQuietly();
|
||||
|
||||
return isWriteLegal() && call.isReady();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we'll ever be able to do writes or should terminate.
|
||||
* @return True if writes haven't been closed and the server hasn't closed the stream
|
||||
*/
|
||||
private boolean isWriteLegal() {
|
||||
return !writeClosed && closedStatus == null;
|
||||
}
|
||||
|
||||
ClientCall.Listener<RespT> getListener() {
|
||||
return new QueuingListener();
|
||||
}
|
||||
|
||||
private void drainQuietly() {
|
||||
try {
|
||||
executor.drain();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
private final class QueuingListener extends ClientCall.Listener<RespT> {
|
||||
@Override
|
||||
public void onMessage(RespT value) {
|
||||
Preconditions.checkState(closedStatus == null, "ClientCall already closed");
|
||||
buffer.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Status status, Metadata trailers) {
|
||||
Preconditions.checkState(closedStatus == null, "ClientCall already closed");
|
||||
closedStatus = status;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -22,12 +22,14 @@ import static com.google.common.base.Preconditions.checkState;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.util.concurrent.AbstractFuture;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.Channel;
|
||||
import io.grpc.ClientCall;
|
||||
import io.grpc.ExperimentalApi;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
import io.grpc.Status;
|
||||
|
|
@ -42,9 +44,14 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
|
|
@ -184,7 +191,6 @@ public final class ClientCalls {
|
|||
*
|
||||
* @return an iterator over the response stream.
|
||||
*/
|
||||
// TODO(louiscryan): Not clear if we want to use this idiom for 'simple' stubs.
|
||||
public static <ReqT, RespT> Iterator<RespT> blockingServerStreamingCall(
|
||||
ClientCall<ReqT, RespT> call, ReqT req) {
|
||||
BlockingResponseStream<RespT> result = new BlockingResponseStream<>(call);
|
||||
|
|
@ -194,11 +200,12 @@ public final class ClientCalls {
|
|||
|
||||
/**
|
||||
* Executes a server-streaming call returning a blocking {@link Iterator} over the
|
||||
* response stream. The {@code call} should not be already started. After calling this method,
|
||||
* {@code call} should no longer be used.
|
||||
* response stream.
|
||||
*
|
||||
* <p>The returned iterator may throw {@link StatusRuntimeException} on error.
|
||||
*
|
||||
* <p>Warning: the iterator can result in leaks if not completely consumed.
|
||||
*
|
||||
* @return an iterator over the response stream.
|
||||
*/
|
||||
public static <ReqT, RespT> Iterator<RespT> blockingServerStreamingCall(
|
||||
|
|
@ -211,6 +218,82 @@ public final class ClientCalls {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a client streaming call over the specified channel. It returns an
|
||||
* object which can be used in a blocking manner to retrieve responses..
|
||||
*
|
||||
* <p>The methods {@link BlockingClientCall#hasNext()} and {@link
|
||||
* BlockingClientCall#cancel(String, Throwable)} can be used for more extensive control.
|
||||
*
|
||||
* @return A {@link BlockingClientCall} that has had the request sent and halfClose called
|
||||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public static <ReqT, RespT> BlockingClientCall<ReqT, RespT> blockingV2ServerStreamingCall(
|
||||
Channel channel, MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, ReqT req) {
|
||||
BlockingClientCall<ReqT, RespT> call =
|
||||
blockingBidiStreamingCall(channel, method, callOptions);
|
||||
|
||||
call.sendSingleRequest(req);
|
||||
call.halfClose();
|
||||
return call;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a server streaming call and sends the specified request to the server. It returns an
|
||||
* object which can be used in a blocking manner to retrieve values from the server. After the
|
||||
* last value has been read, the next read call will return null.
|
||||
*
|
||||
* <p>Call {@link BlockingClientCall#read()} for
|
||||
* retrieving values. A {@code null} will be returned after the server has closed the stream.
|
||||
*
|
||||
* <p>The methods {@link BlockingClientCall#hasNext()} and {@link
|
||||
* BlockingClientCall#cancel(String, Throwable)} can be used for more extensive control.
|
||||
*
|
||||
* <p><br> Example usage:
|
||||
* <pre> {@code while ((response = call.read()) != null) { ... } } </pre>
|
||||
* or
|
||||
* <pre> {@code
|
||||
* while (call.hasNext()) {
|
||||
* response = call.read();
|
||||
* ...
|
||||
* }
|
||||
* } </pre>
|
||||
*
|
||||
* <p>Note that this paradigm is different from the original
|
||||
* {@link #blockingServerStreamingCall(Channel, MethodDescriptor, CallOptions, Object)}
|
||||
* which returns an iterator, which would leave the stream open if not completely consumed.
|
||||
*
|
||||
* @return A {@link BlockingClientCall} which can be used by the client to write and receive
|
||||
* messages over the grpc channel.
|
||||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public static <ReqT, RespT> BlockingClientCall<ReqT, RespT> blockingClientStreamingCall(
|
||||
Channel channel, MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) {
|
||||
return blockingBidiStreamingCall(channel, method, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a bidirectional-streaming {@link ClientCall} and returning a stream object
|
||||
* ({@link BlockingClientCall}) which can be used by the client to send and receive messages over
|
||||
* the grpc channel.
|
||||
*
|
||||
* @return an object representing the call which can be used to read, write and terminate it.
|
||||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public static <ReqT, RespT> BlockingClientCall<ReqT, RespT> blockingBidiStreamingCall(
|
||||
Channel channel, MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) {
|
||||
ThreadSafeThreadlessExecutor executor = new ThreadSafeThreadlessExecutor();
|
||||
ClientCall<ReqT, RespT> call = channel.newCall(method, callOptions.withExecutor(executor));
|
||||
|
||||
BlockingClientCall<ReqT, RespT> blockingClientCall = new BlockingClientCall<>(call, executor);
|
||||
|
||||
// Get the call started
|
||||
call.start(blockingClientCall.getListener(), new Metadata());
|
||||
call.request(1);
|
||||
|
||||
return blockingClientCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a unary call and returns a {@link ListenableFuture} to the response. The
|
||||
* {@code call} should not be already started. After calling this method, {@code call} should no
|
||||
|
|
@ -414,7 +497,7 @@ public final class ClientCalls {
|
|||
public void request(int count) {
|
||||
if (!streamingResponse && count == 1) {
|
||||
// Initially ask for two responses from flow-control so that if a misbehaving server
|
||||
// sends more than one responses, we can catch it and fail it in the listener.
|
||||
// sends more than one response, we can catch it and fail it in the listener.
|
||||
call.request(2);
|
||||
} else {
|
||||
call.request(count);
|
||||
|
|
@ -637,7 +720,7 @@ public final class ClientCalls {
|
|||
public T next() {
|
||||
// Eagerly call request(1) so it can be processing the next message while we wait for the
|
||||
// current one, which reduces latency for the next message. With MigratingThreadDeframer and
|
||||
// if the data has already been recieved, every other message can be delivered instantly. This
|
||||
// if the data has already been received, every other message can be delivered instantly. This
|
||||
// can be run after hasNext(), but just would be slower.
|
||||
if (!(last instanceof StatusRuntimeException) && last != this) {
|
||||
call.request(1);
|
||||
|
|
@ -726,6 +809,12 @@ public final class ClientCalls {
|
|||
} while ((runnable = poll()) != null);
|
||||
}
|
||||
|
||||
private static void throwIfInterrupted() throws InterruptedException {
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after final call to {@link #waitAndDrain()}, from same thread.
|
||||
*/
|
||||
|
|
@ -745,12 +834,6 @@ public final class ClientCalls {
|
|||
}
|
||||
}
|
||||
|
||||
private static void throwIfInterrupted() throws InterruptedException {
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable runnable) {
|
||||
add(runnable);
|
||||
|
|
@ -763,6 +846,131 @@ public final class ClientCalls {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
static final class ThreadSafeThreadlessExecutor extends ConcurrentLinkedQueue<Runnable>
|
||||
implements Executor {
|
||||
private static final Logger log =
|
||||
Logger.getLogger(ThreadSafeThreadlessExecutor.class.getName());
|
||||
|
||||
private final Lock waiterLock = new ReentrantLock();
|
||||
private final Condition waiterCondition = waiterLock.newCondition();
|
||||
|
||||
// Non private to avoid synthetic class
|
||||
ThreadSafeThreadlessExecutor() {}
|
||||
|
||||
/**
|
||||
* Waits until there is a Runnable, then executes it and all queued Runnables after it.
|
||||
*/
|
||||
public <T> void waitAndDrain(Predicate<T> predicate, T testTarget) throws InterruptedException {
|
||||
try {
|
||||
waitAndDrainWithTimeout(true, 0, predicate, testTarget);
|
||||
} catch (TimeoutException e) {
|
||||
throw new AssertionError(e); // Should never happen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for up to specified nanoseconds until there is a Runnable, then executes it and all
|
||||
* queued Runnables after it.
|
||||
*
|
||||
* <p>his should always be called in a loop that checks whether the reason we are waiting has
|
||||
* been satisfied.</p>T
|
||||
*
|
||||
* @param waitForever ignore the rest of the arguments and wait until there is a task to run
|
||||
* @param end System.nanoTime() to stop waiting if haven't been woken up yet
|
||||
* @param predicate non-null condition to test for skipping wake or waking up threads
|
||||
* @param testTarget object to pass to predicate
|
||||
*/
|
||||
public <T> void waitAndDrainWithTimeout(boolean waitForever, long end,
|
||||
@Nonnull Predicate<T> predicate, T testTarget)
|
||||
throws InterruptedException, TimeoutException {
|
||||
throwIfInterrupted();
|
||||
Runnable runnable;
|
||||
|
||||
while (!predicate.apply(testTarget)) {
|
||||
waiterLock.lock();
|
||||
try {
|
||||
while ((runnable = poll()) == null) {
|
||||
if (predicate.apply(testTarget)) {
|
||||
return; // The condition for which we were waiting is now satisfied
|
||||
}
|
||||
|
||||
if (waitForever) {
|
||||
waiterCondition.await();
|
||||
} else {
|
||||
long waitNanos = end - System.nanoTime();
|
||||
if (waitNanos <= 0) {
|
||||
throw new TimeoutException(); // Deadline is expired
|
||||
}
|
||||
waiterCondition.awaitNanos(waitNanos);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
waiterLock.unlock();
|
||||
}
|
||||
|
||||
do {
|
||||
runQuietly(runnable);
|
||||
} while ((runnable = poll()) != null);
|
||||
// Wake everything up now that we've done something and they can check in their outer loop
|
||||
// if they can continue or need to wait again.
|
||||
signallAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all queued Runnables and if there were any wakes up any waiting threads.
|
||||
*/
|
||||
public void drain() throws InterruptedException {
|
||||
throwIfInterrupted();
|
||||
Runnable runnable;
|
||||
boolean didWork = false;
|
||||
|
||||
while ((runnable = poll()) != null) {
|
||||
runQuietly(runnable);
|
||||
didWork = true;
|
||||
}
|
||||
|
||||
if (didWork) {
|
||||
signallAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void signallAll() {
|
||||
waiterLock.lock();
|
||||
try {
|
||||
waiterCondition.signalAll();
|
||||
} finally {
|
||||
waiterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private static void runQuietly(Runnable runnable) {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
log.log(Level.WARNING, "Runnable threw exception", t);
|
||||
}
|
||||
}
|
||||
|
||||
private static void throwIfInterrupted() throws InterruptedException {
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable runnable) {
|
||||
waiterLock.lock();
|
||||
try {
|
||||
add(runnable);
|
||||
waiterCondition.signalAll(); // If anything is waiting let it wake up and process this task
|
||||
} finally {
|
||||
waiterLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum StubType {
|
||||
BLOCKING, FUTURE, ASYNC
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,520 @@
|
|||
/*
|
||||
* Copyright 2023 The gRPC Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.grpc.stub;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.MethodDescriptor;
|
||||
import io.grpc.MethodDescriptor.MethodType;
|
||||
import io.grpc.Server;
|
||||
import io.grpc.ServerServiceDefinition;
|
||||
import io.grpc.ServiceDescriptor;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.Status.Code;
|
||||
import io.grpc.StatusException;
|
||||
import io.grpc.inprocess.InProcessChannelBuilder;
|
||||
import io.grpc.inprocess.InProcessServerBuilder;
|
||||
import io.grpc.stub.ServerCalls.BidiStreamingMethod;
|
||||
import io.grpc.stub.ServerCallsTest.IntegerMarshaller;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Logger;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class BlockingClientCallTest {
|
||||
private static final Logger logger = Logger.getLogger(BlockingClientCallTest.class.getName());
|
||||
|
||||
public static final int DELAY_MILLIS = 2000;
|
||||
public static final long DELAY_NANOS = TimeUnit.MILLISECONDS.toNanos(DELAY_MILLIS);
|
||||
private static final MethodDescriptor<Integer, Integer> BIDI_STREAMING_METHOD =
|
||||
MethodDescriptor.<Integer, Integer>newBuilder()
|
||||
.setType(MethodType.BIDI_STREAMING)
|
||||
.setFullMethodName("some/method")
|
||||
.setRequestMarshaller(new IntegerMarshaller())
|
||||
.setResponseMarshaller(new IntegerMarshaller())
|
||||
.build();
|
||||
|
||||
private Server server;
|
||||
|
||||
private ManagedChannel channel;
|
||||
|
||||
private IntegerTestMethod testMethod;
|
||||
private BlockingClientCall<Integer, Integer> biDiStream;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
testMethod = new IntegerTestMethod();
|
||||
|
||||
ServerServiceDefinition service = ServerServiceDefinition.builder(
|
||||
new ServiceDescriptor("some", BIDI_STREAMING_METHOD))
|
||||
.addMethod(BIDI_STREAMING_METHOD, ServerCalls.asyncBidiStreamingCall(testMethod))
|
||||
.build();
|
||||
long tag = System.nanoTime();
|
||||
|
||||
server = InProcessServerBuilder.forName("go-with-the-flow" + tag).directExecutor()
|
||||
.addService(service).build().start();
|
||||
|
||||
channel = InProcessChannelBuilder.forName("go-with-the-flow" + tag).directExecutor().build();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (server != null) {
|
||||
server.shutdownNow();
|
||||
}
|
||||
if (channel != null) {
|
||||
channel.shutdownNow();
|
||||
}
|
||||
if (biDiStream != null) {
|
||||
biDiStream.cancel("In teardown", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sanityTest() throws Exception {
|
||||
Integer req = 2;
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// verify activity ready
|
||||
assertTrue(biDiStream.isEitherReadOrWriteReady());
|
||||
assertTrue(biDiStream.isWriteReady());
|
||||
|
||||
// Have server send a value
|
||||
testMethod.sendValueToClient(10);
|
||||
|
||||
// Do a writeOrRead
|
||||
biDiStream.write(req, 3, TimeUnit.SECONDS);
|
||||
assertEquals(Integer.valueOf(10), biDiStream.read(DELAY_MILLIS, TimeUnit.MILLISECONDS));
|
||||
|
||||
// mark complete
|
||||
biDiStream.halfClose();
|
||||
assertNull(biDiStream.read(2, TimeUnit.SECONDS));
|
||||
|
||||
// verify activity !ready and !writeable
|
||||
assertFalse(biDiStream.isEitherReadOrWriteReady());
|
||||
assertFalse(biDiStream.isWriteReady());
|
||||
|
||||
assertEquals(Code.OK, biDiStream.getClosedStatus().getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSuccess_withoutBlocking() throws Exception {
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// Have server push a value
|
||||
testMethod.sendValueToClient(11);
|
||||
|
||||
long start = System.nanoTime();
|
||||
Integer value = biDiStream.read(100, TimeUnit.SECONDS);
|
||||
assertNotNull(value);
|
||||
long timeTaken = System.nanoTime() - start;
|
||||
assertThat(timeTaken).isLessThan(TimeUnit.MILLISECONDS.toNanos(100));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSuccess_withBlocking() throws Exception {
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
try {
|
||||
biDiStream.read(1, TimeUnit.SECONDS);
|
||||
fail("Expected timeout");
|
||||
} catch (TimeoutException t) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
long start = System.nanoTime();
|
||||
delayedAddValue(DELAY_MILLIS, 12);
|
||||
assertNotNull(biDiStream.read(DELAY_MILLIS * 2, TimeUnit.MILLISECONDS));
|
||||
long timeTaken = System.nanoTime() - start;
|
||||
assertThat(timeTaken).isGreaterThan(DELAY_NANOS);
|
||||
assertThat(timeTaken).isLessThan(DELAY_NANOS * 2);
|
||||
|
||||
start = System.nanoTime();
|
||||
Integer[] values = {13, 14, 15, 16};
|
||||
delayedAddValue(DELAY_MILLIS, values);
|
||||
for (Integer value : values) {
|
||||
Integer readValue = biDiStream.read(DELAY_MILLIS * 2, TimeUnit.MILLISECONDS);
|
||||
assertEquals(value, readValue);
|
||||
}
|
||||
timeTaken = System.nanoTime() - start;
|
||||
assertThat(timeTaken).isLessThan(DELAY_NANOS * 2);
|
||||
assertThat(timeTaken).isAtLeast(DELAY_NANOS);
|
||||
|
||||
start = System.nanoTime();
|
||||
delayedVoidMethod(100, testMethod::halfClose);
|
||||
assertNull(biDiStream.read(DELAY_MILLIS * 2, TimeUnit.MILLISECONDS));
|
||||
timeTaken = System.nanoTime() - start;
|
||||
assertThat(timeTaken).isLessThan(DELAY_NANOS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCancel() throws Exception {
|
||||
testMethod.disableAutoRequest();
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// read terminated
|
||||
long start = System.currentTimeMillis();
|
||||
delayedCancel(biDiStream, "cancel read");
|
||||
try {
|
||||
assertNull(biDiStream.read(2 * DELAY_MILLIS, TimeUnit.MILLISECONDS));
|
||||
fail("No exception thrown by read after cancel");
|
||||
} catch (StatusException e) {
|
||||
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(2 * DELAY_MILLIS);
|
||||
}
|
||||
|
||||
// write terminated
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
start = System.currentTimeMillis();
|
||||
delayedCancel(biDiStream, "cancel write");
|
||||
|
||||
// Write interrupted by cancel
|
||||
try {
|
||||
assertFalse(biDiStream.write(30)); // this is interrupted by cancel
|
||||
fail("No exception thrown when write was interrupted by cancel");
|
||||
} catch (StatusException e) {
|
||||
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
|
||||
}
|
||||
|
||||
// Write after cancel
|
||||
try {
|
||||
start = System.currentTimeMillis();
|
||||
biDiStream.write(30);
|
||||
fail("No exception doing write after cancel");
|
||||
} catch (IllegalStateException e) {
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(200);
|
||||
assertThat(e.getMessage()).contains("cancel");
|
||||
}
|
||||
|
||||
// new read after cancel immediately throws an exception
|
||||
try {
|
||||
start = System.currentTimeMillis();
|
||||
assertNull(biDiStream.read(2, TimeUnit.SECONDS));
|
||||
} catch (StatusException e) {
|
||||
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsActivityReady() throws Exception {
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// write only ready
|
||||
assertTrue(biDiStream.isEitherReadOrWriteReady());
|
||||
assertTrue(biDiStream.isWriteReady());
|
||||
assertFalse(biDiStream.isReadReady());
|
||||
|
||||
// both ready
|
||||
testMethod.sendValueToClient(40);
|
||||
assertTrue(biDiStream.isEitherReadOrWriteReady());
|
||||
assertTrue(biDiStream.isReadReady());
|
||||
assertTrue(biDiStream.isWriteReady());
|
||||
|
||||
// read only ready
|
||||
biDiStream.halfClose();
|
||||
assertTrue(biDiStream.isEitherReadOrWriteReady());
|
||||
assertTrue(biDiStream.isReadReady());
|
||||
assertFalse(biDiStream.isWriteReady());
|
||||
|
||||
// Neither ready
|
||||
assertNotNull(biDiStream.read(1, TimeUnit.MILLISECONDS));
|
||||
assertFalse(biDiStream.isEitherReadOrWriteReady());
|
||||
assertFalse(biDiStream.isReadReady());
|
||||
assertFalse(biDiStream.isWriteReady());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteSuccess_withBlocking() throws Exception {
|
||||
testMethod.disableAutoRequest();
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
assertFalse(biDiStream.isWriteReady());
|
||||
delayedWriteEnable(500);
|
||||
assertTrue(biDiStream.write(40));
|
||||
|
||||
delayedWriteEnable(500);
|
||||
assertTrue(biDiStream.write(41, 0, TimeUnit.NANOSECONDS));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testReadNonblocking_whenWriteBlocked() throws Exception {
|
||||
testMethod.disableAutoRequest();
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// One value waiting
|
||||
testMethod.sendValueToClient(50);
|
||||
long start = System.currentTimeMillis();
|
||||
assertEquals(Integer.valueOf(50), biDiStream.read());
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(DELAY_MILLIS);
|
||||
|
||||
// Two values waiting
|
||||
start = System.currentTimeMillis();
|
||||
testMethod.sendValuesToClient(51, 52);
|
||||
assertEquals(Integer.valueOf(51), biDiStream.read());
|
||||
assertEquals(Integer.valueOf(52), biDiStream.read());
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(DELAY_MILLIS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadsAndWritesInterleaved_withBlocking() throws Exception {
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
Integer[] valuesOut = {1001, 10022, 1003};
|
||||
Integer[] valuesIn = new Integer[valuesOut.length];
|
||||
delayedAddValue(300, valuesOut);
|
||||
int iteration = 0;
|
||||
for (int i = 0; i < valuesOut.length && iteration++ < (20 + valuesOut.length); ) {
|
||||
try {
|
||||
if ((valuesIn[i] = biDiStream.read(50, TimeUnit.MILLISECONDS)) != null) {
|
||||
i++;
|
||||
}
|
||||
} catch (TimeoutException e) {
|
||||
logger.info("Read timed out for " + i);
|
||||
}
|
||||
}
|
||||
assertArrayEquals(valuesOut, valuesIn);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadsAndWritesInterleaved_BlockingWrites() throws Exception {
|
||||
testMethod.disableAutoRequest();
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
testMethod.sendValuesToClient(10, 11, 12);
|
||||
delayedWriteEnable(500);
|
||||
long start = System.currentTimeMillis();
|
||||
boolean done = false;
|
||||
int count = 0;
|
||||
while (!done) {
|
||||
count++;
|
||||
if (!biDiStream.isWriteReady() && biDiStream.isReadReady()) {
|
||||
biDiStream.read(100, TimeUnit.MILLISECONDS);
|
||||
} else {
|
||||
done = biDiStream.write(100, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
assertEquals(4, count);
|
||||
assertThat(System.currentTimeMillis() - start).isLessThan(700);
|
||||
|
||||
testMethod.sendValuesToClient(20, 21, 22);
|
||||
delayedWriteEnable(100);
|
||||
while (!biDiStream.isWriteReady()) {
|
||||
Thread.sleep(20);
|
||||
}
|
||||
|
||||
assertTrue(biDiStream.write(1000, 2 * DELAY_MILLIS, TimeUnit.MILLISECONDS));
|
||||
|
||||
assertEquals(Integer.valueOf(20), biDiStream.read(200, TimeUnit.MILLISECONDS));
|
||||
assertEquals(Integer.valueOf(21), biDiStream.read(200, TimeUnit.MILLISECONDS));
|
||||
assertEquals(Integer.valueOf(22), biDiStream.read(200, TimeUnit.MILLISECONDS));
|
||||
try {
|
||||
Integer value = biDiStream.read(200, TimeUnit.MILLISECONDS);
|
||||
fail("Unexpected read success instead of timeout. Value was: " + value);
|
||||
} catch (TimeoutException ignore) {
|
||||
// ignore since expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteCompleted() throws Exception {
|
||||
testMethod.disableAutoRequest();
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
// Verify pending write released
|
||||
long start = System.currentTimeMillis();
|
||||
delayedVoidMethod(DELAY_MILLIS, biDiStream::halfClose);
|
||||
assertFalse(biDiStream.write(1)); // should block until writeComplete is triggered
|
||||
long end = System.currentTimeMillis();
|
||||
assertThat(end - start).isAtLeast(DELAY_MILLIS);
|
||||
|
||||
// verify new writes throw an illegalStateException
|
||||
try {
|
||||
assertFalse(biDiStream.write(2));
|
||||
fail("write did not throw an exception when called after halfClose");
|
||||
} catch (IllegalStateException e) {
|
||||
assertThat(e.getMessage()).containsMatch("after.*halfClose.*cancel");
|
||||
}
|
||||
|
||||
// verify pending write with timeout released
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
delayedVoidMethod(DELAY_MILLIS, biDiStream::halfClose);
|
||||
assertFalse(biDiStream.write(3, 2 * DELAY_MILLIS, TimeUnit.MILLISECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClose_withException() throws Exception {
|
||||
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
|
||||
CallOptions.DEFAULT);
|
||||
|
||||
String descr = "too many small numbers";
|
||||
testMethod.sendError(
|
||||
Status.FAILED_PRECONDITION.withDescription(descr).asRuntimeException());
|
||||
Status closedStatus = biDiStream.getClosedStatus();
|
||||
assertEquals(Code.FAILED_PRECONDITION, closedStatus.getCode());
|
||||
assertEquals(descr, closedStatus.getDescription());
|
||||
try {
|
||||
assertFalse(biDiStream.write(1));
|
||||
} catch (StatusException e) {
|
||||
assertThat(e.getMessage()).startsWith("FAILED_PRECONDITION");
|
||||
}
|
||||
}
|
||||
|
||||
private void delayedAddValue(int delayMillis, Integer... values) {
|
||||
new Thread("delayedAddValue " + values.length) {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(delayMillis);
|
||||
for (Integer cur : values) {
|
||||
testMethod.sendValueToClient(cur);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
public interface Thunk { void apply(); } // supports passing void method w/out args
|
||||
|
||||
private void delayedVoidMethod(int delayMillis, Thunk method) {
|
||||
new Thread("delayedHalfClose") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(delayMillis);
|
||||
method.apply();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
private void delayedWriteEnable(int delayMillis) {
|
||||
delayedVoidMethod(delayMillis, testMethod::readValueFromClient);
|
||||
}
|
||||
|
||||
private void delayedCancel(BlockingClientCall<Integer, Integer> biDiStream, String message) {
|
||||
new Thread("delayedCancel") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(BlockingClientCallTest.DELAY_MILLIS);
|
||||
biDiStream.cancel(message, new RuntimeException("Test requested close"));
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
private static class IntegerTestMethod implements BidiStreamingMethod<Integer, Integer> {
|
||||
boolean autoRequest = true;
|
||||
|
||||
void disableAutoRequest() {
|
||||
assertNull("Can't disable auto request after invoke has been called", serverCallObserver);
|
||||
autoRequest = false;
|
||||
}
|
||||
|
||||
ServerCallStreamObserver<Integer> serverCallObserver;
|
||||
|
||||
@Override
|
||||
public StreamObserver<Integer> invoke(StreamObserver<Integer> responseObserver) {
|
||||
serverCallObserver = (ServerCallStreamObserver<Integer>) responseObserver;
|
||||
if (!autoRequest) {
|
||||
serverCallObserver.disableAutoRequest();
|
||||
}
|
||||
|
||||
return new StreamObserver<Integer>() {
|
||||
@Override
|
||||
public void onNext(Integer value) {
|
||||
if (!autoRequest) {
|
||||
serverCallObserver.request(1);
|
||||
}
|
||||
|
||||
// For testing ReqResp actions
|
||||
if (value > 1000) {
|
||||
serverCallObserver.onNext(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
serverCallObserver.onCompleted();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void readValueFromClient() {
|
||||
serverCallObserver.request(1);
|
||||
}
|
||||
|
||||
void sendValueToClient(int value) {
|
||||
serverCallObserver.onNext(value);
|
||||
}
|
||||
|
||||
private void sendValuesToClient(int ...values) {
|
||||
for (int cur : values) {
|
||||
sendValueToClient(cur);
|
||||
}
|
||||
}
|
||||
|
||||
void halfClose() {
|
||||
serverCallObserver.onCompleted();
|
||||
}
|
||||
|
||||
void sendError(Throwable t) {
|
||||
serverCallObserver.onError(t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -971,8 +971,8 @@ public class ClientCallsTest {
|
|||
}
|
||||
|
||||
@Override public void halfClose() {
|
||||
Thread.currentThread().interrupt();
|
||||
super.halfClose();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,6 +156,21 @@ public final class SimpleServiceGrpc {
|
|||
return SimpleServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static SimpleServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<SimpleServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<SimpleServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public SimpleServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new SimpleServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return SimpleServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -318,6 +333,72 @@ public final class SimpleServiceGrpc {
|
|||
* A simple service for test.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class SimpleServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<SimpleServiceBlockingV2Stub> {
|
||||
private SimpleServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected SimpleServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new SimpleServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Simple unary RPC.
|
||||
* </pre>
|
||||
*/
|
||||
public io.grpc.testing.protobuf.SimpleResponse unaryRpc(io.grpc.testing.protobuf.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getUnaryRpcMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Simple client-to-server streaming RPC.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>
|
||||
clientStreamingRpc() {
|
||||
return io.grpc.stub.ClientCalls.blockingClientStreamingCall(
|
||||
getChannel(), getClientStreamingRpcMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Simple server-to-client streaming RPC.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.protobuf.SimpleResponse>
|
||||
serverStreamingRpc(io.grpc.testing.protobuf.SimpleRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getServerStreamingRpcMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Simple bidirectional streaming RPC.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>
|
||||
bidiStreamingRpc() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getBidiStreamingRpcMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service SimpleService.
|
||||
* <pre>
|
||||
* A simple service for test.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class SimpleServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<SimpleServiceBlockingStub> {
|
||||
private SimpleServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -70,6 +70,21 @@ public final class OpenRcaServiceGrpc {
|
|||
return OpenRcaServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static OpenRcaServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<OpenRcaServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<OpenRcaServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public OpenRcaServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new OpenRcaServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return OpenRcaServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -191,6 +206,42 @@ public final class OpenRcaServiceGrpc {
|
|||
* a new call to change backend reporting frequency.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class OpenRcaServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<OpenRcaServiceBlockingV2Stub> {
|
||||
private OpenRcaServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected OpenRcaServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new OpenRcaServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<?, com.github.xds.data.orca.v3.OrcaLoadReport>
|
||||
streamCoreMetrics(com.github.xds.service.orca.v3.OrcaLoadReportRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall(
|
||||
getChannel(), getStreamCoreMetricsMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service OpenRcaService.
|
||||
* <pre>
|
||||
* Out-of-band (OOB) load reporting service for the additional load reporting
|
||||
* agent that does not sit in the request path. Reports are periodically sampled
|
||||
* with sufficient frequency to provide temporal association with requests.
|
||||
* OOB reporting compensates the limitation of in-band reporting in revealing
|
||||
* costs for backends that do not provide a steady stream of telemetry such as
|
||||
* long running stream operations and zero QPS services. This is a server
|
||||
* streaming service, client needs to terminate current RPC and initiate
|
||||
* a new call to change backend reporting frequency.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class OpenRcaServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<OpenRcaServiceBlockingStub> {
|
||||
private OpenRcaServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -99,6 +99,21 @@ public final class AggregatedDiscoveryServiceGrpc {
|
|||
return AggregatedDiscoveryServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static AggregatedDiscoveryServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AggregatedDiscoveryServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AggregatedDiscoveryServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public AggregatedDiscoveryServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AggregatedDiscoveryServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AggregatedDiscoveryServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -233,6 +248,52 @@ public final class AggregatedDiscoveryServiceGrpc {
|
|||
* the multiplexed singleton APIs at the Envoy instance and management server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class AggregatedDiscoveryServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AggregatedDiscoveryServiceBlockingV2Stub> {
|
||||
private AggregatedDiscoveryServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AggregatedDiscoveryServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AggregatedDiscoveryServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* This is a gRPC-only API.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>
|
||||
streamAggregatedResources() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamAggregatedResourcesMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.envoyproxy.envoy.service.discovery.v3.DeltaDiscoveryRequest, io.envoyproxy.envoy.service.discovery.v3.DeltaDiscoveryResponse>
|
||||
deltaAggregatedResources() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getDeltaAggregatedResourcesMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service AggregatedDiscoveryService.
|
||||
* <pre>
|
||||
* See https://github.com/envoyproxy/envoy-api#apis for a description of the role of
|
||||
* ADS and how it is intended to be used by a management server. ADS requests
|
||||
* have the same structure as their singleton xDS counterparts, but can
|
||||
* multiplex many resource types on a single stream. The type_url in the
|
||||
* DiscoveryRequest/DiscoveryResponse provides sufficient information to recover
|
||||
* the multiplexed singleton APIs at the Envoy instance and management server.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class AggregatedDiscoveryServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<AggregatedDiscoveryServiceBlockingStub> {
|
||||
private AggregatedDiscoveryServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ public final class LoadReportingServiceGrpc {
|
|||
return LoadReportingServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static LoadReportingServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<LoadReportingServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<LoadReportingServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public LoadReportingServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadReportingServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return LoadReportingServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -199,6 +214,61 @@ public final class LoadReportingServiceGrpc {
|
|||
/**
|
||||
* A stub to allow clients to do synchronous rpc calls to service LoadReportingService.
|
||||
*/
|
||||
public static final class LoadReportingServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadReportingServiceBlockingV2Stub> {
|
||||
private LoadReportingServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected LoadReportingServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new LoadReportingServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Advanced API to allow for multi-dimensional load balancing by remote
|
||||
* server. For receiving LB assignments, the steps are:
|
||||
* 1, The management server is configured with per cluster/zone/load metric
|
||||
* capacity configuration. The capacity configuration definition is
|
||||
* outside of the scope of this document.
|
||||
* 2. Envoy issues a standard {Stream,Fetch}Endpoints request for the clusters
|
||||
* to balance.
|
||||
* Independently, Envoy will initiate a StreamLoadStats bidi stream with a
|
||||
* management server:
|
||||
* 1. Once a connection establishes, the management server publishes a
|
||||
* LoadStatsResponse for all clusters it is interested in learning load
|
||||
* stats about.
|
||||
* 2. For each cluster, Envoy load balances incoming traffic to upstream hosts
|
||||
* based on per-zone weights and/or per-instance weights (if specified)
|
||||
* based on intra-zone LbPolicy. This information comes from the above
|
||||
* {Stream,Fetch}Endpoints.
|
||||
* 3. When upstream hosts reply, they optionally add header <define header
|
||||
* name> with ASCII representation of EndpointLoadMetricStats.
|
||||
* 4. Envoy aggregates load reports over the period of time given to it in
|
||||
* LoadStatsResponse.load_reporting_interval. This includes aggregation
|
||||
* stats Envoy maintains by itself (total_requests, rpc_errors etc.) as
|
||||
* well as load metrics from upstream hosts.
|
||||
* 5. When the timer of load_reporting_interval expires, Envoy sends new
|
||||
* LoadStatsRequest filled with load reports for each cluster.
|
||||
* 6. The management server uses the load reports from all reported Envoys
|
||||
* from around the world, computes global assignment and prepares traffic
|
||||
* assignment destined for each zone Envoys are located in. Goto 2.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.envoyproxy.envoy.service.load_stats.v3.LoadStatsRequest, io.envoyproxy.envoy.service.load_stats.v3.LoadStatsResponse>
|
||||
streamLoadStats() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamLoadStatsMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service LoadReportingService.
|
||||
*/
|
||||
public static final class LoadReportingServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<LoadReportingServiceBlockingStub> {
|
||||
private LoadReportingServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ public final class RateLimitQuotaServiceGrpc {
|
|||
return RateLimitQuotaServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static RateLimitQuotaServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<RateLimitQuotaServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public RateLimitQuotaServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new RateLimitQuotaServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return RateLimitQuotaServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -164,6 +179,39 @@ public final class RateLimitQuotaServiceGrpc {
|
|||
* Defines the Rate Limit Quota Service (RLQS).
|
||||
* </pre>
|
||||
*/
|
||||
public static final class RateLimitQuotaServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<RateLimitQuotaServiceBlockingV2Stub> {
|
||||
private RateLimitQuotaServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected RateLimitQuotaServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new RateLimitQuotaServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Main communication channel: the data plane sends usage reports to the RLQS server,
|
||||
* and the server asynchronously responding with the assignments.
|
||||
* </pre>
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaUsageReports, io.envoyproxy.envoy.service.rate_limit_quota.v3.RateLimitQuotaResponse>
|
||||
streamRateLimitQuotas() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamRateLimitQuotasMethod(), getCallOptions());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service RateLimitQuotaService.
|
||||
* <pre>
|
||||
* Defines the Rate Limit Quota Service (RLQS).
|
||||
* </pre>
|
||||
*/
|
||||
public static final class RateLimitQuotaServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<RateLimitQuotaServiceBlockingStub> {
|
||||
private RateLimitQuotaServiceBlockingStub(
|
||||
|
|
|
|||
|
|
@ -96,6 +96,21 @@ public final class ClientStatusDiscoveryServiceGrpc {
|
|||
return ClientStatusDiscoveryServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports all types of calls on the service
|
||||
*/
|
||||
public static ClientStatusDiscoveryServiceBlockingV2Stub newBlockingV2Stub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ClientStatusDiscoveryServiceBlockingV2Stub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ClientStatusDiscoveryServiceBlockingV2Stub>() {
|
||||
@java.lang.Override
|
||||
public ClientStatusDiscoveryServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ClientStatusDiscoveryServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ClientStatusDiscoveryServiceBlockingV2Stub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
|
|
@ -212,6 +227,44 @@ public final class ClientStatusDiscoveryServiceGrpc {
|
|||
* also be used to get the current xDS states directly from the client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ClientStatusDiscoveryServiceBlockingV2Stub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ClientStatusDiscoveryServiceBlockingV2Stub> {
|
||||
private ClientStatusDiscoveryServiceBlockingV2Stub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ClientStatusDiscoveryServiceBlockingV2Stub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ClientStatusDiscoveryServiceBlockingV2Stub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918")
|
||||
public io.grpc.stub.BlockingClientCall<io.envoyproxy.envoy.service.status.v3.ClientStatusRequest, io.envoyproxy.envoy.service.status.v3.ClientStatusResponse>
|
||||
streamClientStatus() {
|
||||
return io.grpc.stub.ClientCalls.blockingBidiStreamingCall(
|
||||
getChannel(), getStreamClientStatusMethod(), getCallOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.envoyproxy.envoy.service.status.v3.ClientStatusResponse fetchClientStatus(io.envoyproxy.envoy.service.status.v3.ClientStatusRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getFetchClientStatusMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A stub to allow clients to do llimited synchronous rpc calls to service ClientStatusDiscoveryService.
|
||||
* <pre>
|
||||
* CSDS is Client Status Discovery Service. It can be used to get the status of
|
||||
* an xDS-compliant client from the management server's point of view. It can
|
||||
* also be used to get the current xDS states directly from the client.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ClientStatusDiscoveryServiceBlockingStub
|
||||
extends io.grpc.stub.AbstractBlockingStub<ClientStatusDiscoveryServiceBlockingStub> {
|
||||
private ClientStatusDiscoveryServiceBlockingStub(
|
||||
|
|
|
|||
Loading…
Reference in New Issue