@@ -308,7 +308,8 @@ public void testDeadlineExceededErrorWithOneRetryWithParallelRequests()
308308 throws InterruptedException {
309309 mockSpanner .setCreateSessionExecutionTime (
310310 SimulatedExecutionTime .ofMinimumAndRandomTimeAndExceptions (
311- 2000 , 0 ,
311+ 2000 ,
312+ 0 ,
312313 Arrays .asList (
313314 Status .DEADLINE_EXCEEDED
314315 .withDescription (
@@ -326,24 +327,24 @@ public void testDeadlineExceededErrorWithOneRetryWithParallelRequests()
326327 (DatabaseClientImpl ) spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
327328 assertNotNull (client .multiplexedSessionDatabaseClient );
328329
329-
330330 ExecutorService executor = Executors .newCachedThreadPool ();
331331
332332 // First set of request should fail with an error
333333 CountDownLatch failureCountDownLatch = new CountDownLatch (3 );
334334 for (int i = 0 ; i < 3 ; i ++) {
335- executor .submit (() -> {
336- try {
337- try (ResultSet resultSet = client .singleUse ().executeQuery (STATEMENT )) {
338- //noinspection StatementWithEmptyBody
339- while (resultSet .next ()) {
340- // ignore
335+ executor .submit (
336+ () -> {
337+ try {
338+ try (ResultSet resultSet = client .singleUse ().executeQuery (STATEMENT )) {
339+ //noinspection StatementWithEmptyBody
340+ while (resultSet .next ()) {
341+ // ignore
342+ }
343+ }
344+ } catch (SpannerException e ) {
345+ failureCountDownLatch .countDown ();
341346 }
342- }
343- } catch (SpannerException e ) {
344- failureCountDownLatch .countDown ();
345- }
346- });
347+ });
347348 }
348349
349350 assertTrue (failureCountDownLatch .await (2 , TimeUnit .SECONDS ));
@@ -352,18 +353,19 @@ public void testDeadlineExceededErrorWithOneRetryWithParallelRequests()
352353 // Second set of requests should pass
353354 CountDownLatch countDownLatch = new CountDownLatch (3 );
354355 for (int i = 0 ; i < 3 ; i ++) {
355- executor .submit (() -> {
356- try {
357- try (ResultSet resultSet = client .singleUse ().executeQuery (STATEMENT )) {
358- //noinspection StatementWithEmptyBody
359- while (resultSet .next ()) {
360- // ignore
356+ executor .submit (
357+ () -> {
358+ try {
359+ try (ResultSet resultSet = client .singleUse ().executeQuery (STATEMENT )) {
360+ //noinspection StatementWithEmptyBody
361+ while (resultSet .next ()) {
362+ // ignore
363+ }
364+ }
365+ } catch (SpannerException e ) {
366+ countDownLatch .countDown ();
361367 }
362- }
363- } catch (SpannerException e ) {
364- countDownLatch .countDown ();
365- }
366- });
368+ });
367369 }
368370
369371 assertFalse (countDownLatch .await (3 , TimeUnit .SECONDS ));
0 commit comments