Skip to content

Commit

Permalink
feat: allow to stop the invoker
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Feb 14, 2022
1 parent 6312e64 commit c88cd9c
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ private static class FunctionClassLoader extends URLClassLoader {
private final String functionSignatureType;
private final ClassLoader functionClassLoader;

private Server server;

public Invoker(
Integer port,
String functionTarget,
Expand Down Expand Up @@ -226,7 +228,11 @@ ClassLoader getFunctionClassLoader() {
}

public void startServer() throws Exception {
Server server = new Server(port);
startServer(true);
}

public void startServer(boolean join) throws Exception {
server = new Server(port);

ServletContextHandler servletContextHandler = new ServletContextHandler();
servletContextHandler.setContextPath("/");
Expand Down Expand Up @@ -261,7 +267,11 @@ public void startServer() throws Exception {

server.start();
logServerInfo();
server.join();
if(join) server.join();
}

public void stopServer() throws Exception {
server.stop();
}

private Class<?> loadFunctionClass() throws ClassNotFoundException {
Expand Down

0 comments on commit c88cd9c

Please sign in to comment.