Skip to content

deferred API: local executor #489

@jknack

Description

@jknack

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions