Skip to content

Commit

Permalink
Update to executeBlocking API change
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Jul 19, 2023
1 parent 11a1e73 commit 99de676
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ public void testServerStreamingBackPressure(TestContext should) throws IOExcepti
callResponse.pause();
AtomicInteger num = new AtomicInteger();
Runnable readBatch = () -> {
vertx.<Integer>executeBlocking(p -> {
vertx.<Integer>executeBlocking(() -> {
while (batchQueue.size() == 0) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
p.complete(batchQueue.poll());;
return batchQueue.poll();
}).onSuccess(toRead -> {
num.set(toRead);
callResponse.resume();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ public class GrpcContextStorageExamples {
public void example(Vertx vertx) {
Context grpcCtx1 = Context.current();

vertx.<String>executeBlocking(prom -> {
vertx.executeBlocking(() -> {

// Same as grpcCtx1
Context grpcCtx2 = Context.current();

String result = doSomething();
prom.complete(result);
return doSomething();

}).onComplete(ar -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ public void testGrpcContextPropagatedAcrossVertxAsyncCalls(TestContext should) {
GreeterGrpc.GreeterImplBase impl = new GreeterGrpc.GreeterImplBase() {
@Override
public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
vertx.<String>executeBlocking(prom -> {
prom.complete("Hello " + request.getName() + ", trace: " + traceContextKey.get());
}).onSuccess(greeting -> {
vertx.executeBlocking(() -> "Hello " + request.getName() + ", trace: " + traceContextKey.get()).onSuccess(greeting -> {
responseObserver.onNext(HelloReply.newBuilder().setMessage(greeting).build());
responseObserver.onCompleted();
}).onFailure(should::fail);
Expand Down

0 comments on commit 99de676

Please sign in to comment.