You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2023/01/09 21:38:25 UTC

[GitHub] [beam] lukecwik commented on a diff in pull request #24950: [#21368] Re-apply single executor to storage write API writes

lukecwik commented on code in PR #24950:
URL: https://github.com/apache/beam/pull/24950#discussion_r1065129982


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java:
##########
@@ -1491,12 +1494,36 @@ private static BigQueryWriteClient newBigQueryWriteClient(BigQueryOptions option
       return BigQueryWriteClient.create(
           BigQueryWriteSettings.newBuilder()
               .setCredentialsProvider(() -> options.as(GcpOptions.class).getGcpCredential())
+              .setBackgroundExecutorProvider(new OptionsExecutionProvider(options))
               .build());
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
   }
 
+  /**
+   * OptionsExecutionProvider is a utility class used to wrap the Pipeline-wide {@link
+   * ScheduledExecutorService} into a supplier for the {@link BigQueryWriteClient}.
+   */
+  private static class OptionsExecutionProvider implements ExecutorProvider {

Review Comment:
   Consider using https://github.com/googleapis/gax-java/blob/47b9247a50347e9fd61ad5a9f5adaa4bdb757a26/gax/src/main/java/com/google/api/gax/core/FixedExecutorProvider.java#L54 instead of creating a class that is effectively a FixedExecutorProvider



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org