Changes between Version 17 and Version 18 of Documentation/Tutorial/PingPong
- Timestamp:
- Jan 22, 2009, 9:46:59 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/Tutorial/PingPong
v17 v18 100 100 47 logging_info( "PingPong started up" ); 101 101 48 102 49 // trigger the creation of the pathload measurement module103 50 //PathloadMeasurement::instance( overlay );102 49 103 50 104 104 51 } 105 105 }}} … … 108 108 109 109 The ''startup'' method (lines 20-51) is called from the !StartupWrapper, jolting the operation of the ping pong service. With its call, the !StartupWrapper passes an ''!UnderlayAbstraction'' object to the service, being the main object for communication between the service and ''Ariba'' (lines 20/21). 110 When starting up, the service chooses a servcie ID (line 25). Then, it creates a node ID for the SpoVNet node it represents in the instance, under usage of potential base information deposited in the config file (lines 27-29). Same applies to its locator (lines 31-33) and the port (lines 35-37). Then we get to the point where we decide the role of the specific ping pong instance (initiator versus joiner) (lines 39-42). Remember that we got this information in line 17. If the starting node is the initiator of the SpoVNet instance, it creates the SpoVNet, specifying its SpoVNetID, NodeID, Locator and Port (line 40). In contrast, other nodes join the instance, providing the same parameters (line 42). 110 When starting up, the service chooses a servcie ID (line 25). Then, it creates a node ID for the SpoVNet node it represents in the instance, under usage of potential base information deposited in the config file (lines 27-29). Same applies to its locator (lines 31-33) and the port (lines 35-37). Then we get to the point where we decide the role of the specific ping pong instance (initiator versus joiner) (lines 39-42). Remember that we got this information in line 17. If the starting node is the initiator of the SpoVNet instance, it creates the SpoVNet, specifying its SpoVNetID, NodeID, Locator and Port (line 40). In contrast, other nodes join the instance, providing the same parameters (line 42). After starting up, a service needs to bind to the SpoVNet Base Overlay with its service ID (lines 44/45). Finally, we may give out all kinds of logging infos by calling the method logging_info (line 47). 111 111 112 112 After starting up, a service need to bind to the SpoVNet Base Overlay with its service ID (lines 44/45). 113 113 {{{ 114 60 void PingPong::shutdown(){ 115 61 logging_info( "shutting down PingPong service ..." ); 116 62 117 63 overlay->unbind( this, PingPong::PINGPONG_ID ); 118 64 Timer::stop(); 119 65 120 66 if( !startping ) abstraction->destroySpoVNet( context ); 121 67 else abstraction->leaveSpoVNet( context ); 122 68 123 69 logging_info( "PingPong service shut down" ); 124 70 } 125 }}} 126 127 Tu shut a service down after its usage, every service provides a method ''shutdown'' which is automatically called upon finishing (lines 60-70). In here, we unbind the service, stop any timers (mentioned later) and finally leave leave or destroy the SpoVNet instance, depending on the specific node's role. 114 128 115 129 116 130 131