YARN-9072. Send exit command to terminate docker exec on connection close. Contributed by Eric Yang
This commit is contained in:
parent
99b5061265
commit
c5c73182e5
@ -113,6 +113,7 @@ public void onConnect(Session session) {
|
||||
.fromString(cId));
|
||||
if (!checkAuthorization(session, container)) {
|
||||
session.close(1008, "Forbidden");
|
||||
return;
|
||||
}
|
||||
LOG.info(session.getRemoteAddress().getHostString() + " connected!");
|
||||
LOG.info(
|
||||
@ -135,6 +136,9 @@ public void onConnect(Session session) {
|
||||
public void onClose(Session session, int status, String reason) {
|
||||
try {
|
||||
LOG.info(session.getRemoteAddress().getHostString() + " closed!");
|
||||
String exit = "exit\r\n";
|
||||
pair.out.write(exit.getBytes(Charset.forName("UTF-8")));
|
||||
pair.out.flush();
|
||||
pair.in.close();
|
||||
pair.out.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
public class TestNMWebTerminal {
|
||||
private static final File TESTROOTDIR = new File("target",
|
||||
TestNMWebServer.class.getSimpleName());
|
||||
private static File TESTLOGDIR = new File("target",
|
||||
private static final File TESTLOGDIR = new File("target",
|
||||
TestNMWebServer.class.getSimpleName() + "LogDir");
|
||||
private NodeHealthCheckerService healthChecker;
|
||||
private WebServer server;
|
||||
|
Loading…
Reference in New Issue
Block a user