YanshuoH commented on PR #1046: URL: https://github.com/apache/pulsar-client-go/pull/1046#issuecomment-1705250728
> This PR enables the 'close' method to be re-entrant. However, I'm not quite seeing the value in making the 'close' method re-entrant. Could you provide any scenarios or use cases where this would be necessary? I might add a scenario to this improvement. For example, our app may instantiate multiple instances that implement `io.Closer`, we might do something like: - create a server that will create multiple rpc instances (including pulsar.Client) inside. - `server.Run` func that has a `defer cleanup()` within. That `cleanup` would try to close the rpc instances. - a `defer server.Close()` func that calls `cleanup` underling that will be used in the main file. In Go, we expect `Close` that can be called multiple times, so the above workflow is designed to make sure all rpc instances are closed properly without leaving any openfd or occupying other resources. That is the opportunity that I've found out https://github.com/apache/pulsar-client-go/issues/1026. -- 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]
