Learning Concurrency in Kotlin: Build highly efficient and robust applications by Miguel Angel Castiblanco Torres
Author:Miguel Angel Castiblanco Torres [Castiblanco Torres, Miguel Angel]
Language: eng
Format: epub, pdf
Publisher: Packt Publishing
Published: 2018-07-29T23:00:00+00:00
delay(1200)
job.cancelAndJoin()
}
println("Took $duration ms")
}
This code will print "still running" every 500 milliseconds until the coroutine is cancelled; on cancellation the finally block will be executed. The main thread will be suspended for 1.2 seconds, then it will cancel the job and print the total execution time before ending the application:
As expected, the job was cancelled soon after the 1.2 seconds delay ended, and the finally printed the message. Now let's modify the finally so that it stalls for five seconds before actually letting the coroutine end:
} finally {
println("cancelled, will delay finalization now")
delay(5000)
println("delay completed, bye bye")
}
Now, upon execution, you'll notice that it doesn't work that way:
Download
Learning Concurrency in Kotlin: Build highly efficient and robust applications by Miguel Angel Castiblanco Torres.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(26284)
Hello! Python by Anthony Briggs(25209)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(24437)
Kotlin in Action by Dmitry Jemerov(23529)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(22871)
Dependency Injection in .NET by Mark Seemann(22660)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21421)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20265)
Grails in Action by Glen Smith Peter Ledbrook(19334)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17049)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16361)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14073)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12248)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11523)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10637)
Hit Refresh by Satya Nadella(9215)
The Kubernetes Operator Framework Book by Michael Dame(8574)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8424)
Robo-Advisor with Python by Aki Ranin(8369)