Hi!

I've read the documentation at 
http://doc.akka.io/docs/akka/2.4.2/java/futures.html and where the map 
function is explained it's stated that "If the Future is already complete 
though, it will be run in our current thread.". I've just done some tests 
suggesting this statement would be false, it seems like it's always 
dispatched on the execution context even though it's already completed.

For example this prints two different thread ID:s:

System.out.println(Thread.currentThread().getId());
Futures.successful(new Object()).map(new Mapper<Object, Object>() {
    public Object apply(Object obj) {
        System.out.println(Thread.currentThread().getId());
    }
}, system.dispatcher());

Indeed I would prefer that behaviour and would like to trust that fact but 
then the statement in the docs needs to be changed.

Can somebody confirm this, I'm happy to create a bug report in github if 
you think this indeed is a bug in the documentation.

I also found some old stuff about this:
https://www.assembla.com/spaces/akka/tickets/1054-complete-futures-asynchronously-when-replying-through-a-channel/details#
http://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/

Best Regards,
Johannes Berg

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to