aliyun / aliyun-oss-java-sdk

Aliyun OSS SDK for Java
1.22k stars 805 forks source link

Why isn't ossClient implemented with the AutoCloseable interface? #516

Open dyingChinese opened 7 months ago

dyingChinese commented 7 months ago

I would like to understand the reason behind the decision to not implement the ossClient class with the AutoCloseable interface. The AutoCloseable interface provides a convenient way to automatically release resources when they are no longer needed, by utilizing the try-with-resources statement.

By implementing the AutoCloseable interface, the ossClient class could be used within a try-with-resources block, ensuring that any underlying resources are properly released, such as network connections or file handles. This can help prevent resource leaks and improve the overall reliability and performance of the application.

I'm curious to know the rationale behind not including this interface in the ossClient class and whether there are any alternative approaches or best practices recommended for handling resource cleanup when working with the ossClient in a production environment.

Thank you for your insights and clarification on this matter.