Hi John,

try this signature instead:
http://doc.akka.io/japi/akka/2.3.9/akka/pattern/Patterns.html#after(scala.concurrent.duration.FiniteDuration,
akka.actor.Scheduler, scala.concurrent.ExecutionContext,
java.util.concurrent.Callable)

On Thu, Jan 29, 2015 at 10:34 PM, John Ulric <uja...@gmail.com> wrote:

> Is there a way to delay the execution (not the completion) of a future,
> similar to the scheduleOnce method for actors? I tried this:
>
> Future<String> delayedString = Patterns.after(new FiniteDuration(10, 
> TimeUnit.SECONDS),
>         system.scheduler(), system.dispatcher(), Futures.future(new 
> Callable<String>() {
>             public String call() throws Exception {
>                 System.out.println("Returning some string immediately");
>                 return "Some string.";
>             }
>         }, system.dispatcher()));
>
> System.out.println("delayedString=" + Await.result(delayedString, 
> Duration.Inf()));
>
>
> But this calls the Callable immediately and only waits 10 seconds for the 
> result to be returned.
>
>
> Thanks, John
>
>
>  --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to