mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Gracefully shutdown ZeppelinServer in test
This commit is contained in:
parent
80698e9d8d
commit
8b6d3f55da
2 changed files with 8 additions and 3 deletions
|
|
@ -69,7 +69,9 @@ public class ZeppelinServer extends Application {
|
|||
private SchedulerFactory schedulerFactory;
|
||||
public static Notebook notebook;
|
||||
|
||||
static NotebookServer notebookServer;
|
||||
public static NotebookServer notebookServer;
|
||||
|
||||
public static Server jettyServer;
|
||||
|
||||
private InterpreterFactory replFactory;
|
||||
|
||||
|
|
@ -79,7 +81,7 @@ public class ZeppelinServer extends Application {
|
|||
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
|
||||
conf.setProperty("args", args);
|
||||
|
||||
final Server jettyServer = setupJettyServer(conf);
|
||||
jettyServer = setupJettyServer(conf);
|
||||
notebookServer = setupNotebookServer(conf);
|
||||
|
||||
// REST api
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public abstract class AbstractTestRestApi {
|
|||
return url;
|
||||
}
|
||||
|
||||
static ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
static ExecutorService executor;
|
||||
protected static final Runnable server = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -86,6 +86,7 @@ public abstract class AbstractTestRestApi {
|
|||
protected static void startUp() throws Exception {
|
||||
if (!wasRunning) {
|
||||
LOG.info("Staring test Zeppelin up...");
|
||||
executor = Executors.newSingleThreadExecutor();
|
||||
executor.submit(server);
|
||||
long s = System.currentTimeMillis();
|
||||
boolean started = false;
|
||||
|
|
@ -125,6 +126,8 @@ public abstract class AbstractTestRestApi {
|
|||
protected static void shutDown() throws Exception {
|
||||
if (!wasRunning) {
|
||||
LOG.info("Terminating test Zeppelin...");
|
||||
ZeppelinServer.notebookServer.stop();
|
||||
ZeppelinServer.jettyServer.stop();
|
||||
executor.shutdown();
|
||||
|
||||
long s = System.currentTimeMillis();
|
||||
|
|
|
|||
Loading…
Reference in a new issue