mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
add signal handler
This commit is contained in:
parent
7a87367561
commit
a4072e6b90
1 changed files with 15 additions and 0 deletions
|
|
@ -72,6 +72,8 @@ import org.apache.zeppelin.scheduler.Scheduler;
|
|||
import org.apache.zeppelin.user.AuthenticationInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sun.misc.Signal;
|
||||
import sun.misc.SignalHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
|
|
@ -277,6 +279,19 @@ public class RemoteInterpreterServer extends Thread
|
|||
RemoteInterpreterServer remoteInterpreterServer =
|
||||
new RemoteInterpreterServer(zeppelinServerHost, port, interpreterGroupId, portRange);
|
||||
remoteInterpreterServer.start();
|
||||
|
||||
// add signal handler
|
||||
Signal.handle(new Signal("TERM"), new SignalHandler() {
|
||||
@Override
|
||||
public void handle(Signal signal) {
|
||||
try {
|
||||
remoteInterpreterServer.shutdown();
|
||||
} catch (TException e) {
|
||||
logger.error("Error on shutdown RemoteInterpreterServer", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
remoteInterpreterServer.join();
|
||||
System.exit(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue