Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Curious to why KeptPromise needs an ExecutionContext
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
andy  
View profile  
 More options May 17 2012, 6:07 pm
From: andy <andrew.headr...@gmail.com>
Date: Thu, 17 May 2012 15:07:08 -0700 (PDT)
Local: Thurs, May 17 2012 6:07 pm
Subject: Curious to why KeptPromise needs an ExecutionContext

Just a curiosity. Why do Promise.successful and Promise.failed, both backed
by KeptPromise, need an execution context? Since they aren't actually doing
anything on another thread the execution context seems superfluous. Is it
for composability with other futures? I looked into the code for
KeptPromise and didn't see how the execution context was used.

Thanks,
Andy  


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
√iktor Ҡlang  
View profile  
 More options May 17 2012, 7:31 pm
From: √iktor Ҡlang <viktor.kl...@gmail.com>
Date: Fri, 18 May 2012 01:31:16 +0200
Local: Thurs, May 17 2012 7:31 pm
Subject: Re: [akka-user] Curious to why KeptPromise needs an ExecutionContext

On Fri, May 18, 2012 at 12:07 AM, andy <andrew.headr...@gmail.com> wrote:
> Just a curiosity. Why do Promise.successful and Promise.failed, both
> backed by KeptPromise, need an execution context? Since they aren't
> actually doing anything on another thread the execution context seems
> superfluous. Is it for composability with other futures? I looked into the
> code for KeptPromise and didn't see how the execution context was used.

All Futures have to be associated with an ExecutionContext so they know
where to submit their callbacks for execution.

Cheers,

> Thanks,
> Andy

> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/akka-user/-/KelOEupyVQ0J.
> To post to this group, send email to akka-user@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.

--
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
andy  
View profile  
 More options May 17 2012, 9:03 pm
From: andy <andrew.headr...@gmail.com>
Date: Thu, 17 May 2012 18:03:05 -0700 (PDT)
Local: Thurs, May 17 2012 9:03 pm
Subject: Re: [akka-user] Curious to why KeptPromise needs an ExecutionContext

Word. Makes sense.

so in,

Promise.success("Hello").map( _ + " World" )

the map callback would execute using the execution context.

Thanks,
Andy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
√iktor Ҡlang  
View profile  
 More options May 17 2012, 9:24 pm
From: √iktor Ҡlang <viktor.kl...@gmail.com>
Date: Fri, 18 May 2012 03:24:46 +0200
Local: Thurs, May 17 2012 9:24 pm
Subject: Re: [akka-user] Curious to why KeptPromise needs an ExecutionContext

On Fri, May 18, 2012 at 3:03 AM, andy <andrew.headr...@gmail.com> wrote:
> Word. Makes sense.

> so in,

> Promise.success("Hello").map( _ + " World" )

> the map callback would execute using the execution context.

Yes, exactly.

We're having a discussion for SIP-14 now whether the EC should go on every
method that uses callbacks or only on the "producer".

Cheers,

--
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
andy  
View profile  
 More options May 17 2012, 9:33 pm
From: andy <andrew.headr...@gmail.com>
Date: Thu, 17 May 2012 18:33:52 -0700 (PDT)
Local: Thurs, May 17 2012 9:33 pm
Subject: Re: [akka-user] Curious to why KeptPromise needs an ExecutionContext

Initially in my services that returned futures I would pass in an actor
system or execution context into the class constructor. Lately I have been
switching so that methods returning futures have a curried implicit
execution context in their definitions. I feel it is easier to wire up my
app this way and allows me greater control over how service calls compose
with the underlaying threading model.

2 cents

p.s. I love akka futures


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
√iktor Ҡlang  
View profile  
 More options May 17 2012, 9:39 pm
From: √iktor Ҡlang <viktor.kl...@gmail.com>
Date: Fri, 18 May 2012 03:39:17 +0200
Local: Thurs, May 17 2012 9:39 pm
Subject: Re: [akka-user] Curious to why KeptPromise needs an ExecutionContext

On Fri, May 18, 2012 at 3:33 AM, andy <andrew.headr...@gmail.com> wrote:
> Initially in my services that returned futures I would pass in an actor
> system or execution context into the class constructor. Lately I have been
> switching so that methods returning futures have a curried implicit
> execution context in their definitions. I feel it is easier to wire up my
> app this way and allows me greater control over how service calls compose
> with the underlaying threading model.

Yup, and also it lets the consumers of Ftuures to be EC-unaware.

> 2 cents

> p.s. I love akka futures

Glad to hear that! A lot of great work has gone into them, Derek Williams
was the guy who took the first step into making them awesome.

Cheers,

--
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »