本文整理汇总了C++中corba::ORB_ptr::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_ptr::destroy方法的具体用法?C++ ORB_ptr::destroy怎么用?C++ ORB_ptr::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_ptr
的用法示例。
在下文中一共展示了ORB_ptr::destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resolve
Components::Deployment::ServerActivator_ptr
get_server_activator (CORBA::ORB_ptr orb, CosNaming::NamingContext_ptr ns, const char* hostname)
{
cout << "Getting Component Server Activator from Qedo/Activators/" << hostname << endl;
CosNaming::Name server_activator_name;
server_activator_name.length (3);
server_activator_name[0].id = CORBA::string_dup ("Qedo");
server_activator_name[0].kind = CORBA::string_dup ("");
server_activator_name[1].id = CORBA::string_dup ("Activators");
server_activator_name[1].kind = CORBA::string_dup ("");
server_activator_name[2].id = CORBA::string_dup (hostname);
server_activator_name[2].kind = CORBA::string_dup ("");
Components::Deployment::ServerActivator_var server_activator;
CORBA::Object_var server_activator_obj;
try
{
server_activator_obj = ns->resolve (server_activator_name);
}
catch (CosNaming::NamingContext::NotFound&)
{
cerr << "Component Server Activator not found in Name Service" << endl;
orb->destroy();
exit (1);
}
catch (CORBA::SystemException&)
{
cerr << "CORBA system exception during resolve()" << endl;
orb->destroy();
exit (1);
}
try
{
server_activator = Components::Deployment::ServerActivator::_narrow (server_activator_obj);
}
catch (CORBA::SystemException&)
{
cerr << "Cannot narrow Component Server Activator" << endl;
orb->destroy();
exit (1);
}
return server_activator._retn();
}
示例2: main
int main(int argc, char ** argv)
{
try {
// init ORB
CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);
// init POA
CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj);
PortableServer::POAManager_var manager = poa->the_POAManager();
// create service
Math_operation * service = new Math_operation;
// register within the naming service
try {
CORBA::Object_var ns_obj = orb->resolve_initial_references("NameService");
if (!CORBA::is_nil(ns_obj)) {
CosNaming::NamingContext_ptr nc = CosNaming::NamingContext::_narrow(ns_obj);
CosNaming::Name name;
name.length(1);
name[0].id = CORBA::string_dup("TestServer");
name[0].kind = CORBA::string_dup("");
nc->rebind(name, service->_this());
cout << argv[0] << ": server 'TestServer' bound" << endl;
}
} catch (CosNaming::NamingContext::NotFound &) {
cerr << "not found" << endl;
} catch (CosNaming::NamingContext::InvalidName &) {
cerr << "invalid name" << endl;
} catch (CosNaming::NamingContext::CannotProceed &) {
cerr << "cannot proceed" << endl;
}
// run
manager->activate();
orb->run();
// clean up
delete service;
// quit
orb->destroy();
} catch (CORBA::UNKNOWN) {
cerr << "unknown exception" << endl;
} catch (CORBA::SystemException &) {
cerr << "system exception" << endl;
}
}
示例3: destroy_corba
//---------------------------------------------------------//
bool CServer::destroy_corba()
{
try
{
int count = 0;
char** args = 0;
CORBA::ORB_ptr orb = CORBA::ORB_init(count, args);
CORBA::release(orb);
orb->shutdown(true);
orb->destroy();
omniORB::setLogFunction(0);
}
catch(CORBA::SystemException& err)
{
LOG4CPLUS_ERROR(CServer::server_logger(),
"corba::SystemException: " << ToString(err));
}
catch(CORBA::Exception& err)
{
LOG4CPLUS_ERROR(CServer::server_logger(),
"corba::Exception: " << ToString(err));
}
catch(omniORB::fatalException& err)
{
LOG4CPLUS_ERROR(CServer::server_logger(),
"omniORB::FatalException: " << ToString(err));
}
catch (std::exception err) {
LOG4CPLUS_ERROR(CServer::server_logger(),
"std::exception occured while destroy_corba()" <<
err.what());
}
catch (...) {
LOG4CPLUS_ERROR(CServer::server_logger(),
"Unknown exception occured while destroying corba.");
};
return true;
}
示例4: run
void CORBAThread::run()
{
uint32 realCurrTime = 0;
uint32 realPrevTime = getMSTime();
uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST
CosNaming::NamingContext_var rootContext;
try
{
sLog.outBasic("Initializing CORBA...");
CORBA::ORB_ptr orb = CORBA::ORB_init(argnb,argtab,"omniORB4");
sLog.outBasic("Initializing CORBA POA...");
CORBA::Object_var obj = orb->resolve_initial_references("NameService");
rootContext = CosNaming::NamingContext::_narrow(obj);
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
if( CORBA::is_nil(rootContext) ) {
sLog.outError("RootContext configuration failed !");
}
sLog.outBasic("Prepare FirstCallBack object...");
FirstCallBack_var v = FirstCallBack::_narrow(obj);
FirstCallBack_i* FCB = new FirstCallBack_i();
// Activate the object. This tells the POA that this object is
// ready to accept requests.
PortableServer::ObjectId_var FCBid = poa->activate_object(FCB);
// Obtain a reference to the object.
FirstCallBack_var FCBref = FCB->_this();
// Decrement the reference count of the object implementation, so
// that it will be properly cleaned up when the POA has determined
// that it is no longer needed.
FCB->_remove_ref();
/** TODO : activate objects there
*/
sLog.outBasic("Activate CORBA POA Manager...");
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
if(CORBA::is_nil(v))
sLog.outError("Cannot Initialize FirstCallBack object");
else
{
CORBA::String_var src = (const char*) "Toto";
CORBA::String_var dest = v->nerzhulCB(src);
sLog.outError("String recv %s",dest);
}
sLog.outBasic("CORBA Thread launched successfuly !");
while(!MustStop())
{
// Updates
realCurrTime = getMSTime();
uint32 diff = getMSTimeDiff(realPrevTime,realCurrTime);
// Main update there if need
realPrevTime = realCurrTime;
if (diff <= CLUSTER_SLEEP_CONST+prevSleepTime)
{
prevSleepTime = CLUSTER_SLEEP_CONST+prevSleepTime-diff;
ACE_Based::Thread::Sleep(prevSleepTime);
}
else
prevSleepTime = 0;
}
sLog.outBasic("Destroy CORBA ORB...");
orb->destroy();
}
catch(CORBA::SystemException& ex)
{
sLog.outError("CORBA System Exception : %s",ex._name());
}
catch(CORBA::Exception& ex)
{
sLog.outError("CORBA Exception : %s",ex._name());
}
catch(omniORB::fatalException& ex)
{
sLog.outError("omniORB fatalException : file => %s / line => %d / error : %s",ex.file(),ex.line(),ex.errmsg());
}
sLog.outBasic("CORBA Thread finished successfuly !");
}