Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deferred API: local executor #489

Closed
jknack opened this issue Oct 1, 2016 · 0 comments
Closed

deferred API: local executor #489

jknack opened this issue Oct 1, 2016 · 0 comments
Labels
Milestone

Comments

@jknack
Copy link
Member

jknack commented Oct 1, 2016

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant