I'm writing some integration tests against RestExpress, and the shutdown time seems to be taking 20 seconds. I'm not sure what I should be setting to get the server to forcibly release everything for a test.
I've stepped into the code and as far in as I can go, it seems to be bouncing around inside ExecutorUtil.java (lines 84 -115) waiting for worker threads to be cleaned up.
public class Serve {
private static RestExpress server;
public static void main(String[] args) throws Exception {
go();
server.awaitShutdown();
}
public static void go() {
server = new RestExpress()
.setName("commerce")
.setDefaultFormat(Format.JSON)
.putResponseProcessor(Format.JSON, ResponseProcessors.json())
.putResponseProcessor(Format.WRAPPED_JSON,
ResponseProcessors.wrappedJson())
.addMessageObserver(new SimpleConsoleLogMessageObserver());
defineRoutes(server);
server.bind(9050);
}
public static void defineRoutes(RestExpress server) {
server.uri("/search", new Controller())
.method(HttpMethod.POST, HttpMethod.GET)
.flag(Flags.Cache.DONT_CACHE); // Expressly deny cache-ability.
}
public static void stop() {
server.shutdown();
}
}