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

196 questions
6
votes
1 answer

Play framework futures not being parallelised by default-dispatcher

I'm trying to test the ExecutionContext behaviour in a play app, and found that I'm not able to achieve any degree of parallelism when I'm using the default dispatcher either by calling as.dispatcher,…
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
  • 53,718
  • 65
  • 205
  • 331
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
  • 9,492
  • 22
  • 88
  • 172
6
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
  • 157,729
  • 40
  • 374
  • 311
5
votes
1 answer

Confusion about Javascript Hoisting

I thought I grasped the concept of hoisting, but the code below got me confused. How does it return 1? Will the second example() function be hoisted above the first one? function example() { return 9; } console.log(example()); function…
Roma Kim
  • 321
  • 1
  • 8
5
votes
2 answers

ExecutionContext with RateLimiter

Suppose I have an HTTP client to call a server with a request rate limit, e.g. 1000 requests/ sec. I implemented a rate limiter in ExecutionContext like this: Created a bounded blocking queue with RateLimiter of Guava class…
Michael
  • 41,026
  • 70
  • 193
  • 341
5
votes
2 answers

Are function parameters in JavaScript hoisted?

function foo(a,b){ return a + b; } foo(1,2); Are function parameters hoisted? Does the variableEnvirnoment at the creation phase of the function execution context looks something like that : VE = { { 0 : undefined , 1: undefined,…
Abdou Bestmood
  • 475
  • 4
  • 15
5
votes
1 answer

Are dead threads replaced in an ExecutionContext and/or Java thread pool?

When a thread dies due to an exception, what happens to this thread? If it is inside a thread pool, does it spawn a new thread? I'm interested in what happens in scala ExecutionContext, but since an ExecutionContext wraps a java thread pool, I think…
vicaba
  • 2,836
  • 1
  • 27
  • 45
5
votes
1 answer

Configuring the Fork Join Thread Pool

I have a simple question on using the fork join thread pool. Here is a short example of what I'm using: executor = "fork-join-executor" # Configuration for the fork join pool fork-join-executor { # Min number of threads to cap factor-based…
joesan
  • 13,963
  • 27
  • 95
  • 232
4
votes
3 answers

Why are function expressions not included in the variable object of the Execution Context?

While going through the Execution Context part of the JavaScript.The Core. (1st ed.) by Dmitry Soshnikov, I came across this line that explicitly says that function expressions are not included in the variable object property of an execution…
Aniruddha
  • 774
  • 1
  • 7
  • 18
4
votes
1 answer

Getting ExecutionContext Globally in Azure Function App

I have function Apps, and in a helper class that is going to prepare a file and store it for me i want to read the project file I tried many ways, such as (AppDomain, AppContext, .... etc) and many others, and as it is serverless, the program.cs is…
4
votes
2 answers

How do I configure the shutdown policy for Scala ExecutionContexts?

I recently came across some odd behavior on a machine where maping a function that returns Future[T] was executing sequentially. This same problem does not occur on other machines: work is interleaved as one would expect. I later discovered that…
Dan Barowy
  • 2,270
  • 24
  • 35
4
votes
1 answer

How should I use ExecutionContext to provide flow of my own context?

Update: Found similar question. I want to implement some services following AmbientContext design pattern for our ASP.NET application. For example I need user name (like Thread.CurrentPrincipal) to be set once at the very beginning of the request…
Pavel Voronin
  • 13,503
  • 7
  • 71
  • 137
3
votes
1 answer

Does the both functions parent and asynchronous child get re-pushed to call stack from task queue on completion of async code of child function?

What i all know about call stack is: If there is only one function being called it will be pushed to call stack and removed when its job is done or otherwise return statement is encountered. If one function calls another one, both stays in call…
3
votes
1 answer

Does the inner function know that a variable is inside the temporal dead zone before searching further through the scope chain?

function b() { function a() { console.log(x); } a(); const x = 10; } const x = 20; b() If I understand lexical scoping and execution context correctly, when function a() is invoked, it should have a reference to b's…
james
  • 550
  • 8
  • 14
1
2
3
13 14