Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidi Blocking Stub #10318

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
138c1ad
checkpoint
larry-safran Apr 14, 2023
9b2ab2a
Checkpoint
larry-safran Apr 25, 2023
fd26f23
Initial pass complete
larry-safran Apr 29, 2023
515c7c4
Change blockingWriteOrRead to be either/or rather than and/or.
larry-safran May 2, 2023
4e63935
Update javadoc and checking for write legality
larry-safran May 3, 2023
09095ae
Feedback from API review
larry-safran May 4, 2023
7d87f74
Generate blocking bidi stream method
larry-safran May 4, 2023
2fe79a9
Add generated method for bidi streaming
larry-safran May 4, 2023
b2de4c7
Restore BlockingServerStream's QueueingListener to the original.
larry-safran May 4, 2023
4f9ca2d
Fix tests and formatting
larry-safran May 4, 2023
70a1b1b
Implement example
larry-safran May 5, 2023
7fdb53a
example fixes
larry-safran May 5, 2023
d380b7d
Fixed while condition
larry-safran May 6, 2023
4dedccd
Checkpoint
larry-safran May 25, 2023
95b6b2f
Updated examples and removed the writeOrRead that was confusing.
larry-safran Jun 7, 2023
713d74a
Update interface to reflect latest conversations and make all tests w…
larry-safran Jun 9, 2023
60af084
Updates based upon design review.
larry-safran Jun 22, 2023
3bd8b8c
Fix test case.
larry-safran Jun 22, 2023
d747b82
Remove waitForReady.
larry-safran Jun 22, 2023
1b63ada
fix halfClose.
larry-safran Jun 22, 2023
7beeaf5
add padding to messages so that flow control actually happens on writ…
larry-safran Jun 24, 2023
d3a89d0
Fix style errors
larry-safran Jun 27, 2023
76f1892
Merge branch 'master' into blocking
larry-safran Jun 28, 2023
5593196
Add comment
larry-safran Jun 30, 2023
09226c8
Fix cancel test
larry-safran Jun 30, 2023
ef8d28a
Rename BlockingBiDiStream.java to BlockingClientCall
larry-safran Jul 1, 2023
5f9d701
Improve test reporting and increase delay amount to reduce flakes.
larry-safran Jul 11, 2023
fa3343d
Make test times all relative to DELAY_MILLIS so that can be changed w…
larry-safran Jul 12, 2023
2ff162e
Add a second blocking stub with a V2 to differentiate it from the exi…
larry-safran Jul 22, 2023
235a49b
Add android-interop generated Grpc files.
larry-safran Jul 22, 2023
d2dec86
Changed the generator to use '?' instead of request type for return v…
larry-safran Aug 31, 2023
2104a0f
Add methods to ClientCalls for both blocking client and server stream…
larry-safran Aug 31, 2023
6c06c90
Merge branch 'master' into blocking
larry-safran Aug 31, 2023
c08eb90
Fix the logic so that onReady is actually handled correctly
larry-safran Aug 31, 2023
75d894e
Merge branch 'blocking' of https://github.com/larry-safran/grpc-java …
larry-safran Aug 31, 2023
6921d6a
Fix listener handling of onReady
larry-safran Aug 31, 2023
7a62a5a
Remove generics from the listener.
larry-safran Sep 1, 2023
0252972
Respond to code review comments
larry-safran Oct 12, 2023
ee8d7d8
Rsstore ThreadlessExecutor to the way it was and use a new ThreadSafe…
larry-safran Dec 11, 2023
c245f75
Update stub/src/main/java/io/grpc/stub/ClientCalls.java
larry-safran Jan 9, 2024
5c70deb
Change locking logic in ThreadSafeThreadlessExecutor from using LockS…
larry-safran Jan 12, 2024
7cd0df6
Update javadoc to make it clear that flow control is a network thing.
larry-safran Jan 17, 2024
78d9ce0
Eliminate synchronized from waitAndDrain, just using waiterLock.
larry-safran Jan 18, 2024
0ac6ad6
Cleanup with Eric
larry-safran Jan 19, 2024
61ca3c8
Respond to Review comments. Need to update generated code to throw S…
larry-safran Feb 16, 2024
d379393
Add StatusException to the throws list of blockingV2ServerStreamingCall
larry-safran Feb 16, 2024
ed3809f
Updated generated code with StatusException for blockingV2ServerStrea…
larry-safran Feb 16, 2024
53a0766
Add missing generated classes
larry-safran Feb 17, 2024
05151ff
change StatusRuntimeException to StatusException in catch blocks
larry-safran Feb 17, 2024
244be52
Updated examples to handle blockingV2ServerStreamingCall throwing Sta…
larry-safran Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ public HandshakerServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOption
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
*/
Expand Down Expand Up @@ -157,6 +172,39 @@ public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandsh
/**
* A stub to allow clients to do synchronous rpc calls to service HandshakerService.
*/
public static final class HandshakerServiceBlockingV2Stub
extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingV2Stub> {
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
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>
*/
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ public LoadBalancerStatsServiceStub newStub(io.grpc.Channel channel, io.grpc.Cal
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
*/
Expand Down Expand Up @@ -212,6 +227,46 @@ public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadB
* 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ public MetricsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions c
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
*/
Expand Down Expand Up @@ -199,6 +214,46 @@ public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
/**
* 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>
*/
public io.grpc.stub.BlockingClientCall<?, io.grpc.testing.integration.Metrics.GaugeResponse>
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request) throws java.lang.InterruptedException,
io.grpc.StatusException {
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ public ReconnectServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions
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
*/
Expand Down Expand Up @@ -200,6 +215,40 @@ public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
* 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(
Expand Down