Changeset 6471

Show
Ignore:
Timestamp:
02/15/08 14:39:58 (5 years ago)
Author:
balister
Message:

Attempt to avoid hammering omniNames during component startup. Ticket #157.

Location:
ossie/trunk/ossie/framework
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossie/trunk/ossie/framework/ApplicationFactory_impl.cpp

    r6323 r6471  
    11/**************************************************************************** 
    22  
    3 Copyright 2004, 2005, 2006, 2007 Virginia Polytechnic Institute and State University 
     3Copyright 2004, 2005, 2006, 2007, 2008 Virginia Polytechnic Institute and State University 
    44  
    55This file is part of the OSSIE Core Framework. 
     
    257257                 
    258258                // Wait for component to start 
    259                 do { 
     259                for (unsigned int delay(50000);;) { 
    260260                    try { 
    261261                        _obj = orb->get_object_from_name(waveformContext, _lookupName.c_str()); 
    262                     } catch (CosNaming::NamingContext::NotFound) { 
    263                     }; 
    264                     ///\todo Check the name not found exceptions and make certain this is correct 
    265                     ossieSupport::nsleep(0,50 * 1000); 
    266                 } while (CORBA::is_nil (_obj)); 
     262                    } catch (CosNaming::NamingContext::NotFound) {}; 
     263 
     264                    if (!CORBA::is_nil(_obj)) 
     265                        break; 
     266                     
     267                    ///\todo Figure out how to get rid of this sleep 
     268                    ossieSupport::nsleep(0, delay); 
     269                     
     270                    if (delay < 1000000) 
     271                        delay *= 2; 
     272                } 
    267273                 
    268274                // check to see if the resource is the assembly controller 
  • ossie/trunk/ossie/framework/DeviceManager_impl.cpp

    r6151 r6471  
    153153         
    154154        CORBA::Object_var _obj = CORBA::Object::_nil(); 
     155        ///\todo Convert to use iostream, you can buffer overflow with long usageName 
    155156        char nameStr[255]; 
    156157        sprintf( nameStr, "DomainName1/%s", componentPlacements[i].usageName() ); 
    157158        DEBUG(3, DevMgr, "searching for "<< nameStr); 
    158         do { 
     159        for (unsigned int delay(50000);;) { 
    159160            /// \todo sleep prevents system from beating Name Service to death, Fix better 
    160             ossieSupport::nsleep(0, 50*1000); 
    161             try { 
     161            ossieSupport::nsleep(0, delay); 
     162 
     163            try { // the call will throw if the name is not found 
    162164                _obj = orb_obj->get_object_from_name(nameStr); 
    163165            } catch (CosNaming::NamingContext::NotFound) {}; 
     166 
     167            if (!CORBA::is_nil(_obj)) 
     168                break; 
     169 
     170            if (delay < 1000000) 
     171                delay *= 2; 
    164172        } 
    165         while (CORBA::is_nil (_obj)); 
     173 
    166174        DEBUG(3, DevMgr, "found "<< nameStr); 
    167175         
     
    228236 
    229237/// \todo sleep prevents system from beating Name Service to death, Fix better 
    230     do{ 
    231       obj = orb_obj->get_object_from_name (domainManagerName); 
    232       usleep(1000); 
    233     }while(CORBA::is_nil(obj)); 
    234  
     238    for (unsigned int delay(1000);;) { 
     239 
     240        try { 
     241            obj = orb_obj->get_object_from_name (domainManagerName); 
     242        } catch (CosNaming::NamingContext::NotFound) {}; 
     243 
     244        if (!CORBA::is_nil(obj)) 
     245            break; 
     246 
     247        usleep(delay); 
     248 
     249        if (delay < 1000000) 
     250            delay *= 2; 
     251    } 
     252     
    235253    _dmnMgr = CF::DomainManager::_narrow (obj); 
    236254}