Abacn commented on code in PR #36616:
URL: https://github.com/apache/beam/pull/36616#discussion_r2475140288


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java:
##########
@@ -101,7 +100,7 @@ static void setStreamReadConstraints(JsonFactory 
jsonFactory, int sizeLimit) {
    * factory to higher limits. If needed, call this method during pipeline run 
time, e.g. in
    * DoFn.setup. This avoids a data race caused by modifying the global 
default settings.
    */
-  public static JsonFactory createJsonFactory(int sizeLimit) {
+  public static synchronized JsonFactory createJsonFactory(int sizeLimit) {

Review Comment:
   Shall we confine synchronize {} block only around 
`StreamReadConstraintsHelper.setStreamReadConstraints`?



##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java:
##########
@@ -51,21 +51,20 @@ public class RowJsonUtils {
    * overwrite the default buffer size limit to 100 MB, and exposes this 
interface for higher limit.
    * If needed, call this method during pipeline run time, e.g. in DoFn.setup.
    */
-  public static void increaseDefaultStreamReadConstraints(int newLimit) {
-    if (newLimit <= defaultBufferLimit) {
-      return;
+  public static synchronized void increaseDefaultStreamReadConstraints(int 
newLimit) {
+    if (newLimit > defaultBufferLimit) {
+      try {
+        Class.forName("com.fasterxml.jackson.core.StreamReadConstraints");

Review Comment:
   we can check STREAM_READ_CONSTRAINTS_AVAILABLE then return early and remove 
this try {} block



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to