Changeset 20639
- Timestamp:
- 08/08/07 12:45:38 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.cpp
r19729 r20639 27 27 #include <tweek/tweekConfig.h> 28 28 29 #include <cstdio>30 29 #include <sstream> 31 30 #include <boost/bind.hpp> 32 31 33 32 #include <vpr/vpr.h> 34 //#include <vpr/System.h>35 33 #include <vpr/Util/Debug.h> 36 34 #include <vpr/Util/Assert.h> … … 70 68 } 71 69 72 bool CorbaManager::init(const std::string& local_id, int& argc, char** argv, 70 CorbaManager::~CorbaManager() 71 { 72 shutdown(); 73 74 if ( mOrbThread != NULL ) 75 { 76 delete mOrbThread; 77 mOrbThread = NULL; 78 } 79 } 80 81 bool CorbaManager::init(const std::string& localID, int& argc, char** argv, 73 82 const std::string& nsHost, const vpr::Uint16& nsPort, 74 83 const std::string& iiopVersion) … … 90 99 mORB = CORBA::ORB_init(argc, argv, TWEEK_ORB_VER_STRING); 91 100 92 status = createChildPOA(local _id);101 status = createChildPOA(localID); 93 102 94 103 try … … 105 114 else 106 115 { 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()); 119 121 } 120 122 … … 402 404 // ============================================================================ 403 405 404 bool CorbaManager::createChildPOA(const std::string& local _id)406 bool CorbaManager::createChildPOA(const std::string& localID) 405 407 { 406 408 bool status(true); … … 434 436 PortableServer::ThreadPolicy::_duplicate(thread_policy); 435 437 436 std::string poa_name = "tweek_" + local _id;438 std::string poa_name = "tweek_" + localID; 437 439 438 440 try … … 468 470 void CorbaManager::run() 469 471 { 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. 473 474 PortableServer::POAManager_var pman = mChildPOA->the_POAManager(); 474 475 475 476 pman->activate(); 476 477 mORB->run(); 477 // mORB->destroy();478 479 vprDEBUG(tweekDBG_CORBA, vprDBG_STATE_LVL) << "Server has shut down\n"480 << vprDEBUG_FLUSH;481 478 } 482 479 juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.h
r19729 r20639 70 70 * stopped. 71 71 */ 72 ~CorbaManager() 73 { 74 shutdown(); 75 76 if ( mOrbThread != NULL ) 77 { 78 delete mOrbThread; 79 mOrbThread = NULL; 80 } 81 } 72 ~CorbaManager(); 82 73 83 74 /** … … 86 77 * manager are activated within that child POA. 87 78 * 88 * @param localI dA string providing a unique identifier for the local79 * @param localID A string providing a unique identifier for the local 89 80 * POA. 90 81 * @param argc The size of the following argument vector. This will … … 109 100 * "1.2". It defaults to "1.0". 110 101 */ 111 bool init(const std::string& localI d, int& argc, char** argv,102 bool init(const std::string& localID, int& argc, char** argv, 112 103 const std::string& nsHost = std::string(""), 113 104 const vpr::Uint16& nsPort = vpr::Uint16(2809), … … 120 111 * they are destroyed and shut down. 121 112 * 122 * @param wait _for_completion If true, block until all pending requests and123 * events are completed. This parameter is124 * 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); 127 118 128 119 /** … … 194 185 195 186 private: 196 bool createChildPOA(const std::string& local _id);187 bool createChildPOA(const std::string& localID); 197 188 198 189 std::string mAppName;
