Questions tagged [executioncontext]

Refers to concept of an environment where code is evaluated and executed. This refers to global and function execution contexts, how control is switched between, how binding occurs in context etc.

Execution context is abstract concept of programming and is closely related to executing code itself and order how it will executed (execution stack), how pointers to objects are created and used and how they're divided from each other. Because of abstract nature of concept itself Execution context is closely tied to particular implementation in programming languages (Javascript for example). Check related tags

Resources

Related tags

155 questions
22
votes
2 answers

Using ASP.NET Web API, my ExecutionContext isn't flowing in async actions

I'm having difficulty understanding the mechanics behind ExecutionContext. From what I've read online, context-sensitive items such as security (Thread Principal), culture, etc, should flow across asynchronous threads within the bounds of an…
Daniel
  • 1,835
  • 2
  • 18
  • 27
9
votes
3 answers

Wrong Thread.CurrentPrincipal in async WCF end-method

I have a WCF service which has its Thread.CurrentPrincipal set in the ServiceConfiguration.ClaimsAuthorizationManager. When I implement the service asynchronously like this: public IAsyncResult BeginMethod1(AsyncCallback callback, object state) …
MvdD
  • 17,926
  • 5
  • 51
  • 83
9
votes
1 answer

Security, Thread.CurrentPrincipal, and ConfigureAwait(false)

Would using Thread.CurrentPrincipal's claims in a referenced library that uses ConfigureAwait(false) pose any problems or will the flowing of ExecutionContext's logical call context take care of me there? (my reading and testing so far indicates…
8
votes
1 answer

How to run an async delegate on captured ExecutionContext

As Stephen Toub explained in this post, when you submit a message to an ActionBlock, you can ExecutionContext.Capture before calling ActionBlock.Post, pass a DTO holding both message and ExecutionContext into the block, then inside the message…
zvolkov
  • 17,762
  • 8
  • 65
  • 78
8
votes
1 answer

ExecutionContext to use with mapAsync in Akka-Streams

I am just getting started with Akka Stream and I am trying to figure something out: Currently, in my flows I am using mapAsync() to integrate with my rest services, as recommended here. I have been wondering, what execution context should the…
Emil D
  • 1,744
  • 3
  • 22
  • 39
7
votes
1 answer

How does .NET ExecutionContext actually work?

I am trying to discover how the ExecutionContext actually works in version 4.0 and above of the .NET Framework. The documentation says that the managed principle, synchronization, locale and user context all flow to the new thread when using…
Phil Wright
  • 21,516
  • 12
  • 77
  • 129
7
votes
2 answers

ExecutionContext does not flow up the call stack from async methods

Consider the following code: private static async Task Main(string[] args) { await SetValueInAsyncMethod(); PrintValue(); await SetValueInNonAsyncMethod(); PrintValue(); } private static readonly AsyncLocal asyncLocal = new…
RX_DID_RX
  • 3,853
  • 3
  • 14
  • 25
7
votes
1 answer

How do I make a block aware execution context?

For some reason I can't wrap my head around implementing this. I've got an application running with Play that calls out to Elastic Search. As part of my design, my service uses the Java API wrapped with scala future's as shown in this blog post.…
EdgeCaseBerg
  • 2,411
  • 1
  • 18
  • 37
7
votes
2 answers

IntelliJ keeps removing the import of context.dispatcher from akka tutorial

I am following the akka-in-action tutorial and in chapter 2, there is a class (https://github.com/RayRoestenburg/akka-in-action/blob/master/chapter2/src/main/scala/com/goticks/RestInterface.scala): trait RestApi extends HttpService with ActorLogging…
mirelon
  • 4,498
  • 6
  • 37
  • 64
7
votes
2 answers

Scala: ExecutionContext for future for-comprehension

When I make a future, or apply methods like onSuccess and map, I can specify ExecutionContext for them. For example, val f = future { // code } executionContext f.map(someFunction)(executionContext) f onSuccess { // code }…
Naetmul
  • 11,923
  • 6
  • 46
  • 72
7
votes
1 answer

Passing implicit ExecutionContext to contained objects/called methods

I'm creating an async library using Scala 2.10 futures. The constructor for the library takes a sequence of user-defined objects that implement a certain trait, and then a method on the library class sends some data one-by-one into the user-defined…
Michelle Tilley
  • 149,782
  • 38
  • 355
  • 303
6
votes
0 answers

"Best" ExecutionContext for IO

I have some synchronous calls in my Scala code. I've wrapped them in a blocking() context and then in a Future: Future(blocking(syncCall())), but I don't know which type of ExecutionContext to use. I know there may be a lot of possibilities and…
vicaba
  • 2,676
  • 1
  • 22
  • 40
6
votes
4 answers

Execution contexts in JavaScript

A new execution context is created for each function in JavaScript. How many execution contexts are present in memory when the following code is run? Note that function Bar is not invoked. function Foo () { function Bar() {} } Foo(); Also,…
Ben Aston
  • 45,997
  • 54
  • 176
  • 303
6
votes
1 answer

How to detect scala executioncontext exhaustion?

I'm having problems with my Playframework application not being responsive from time to time and I would like to detect this at runtime + log information on what is currently running on the exhausted execution context. What would the best strategy…
Somatik
  • 4,599
  • 2
  • 35
  • 47
6
votes
2 answers

Concurrency in Play 2.1 or above

I've read a few tutorials on how to deal with concurrency in Play and found some examples: Asynchronous Job import scala.concurrent.{ExecutionContext, future} def sendEmailAsync(from: String, to: String, subject: String, body: String) = { import…
j3d
  • 8,708
  • 17
  • 76
  • 150
1
2 3
10 11