graina | Chapter source code and example application | Learning library
kandi X-RAY | graina Summary
kandi X-RAY | graina Summary
This directory contains the source code for the examples used in the book Grails in Action as well as the sample application that we create in the book: Hubbub.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graina
graina Key Features
graina Examples and Code Snippets
Community Discussions
Trending Discussions on graina
QUESTION
I have the following code (https://github.com/avinash0161/OrleansExperiments/tree/c0155b4b0c8c1bfe60aea8624f2cc83a52853dc7):
...ANSWER
Answered 2019-Jan-31 at 17:22The single-threaded nature is not being violated. The compilation warnings in your project makes the source of the issue clear. In particular: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
The method async Task Call_A_ToTemp()
never awaits the call to grain B. Instead, it returns immediately after issuing the call. Because the Task
returned by Call_A_ToTemp()
is immediately completed, another call is allowed to execute on the grain. Once grain.CallA()
completes, the continuation (ContinueWith(...)
) will execute on the grain's TaskScheduler
as soon as possible (eg, while the grain is awaiting another call or sitting idle).
Instead, if the call was awaited or if async
was removed from the method and the code changed to return the grain.CallA().ContinueWith(...)
call then the expected behavior will be observed. I.e, changing the code to this will give you the expected result:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graina
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page