-
-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
{
executor(new ForkJoinPool());
get("/deferred", promise(deferred -> {
// run inside fork join pool
}));
}Default executor will be set to adirect executor or an executor that runs in the caller thread. This is possible bc Jooby worker threads are allowed to run blocking code as long you set/find an appropriate thread pool (default is 100 threads)
Without an executor the following routes are equivalent (they run in the same thread)
{
get("/deferred", promise(deferred -> {
// run in caller thread
deferred.resolve("OK");
}));
get("/deferred", () -> {
// run in caller thread
return "OK";
});
}