Changes between Version 17 and Version 18 of Documentation/Tutorial/PingPong


Ignore:
Timestamp:
Jan 22, 2009, 9:46:59 PM (16 years ago)
Author:
huebsch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Tutorial/PingPong

    v17 v18  
    10010047      logging_info( "PingPong started up" );
    10110148
    102 49      // trigger the creation of the pathload measurement module
    103 50      //PathloadMeasurement::instance( overlay );
     10249     
     10350
    10410451 }
    105105}}}
     
    108108
    109109The ''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).
     110When 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 
    111112
    112 After starting up, a service need to bind to the SpoVNet Base Overlay with its service ID (lines 44/45).
    113  
     113{{{
     11460 void PingPong::shutdown(){
     11561      logging_info( "shutting down PingPong service ..." );
     11662
     11763      overlay->unbind( this, PingPong::PINGPONG_ID );
     11864      Timer::stop();
     11965
     12066      if( !startping ) abstraction->destroySpoVNet( context );
     12167      else             abstraction->leaveSpoVNet( context );
     12268
     12369      logging_info( "PingPong service shut down" );
     12470 }
     125}}}
     126
     127Tu 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.
    114128
    115129
    116130
     131