-
-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
In addition to the #488 which add a global executor to Deferred API a local (per call) executor is will be available too:
{
// global/default executor
executor(Executors.new...());
// cached executor
executor("cached", Executors.new...());
get("/global", promise(deferred -> {
deferred.resolve("OK");
}));
get("/local", promise("cached", deferred -> {
deferred.resolve("OK");
}));
}The Deferred class now takes a String which works as an executor reference:
new Deferred("cached", ...);
The executor method call is a shortcut for:
binder.bind(Key.get(Executor.class, "cached")).toInstance(executor)