Commit d2e0b4a1 authored by Pavel Vainerman's avatar Pavel Vainerman

minor optimization

parent f7cf85eb
...@@ -78,6 +78,7 @@ void UniversalInterface::init() ...@@ -78,6 +78,7 @@ void UniversalInterface::init()
// NameSerivice // NameSerivice
// . ޣ // . ޣ
// localIOR // localIOR
localctx=CosNaming::NamingContext::_nil();
try try
{ {
if( CORBA::is_nil(orb) ) if( CORBA::is_nil(orb) )
...@@ -88,13 +89,20 @@ void UniversalInterface::init() ...@@ -88,13 +89,20 @@ void UniversalInterface::init()
else else
localctx = ORepHelpers::getRootNamingContext( orb, oind->getRealNodeName(uconf->getLocalNode()) ); localctx = ORepHelpers::getRootNamingContext( orb, oind->getRealNodeName(uconf->getLocalNode()) );
} }
catch(Exception& ex ) catch( Exception& ex )
{ {
if( !uconf->isLocalIOR() ) if( !uconf->isLocalIOR() )
throw ex; throw ex;
localctx=CosNaming::NamingContext::_nil(); localctx=CosNaming::NamingContext::_nil();
} }
catch( ... )
{
if( !uconf->isLocalIOR() )
throw;
localctx=CosNaming::NamingContext::_nil();
}
} }
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
void UniversalInterface::initBackId( UniSetTypes::ObjectId backid ) void UniversalInterface::initBackId( UniSetTypes::ObjectId backid )
...@@ -1563,27 +1571,22 @@ void UniversalInterface::registered( UniSetTypes::ObjectId id, UniSetTypes::Obje ...@@ -1563,27 +1571,22 @@ void UniversalInterface::registered( UniSetTypes::ObjectId id, UniSetTypes::Obje
{ {
// ޣ // ޣ
// IOR // IOR
// ݣ
// NameService (omniNames)
if( uconf->isLocalIOR() ) if( uconf->isLocalIOR() )
{ {
if( CORBA::is_nil(orb) ) if( CORBA::is_nil(orb) )
orb = uconf->getORB(); orb = uconf->getORB();
string sior(orb->object_to_string(oRef)); uconf->iorfile.setIOR(id,node,orb->object_to_string(oRef));
uconf->iorfile.setIOR(id,node,sior);
return; return;
} }
try try
{ {
string nm=oind->getNameById(id, node); rep.registration(oind->getNameById(id, node),oRef,(bool)force);
rep.registration(nm,oRef,(bool)force);
} }
catch(Exception& ex ) catch(Exception& ex )
{ {
if( !uconf->isLocalIOR() ) throw;
throw;
} }
} }
...@@ -1591,17 +1594,18 @@ void UniversalInterface::registered( UniSetTypes::ObjectId id, UniSetTypes::Obje ...@@ -1591,17 +1594,18 @@ void UniversalInterface::registered( UniSetTypes::ObjectId id, UniSetTypes::Obje
void UniversalInterface::unregister(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node)throw(ORepFailed) void UniversalInterface::unregister(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node)throw(ORepFailed)
{ {
if( uconf->isLocalIOR() ) if( uconf->isLocalIOR() )
{
uconf->iorfile.unlinkIOR(id,node); uconf->iorfile.unlinkIOR(id,node);
return;
}
try try
{ {
string nm = oind->getNameById(id,node); rep.unregistration(oind->getNameById(id,node));
rep.unregistration(nm);
} }
catch(Exception& ex ) catch(Exception& ex )
{ {
if( !uconf->isLocalIOR() ) throw;
throw;
} }
} }
...@@ -1638,14 +1642,17 @@ ObjectPtr UniversalInterface::resolve( ObjectId rid , ObjectId node, int timeout ...@@ -1638,14 +1642,17 @@ ObjectPtr UniversalInterface::resolve( ObjectId rid , ObjectId node, int timeout
{ {
// NameService , // NameService ,
// //
if( CORBA::is_nil(localctx) ) // if( CORBA::is_nil(localctx) )
{ // {
unideb[Debug::WARN] << " IOR- " << uconf->oind->getNameById(rid,node) << endl; if( unideb.debugging(Debug::WARN) )
{
unideb[Debug::WARN] << " IOR- " << uconf->oind->getNameById(rid,node) << endl;
}
throw UniSetTypes::ResolveNameError(); throw UniSetTypes::ResolveNameError();
} // }
// NameService (omniNames) // NameService (omniNames)
unideb[Debug::WARN] << " IOR- " << uconf->oind->getNameById(rid,node) // unideb[Debug::WARN] << " IOR- " << uconf->oind->getNameById(rid,node)
<< " NameService \n"; // << " NameService \n";
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment