play.libs.Akka.future()

Here are the examples of the java api play.libs.Akka.future() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : Application.java
with MIT License
from vangav

public static Result asyncResult() {
    return async(Akka.future(new Callable<String>() {

        @Override
        public String call() {
            return "success";
        }
    }).map(new Function<String, Result>() {

        @Override
        public Result apply(String a) {
            response().setHeader("header_test", "header_val");
            response().setCookie("cookie_test", "cookie_val");
            session("session_test", "session_val");
            flash("flash_test", "flash_val");
            return ok(a);
        }
    }));
}

19 Source : AsyncController.java
with Apache License 2.0
from thefreebit

public static Result message() {
    return Results.async(Akka.future(new Callable<Result>() {

        @Override
        public Result call() {
            try {
                SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            new CreateTraceEntry().traceEntryMarker();
            return Results.ok("Hi!");
        }
    }));
}