Lifecycle Policy
We’ve described the supervisor as a place to have lifecycle policy. There are four concerns we need to consider. Two are constant: startup order and shutdown order. Two more may vary depending on application requirements, shutdown policy, and restart policy.
Let’s start with the startup and shutdown order. Then we can move into policy.
Startup and Shutdown Are Synchronous and Ordered
When an OTP supervisor starts any application, it will start the supervisor, and then start the children in the order you specify. The startup will also be synchronous, meaning one process (including any children) will finish coming up before another starts. You probably recognize the call mechanism the supervisor is using under the hood.
So far, ...
Get Programmer Passport: OTP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.