scwhittle commented on code in PR #32522:
URL: https://github.com/apache/beam/pull/32522#discussion_r1770962784


##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ProcessBundleHandler.java:
##########
@@ -1168,13 +1168,27 @@ void discard() {
         if (this.bundleCache != null) {
           this.bundleCache.clear();
         }
+        // setupFunction called in createBundleProcessor when 
BundleProcessorCache.get returns null.
+        // call teardownFunction here as the BundleProcessor is already 
removed from cache and isn't
+        // going to be re-used.
+        for (ThrowingRunnable teardownFunction : 
Lists.reverse(this.getTearDownFunctions())) {
+          try {
+            teardownFunction.run();

Review Comment:
   if we throw the exception above during one of the start functions we may not 
have called all of them.  That could be confusing since then finish could be 
called without corresponding start.  If we knew which start/teardown functions 
corresponeded (ie change to a single list with both matched up) we coudl 
remember the index we made it to on start functions to call teardown only on 
the right ones.



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