ijuma commented on a change in pull request #8685:
URL: https://github.com/apache/kafka/pull/8685#discussion_r426850232
##########
File path: clients/src/main/java/org/apache/kafka/common/network/Selector.java
##########
@@ -363,23 +363,14 @@ public void wakeup() {
@Override
public void close() {
List<String> connections = new ArrayList<>(channels.keySet());
- try {
- for (String id : connections)
- close(id);
- } finally {
- // If there is any exception thrown in close(id), we should still
be able
- // to close the remaining objects, especially the sensors because
keeping
- // the sensors may lead to failure to start up the
ReplicaFetcherThread if
- // the old sensors with the same names has not yet been cleaned up.
- AtomicReference<Throwable> firstException = new
AtomicReference<>();
- Utils.closeQuietly(nioSelector, "nioSelector", firstException);
- Utils.closeQuietly(sensors, "sensors", firstException);
- Utils.closeQuietly(channelBuilder, "channelBuilder",
firstException);
- Throwable exception = firstException.get();
- if (exception instanceof RuntimeException && !(exception
instanceof SecurityException)) {
- throw (RuntimeException) exception;
- }
-
+ AtomicReference<Throwable> firstException = new AtomicReference<>();
Review comment:
Have we considered using `Utils.closeAll` instead of multiple
`closeQuietly`?
----------------------------------------------------------------
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]