mirror of
https://github.com/AdaCore/PolyORB.git
synced 2026-02-12 13:01:15 -08:00
This is an example to illustrate the reconnection policy. In this example, we have four partitions. Part0 executes RPC RCI_1.F on part1 which uses Failed_Until_Restart as reconnection policy. On part1, RCI_1.F executes RPC RCI_2.F on part2 which uses Blocked_Until_Restart as reconnection policy. On part2, RCI_2.F executes a RPC on part3 which uses Rejected_On_Restart as reconnection policy. Build the application (make) and execute each partition in separate sessions (three separate windows for example) on the same machine. * part0 prints a message for every RPC that gets executed. * Kill part1. part0 reports that RCI_1.F cannot be executed and that Communication_Error was raised. Any attempt to execute RCI_1.F will raise Communication_Error again until part1 (and RCI_1) is restarted. Now restart part1. part0 will print the usual message again. This is the Failed_Until_Restart reconnection policy. * Kill part2. part0 hangs and no longer prints the usual message. Any attempt to execute RCI_2.F is kept blocking until part2 (and RCI_2) is restarted. No Communication_Error exception is raised. This behaviour is similar to the one you would get with a partition whose elaboration is not finished yet. Now restart part2. part0 will print the usual message again. This is the Blocked_Until_Restart reconnection policy. * Kill part3. part0 hangs and no longer prints the usual message. Communication_Error is raised on part2 for any attempt to execute RCI_3.F. Restart part3 and you will get "raised PROGRAM_ERROR : RCI unit rci_3 is already declared". This is the Rejected_On_Restart reconnection policy. Once a partition which contains at least one RCI package has been started, it is forbidden to restart it later. This is the same behaviour you would get by executing a partition which contains at least a RCI package twice. A RCI package has to be unique in the distributed system. In this example, RCI_3 was already declared and even if its partition dies, it cannot be relocated. This is the default reconnection policy. After several attempts to execute RCI_3.F, RCI_2.F raises Program_Error which is propagated to Main and the distributed application terminates smoothly.