Skip to content

Commit

Permalink
add sync block
Browse files Browse the repository at this point in the history
  • Loading branch information
sakthivelmanii committed Jan 6, 2025
1 parent cd417c6 commit 5546490
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ public void run() {
// Those result sets will trigger initiateProduceRows() when the first results are received.
// Non-streaming result sets do not trigger this callback, and for those result sets, we
// need to eagerly start the ProduceRowsRunnable.
synchronized (monitor) {
if (!(state == State.STREAMING_INITIALIZED)) {
return;
}
}
if (!initiateStreaming(AsyncResultSetImpl.this)) {
initiateProduceRows();
}
Expand All @@ -490,7 +495,6 @@ public ApiFuture<Void> setCallback(Executor exec, ReadyCallback cb) {
this.result = SettableApiFuture.create();
this.state = State.STREAMING_INITIALIZED;
this.service.execute(new InitiateStreamingRunnable());
// initiateProduceRows();
this.executor = MoreExecutors.newSequentialExecutor(Preconditions.checkNotNull(exec));
this.callback = Preconditions.checkNotNull(cb);
pausedLatch.countDown();
Expand Down

0 comments on commit 5546490

Please sign in to comment.