Changeset 20639

Show
Ignore:
Timestamp:
08/08/07 12:45:38 (1 year ago)
Author:
patrick
Message:

Merge fixes and improvements from the 2.2 branch:

r20633: De-inline the destructor. There is no point in having it inlined

in my opinion, and this makes it easier to debug.

r20634: Fixed coding standard violations in method parameter naming. No

functional changes.

r20635: Simplify URI construction.

r20636: Fixed crash-on-exit errors that appear to be caused by using

vprDEBUG in tweek::CorbaManager::run(). It doesn't exactly make
sense to me, but the problems are fixed now.

r20637: Removed commented out code and unusd #includes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.cpp

    r19729 r20639  
    2727#include <tweek/tweekConfig.h> 
    2828 
    29 #include <cstdio> 
    3029#include <sstream> 
    3130#include <boost/bind.hpp> 
    3231 
    3332#include <vpr/vpr.h> 
    34 //#include <vpr/System.h> 
    3533#include <vpr/Util/Debug.h> 
    3634#include <vpr/Util/Assert.h> 
     
    7068} 
    7169 
    72 bool CorbaManager::init(const std::string& local_id, int& argc, char** argv, 
     70CorbaManager::~CorbaManager() 
     71
     72   shutdown(); 
     73 
     74   if ( mOrbThread != NULL ) 
     75   { 
     76      delete mOrbThread; 
     77      mOrbThread = NULL; 
     78   } 
     79
     80 
     81bool CorbaManager::init(const std::string& localID, int& argc, char** argv, 
    7382                        const std::string& nsHost, const vpr::Uint16& nsPort, 
    7483                        const std::string& iiopVersion) 
     
    9099      mORB = CORBA::ORB_init(argc, argv, TWEEK_ORB_VER_STRING); 
    91100 
    92       status = createChildPOA(local_id); 
     101      status = createChildPOA(localID); 
    93102 
    94103      try 
     
    105114         else 
    106115         { 
    107             std::ostringstream port_stream; 
    108             port_stream << nsPort; 
    109  
    110             std::string ns_uri("corbaloc:iiop:"); 
    111             ns_uri += iiopVersion; 
    112             ns_uri += std::string("@"); 
    113             ns_uri += nsHost; 
    114             ns_uri += std::string(":"); 
    115             ns_uri += port_stream.str(); 
    116             ns_uri += std::string("/NameService"); 
    117  
    118             mRootContext = tweek::getRootNamingContextByURI(mORB, ns_uri); 
     116            std::ostringstream uri_stream; 
     117            uri_stream << "corbaloc:iiop:" << iiopVersion << "@" << nsHost 
     118                       << ":" << nsPort << "/NameService"; 
     119            mRootContext = tweek::getRootNamingContextByURI(mORB, 
     120                                                            uri_stream.str()); 
    119121         } 
    120122 
     
    402404// ============================================================================ 
    403405 
    404 bool CorbaManager::createChildPOA(const std::string& local_id
     406bool CorbaManager::createChildPOA(const std::string& localID
    405407{ 
    406408   bool status(true); 
     
    434436      PortableServer::ThreadPolicy::_duplicate(thread_policy); 
    435437 
    436    std::string poa_name = "tweek_" + local_id
     438   std::string poa_name = "tweek_" + localID
    437439 
    438440   try 
     
    468470void CorbaManager::run() 
    469471{ 
    470    vprDEBUG(tweekDBG_CORBA, vprDBG_STATE_LVL) << "Server is running!\n" 
    471                                               << vprDEBUG_FLUSH; 
    472  
     472   // NOTE: Do not put uses of vprDEBUG here. It can cause crashes on exit 
     473   // as singletons are destroyed. 
    473474   PortableServer::POAManager_var pman = mChildPOA->the_POAManager(); 
    474475 
    475476   pman->activate(); 
    476477   mORB->run(); 
    477 //   mORB->destroy(); 
    478  
    479    vprDEBUG(tweekDBG_CORBA, vprDBG_STATE_LVL) << "Server has shut down\n" 
    480                                               << vprDEBUG_FLUSH; 
    481478} 
    482479 
  • juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.h

    r19729 r20639  
    7070    *       stopped. 
    7171    */ 
    72    ~CorbaManager() 
    73    { 
    74       shutdown(); 
    75  
    76       if ( mOrbThread != NULL ) 
    77       { 
    78          delete mOrbThread; 
    79          mOrbThread = NULL; 
    80       } 
    81    } 
     72   ~CorbaManager(); 
    8273 
    8374   /** 
     
    8677    * manager are activated within that child POA. 
    8778    * 
    88     * @param localId     A string providing a unique identifier for the local 
     79    * @param localID     A string providing a unique identifier for the local 
    8980    *                    POA. 
    9081    * @param argc        The size of the following argument vector.  This will 
     
    109100    *                    "1.2".  It defaults to "1.0". 
    110101    */ 
    111    bool init(const std::string& localId, int& argc, char** argv, 
     102   bool init(const std::string& localID, int& argc, char** argv, 
    112103             const std::string& nsHost = std::string(""), 
    113104             const vpr::Uint16& nsPort = vpr::Uint16(2809), 
     
    120111    *       they are destroyed and shut down. 
    121112    * 
    122     * @param wait_for_completion If true, block until all pending requests and 
    123     *                            events are completed.  This parameter is 
    124     *                            optional and defaults to true. 
    125     */ 
    126    void shutdown(bool wait_for_completion = true); 
     113    * @param waitForCompletion If true, block until all pending requests and 
     114    *                          events are completed.  This parameter is 
     115    *                          optional and defaults to true. 
     116    */ 
     117   void shutdown(bool waitForCompletion = true); 
    127118 
    128119   /** 
     
    194185 
    195186private: 
    196    bool createChildPOA(const std::string& local_id); 
     187   bool createChildPOA(const std::string& localID); 
    197188 
    198189   std::string mAppName;