@@ -467,13 +467,12 @@ public void run() {
467
467
// GrpcResultSet).
468
468
// Those result sets will trigger initiateProduceRows() when the first results are received.
469
469
// Non-streaming result sets do not trigger this callback, and for those result sets, we
470
- // need to eagerly
471
- // start the ProduceRowsRunnable.
470
+ // need to eagerly start the ProduceRowsRunnable.
472
471
if (!initiateStreaming (AsyncResultSetImpl .this )) {
473
472
initiateProduceRows ();
474
473
}
475
- } catch (SpannerException e ) {
476
- executionException = e ;
474
+ } catch (Throwable exception ) {
475
+ executionException = SpannerExceptionFactory . asSpannerException ( exception ) ;
477
476
initiateProduceRows ();
478
477
}
479
478
}
@@ -499,11 +498,11 @@ public ApiFuture<Void> setCallback(Executor exec, ReadyCallback cb) {
499
498
}
500
499
501
500
private void initiateProduceRows () {
502
- this .service .execute (new ProduceRowsRunnable ());
503
501
if (this .state == State .STREAMING_INITIALIZED ) {
504
502
this .state = State .RUNNING ;
505
503
}
506
504
produceRowsInitiated = true ;
505
+ this .service .execute (new ProduceRowsRunnable ());
507
506
}
508
507
509
508
Future <Void > getResult () {
@@ -642,8 +641,8 @@ public void onStreamMessage(PartialResultSet partialResultSet, boolean bufferIsF
642
641
if (produceRowsInitiated ) {
643
642
return ;
644
643
}
645
- // if PartialResultSet contains resume token or buffer size is ful or
646
- // we have reached end of stream, we can start the thread
644
+ // if PartialResultSet contains a resume token or buffer size is full, or
645
+ // we have reached the end of the stream, we can start the thread.
647
646
boolean startJobThread =
648
647
!partialResultSet .getResumeToken ().isEmpty ()
649
648
|| bufferIsFull
0 commit comments