Skip to content

Commit 15a60d3

Browse files
Add more logs
1 parent 4237623 commit 15a60d3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/AsyncResultSetImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,14 @@ public void run() {
469469
// Non-streaming result sets do not trigger this callback, and for those result sets, we
470470
// need to eagerly start the ProduceRowsRunnable.
471471
synchronized (monitor) {
472-
if (state == State.RUNNING || state == State.CONSUMING) {
472+
if (state == State.STREAMING_INITIALIZED) {
473473
return;
474474
}
475-
}
476-
System.out.println("Initiate Streaming");
477-
if (!initiateStreaming(AsyncResultSetImpl.this)) {
478-
initiateProduceRows();
475+
state = State.STREAMING_INITIALIZED;
476+
System.out.printf("State: %s\n", state);
477+
if (!initiateStreaming(AsyncResultSetImpl.this)) {
478+
initiateProduceRows();
479+
}
479480
}
480481
} catch (Throwable exception) {
481482
executionException = SpannerExceptionFactory.asSpannerException(exception);
@@ -494,7 +495,6 @@ public ApiFuture<Void> setCallback(Executor exec, ReadyCallback cb) {
494495

495496
// Start to fetch data and buffer these.
496497
this.result = SettableApiFuture.create();
497-
this.state = State.STREAMING_INITIALIZED;
498498
this.service.execute(new InitiateStreamingRunnable());
499499
this.executor = MoreExecutors.newSequentialExecutor(Preconditions.checkNotNull(exec));
500500
this.callback = Preconditions.checkNotNull(cb);

0 commit comments

Comments
 (0)