jacques-n commented on issue #1904: URL: https://github.com/apache/iceberg/issues/1904#issuecomment-742926538
For the original comment from @aokolnychyi , I've generally tried to address this using try-with-resources, which does a much better job of handling multiple exception cases natively then trying to build something functional. For example, we created [AutoCloseableLock](https://github.com/dremio/dremio-oss/blob/master/common/src/main/java/com/dremio/common/concurrent/AutoCloseableLock.java) to manage this particular locking situation. I also see it as somewhat of an anti-pattern in these complex scenarios to use finally blocks at all as it is too easy for people to make mistakes. The general problem being having multiple clean up tasks of any type. Instead, we typically would use multiple separate try-with-resources resource declarations or if you have more complex scenarios (returning a closeable only if several other operations succeed, each with their own rollback behavior, we created [RollbackCloseable](https://github.com/dremio/dremio-oss/blob/master/common/src/main/java/com/dremio/common/AutoCloseables.java#L176). ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
