- Notifications
You must be signed in to change notification settings - Fork 3
SupervisionTrees
This page explains the supervision trees for each of the nodewatch applications.
This is the most complex supervision tree in the system, consisting of several sub-trees and using a variety of supervision models. The overall structure looks like this:
x-------------------------x x------------------| dxkit_sup (one_for_one) |-----------------x | x-------------------------x | | | | | | | x------------x----------x x--------x------------x x-------------------x------------------x | dxkit_event_subsystem | | dxkit_net_subsystem | | dxkit_monitor_subscription_subsystem | | <<supervisor>> | | <<supervisor>> | | <<supervisor>> | x-----------------------x x---------------------x x--------------------------------------x
The event subsystem comprises a locally registered gen_event
manager and a simple_one_for_one
supervisor which acts as a bridge between the event manager and the gen_event
handler (callback modules), by wrapping the handler(s) in a gen_server
. This handler bridge catches abnormal exits in the event handlers and stops, which in turn triggers the event_bridge
to restart the handler. The branch supervisor uses rest_for_one
so that the event bridge will restart independently, but a crash in the event handler will force the bridge to also restart - a necessary step if we want to re-register the gen_event
handlers with the new manager instance.
x-----------------------x | dxkit_event_subsystem | x-----------| <<supervisor>> |------------x | x-----------------------x | | | x-----------x---------x x----------x---------x | dxkit_event_handler | | dxkit_event_bridge | | <<gen_event/mgr>> | | <<supervisor>> | x---------------------x x----------x---------x v v v x----------V-----------x | event handler bridge | | <<gen_server>> | x----------------------x
TBC.