File tree Expand file tree Collapse file tree
tez-common/src/main/java/org/apache/tez/util
tez-runtime-library/src/main/java/org/apache/tez/http/async/netty Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323import org .slf4j .Logger ;
2424import 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 }
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments