Is it meaningful for AutoCloseable's close method to throw an exception? How should this be handled?
问题 In C#, it is considered bad practice to throw exceptions in the Dispose method of an IDisposable . By contrast, in java the close method of AutoCloseable allows any Exception whatsoever to be thrown and forces the caller to handle it somehow. But what is the caller reasonably expected to do if this happens? This suggests that the attempt to close the resource failed somehow. So does the user have to try to close the resource again before continuing, perhaps with some sort of exponential