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


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/io/WriteFiles.java:
##########
@@ -996,10 +1001,18 @@ public void finishBundle(FinishBundleContext c) throws 
Exception {
           c.output(result.getValue(), result.getKey(), 
result.getValue().getWindow());
         }
       } finally {
-        deferredOutput = null;
-        closeFutures = null;
+        deferredOutput.clear();
+        closeFutures.clear();
       }
     }
+
+    // Ensure that transient fields are initialized.

Review Comment:
   Class constructor isn't involved during deserialization of the object and 
transient fields are always initialized to their defaults (e.g. int = 0, 
boolean = false, object = null, ...). This allows us to initialize the fields 
during deserialization to be a non null object.
   
   See https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html for 
more details.



-- 
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