Skip to content

Commit ad551af

Browse files
committed
PR comments
1 parent 3a4416b commit ad551af

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tez-common/src/main/java/org/apache/tez/util/TezRuntimeShutdownHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
import org.slf4j.Logger;
2424
import org.slf4j.LoggerFactory;
2525

26-
public class TezRuntimeShutdownHandler {
26+
public final class TezRuntimeShutdownHandler {
2727
private static final Logger LOG = LoggerFactory.getLogger(TezRuntimeShutdownHandler.class);
2828

2929
private static final List<Runnable> shutdownTasks = new ArrayList<>();
3030

31+
private TezRuntimeShutdownHandler() {
32+
}
33+
3134
public static void addShutdownTask(Runnable r) {
3235
shutdownTasks.add(r);
3336
}

tez-runtime-library/src/main/java/org/apache/tez/http/async/netty/AsyncHttpConnection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ private void initClient(HttpConnectionParams httpConnParams) throws IOException
103103
.build();
104104
DefaultAsyncHttpClientConfig config = builder.build();
105105
httpAsyncClient = new DefaultAsyncHttpClient(config);
106-
TezRuntimeShutdownHandler.addShutdownTask(new Thread(() -> {
106+
TezRuntimeShutdownHandler.addShutdownTask(() -> {
107107
try {
108108
if (httpAsyncClient != null) {
109109
httpAsyncClient.close();
110+
httpAsyncClient = null;
110111
}
111112
} catch (IOException e) {
112113
LOG.warn("Error while closing async client (this won't block shutdown)", e);
113114
}
114-
}));
115+
});
115116
}
116117
}
117118
}

0 commit comments

Comments
 (0)