diff options
author | sergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-07 03:53:35 +0000 |
---|---|---|
committer | sergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-07 03:53:35 +0000 |
commit | ee6bf58acac1fb154b0a2c9c56929506c40e826d (patch) | |
tree | e71ed81c6dc942a66466f86a05bae5af0589ba34 /TAO/orbsvcs | |
parent | 95b91180c8fb8354eef527be0d687ed3ffca97ab (diff) | |
download | ATCD-ee6bf58acac1fb154b0a2c9c56929506c40e826d.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp | 39 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h | 1 |
2 files changed, 21 insertions, 19 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp index d5d0c74a992..3bc7b5701ef 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp @@ -17,22 +17,23 @@ #include "CosNaming_i.h" NS_NamingContext::NS_NamingContext (void) + : lock_ (0) { // Deal with faults. if (context_.open () == -1) ACE_ERROR ((LM_ERROR, "%p\n", "NS_NamingContext")); // Get the lock from the orb that knows what type is appropriate. - // @@ Nanbor, there still is an error if I use this function to get - // the lock. this->lock_ = TAO_ORB_Core_instance ()->server_factory - // ()->create_servant_lock (); - - // if orb core returned a null lock, allocate a thread mutex by - // default if (this->lock_ == 0) - // @@ We may need to add a template instantiation for this if it's - // not already defined someplace... - ACE_NEW (this->lock_, - ACE_Lock_Adapter<ACE_SYNCH_RECURSIVE_MUTEX>); + // @@ Nanbor, there still is an error if I use this function to get the lock. + // this->lock_ = TAO_ORB_Core_instance ()->server_factory ()->create_servant_lock (); + + // if orb core returned a null pointer, allocate a recursive mutex + // by default + if (this->lock_ == 0) + // @@ We may need to add a template instantiation for this if it's + // not already defined someplace... + ACE_NEW (this->lock_, + ACE_Lock_Adapter<ACE_SYNCH_RECURSIVE_MUTEX>); } NS_NamingContext::~NS_NamingContext (void) @@ -50,7 +51,7 @@ NS_NamingContext::get_context (const CosNaming::Name &name) comp_name.length (len - 1); // resolve - CORBA::Object_ptr cont_ref = resolve (comp_name, _env); + CORBA::Object_var context = resolve (comp_name, _env); // Deal with exceptions in resolve: basically, add the last component // of the name to <rest_of_name> and rethrow. @@ -65,7 +66,7 @@ NS_NamingContext::get_context (const CosNaming::Name &name) // Try narrowing object reference to a context type. CosNaming::NamingContext_ptr c; - c = CosNaming::NamingContext::_narrow (cont_ref, _env); + c = CosNaming::NamingContext::_narrow (context.in (), _env); if (_env.exception () != 0) { _env.print_exception ("NS_NamingContext::get_context - _narrow"); @@ -147,8 +148,8 @@ NS_NamingContext::bind (const CosNaming::Name& n, ACE_DEBUG ((LM_DEBUG, "bound: <%s,%s>\n", - n[0].id.in ()==0? "nil" : n[0].id.in (), - n[0].kind.in ()==0? "nil" : n[0].kind.in ())); + n[0].id.in () == 0? "nil" : n[0].id.in (), + n[0].kind.in () == 0? "nil" : n[0].kind.in () )); } } @@ -347,8 +348,8 @@ NS_NamingContext::resolve (const CosNaming::Name& n, ACE_DEBUG ((LM_DEBUG, "Trying to resolve <%s,%s>\n", - n[0].id.in (), - n[0].kind.in ())); + n[0].id.in () == 0? "nil" : n[0].id.in (), + n[0].kind.in () == 0? "nil" : n[0].kind.in ())); // Resolve the first component of the name. NS_ExtId name (n[0].id, n[0].kind); @@ -388,13 +389,13 @@ NS_NamingContext::resolve (const CosNaming::Name& n, for (CORBA::ULong i = 1; i < len; i++) rest_of_name[i-1] = n[i]; - return (cont->resolve (rest_of_name, _env)); + return cont->resolve (rest_of_name, _env); } ACE_DEBUG ((LM_DEBUG, "Resolved <%s,%s> to %08.8x\n", - n[0].id.in (), - n[0].kind.in (), + n[0].id.in () == 0? "nil" : n[0].id.in (), + n[0].kind.in () == 0? "nil" : n[0].kind.in (), item)); // If the name we had to resolve was simple, we just need to return diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h index 09296a91e69..294df2c274e 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h +++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h @@ -20,6 +20,7 @@ #include "orbsvcs/CosNamingS.h" #include "Entries.h" +#include "ace/Synch.h" class TAO_ORBSVCS_Export NS_NamingContext : public POA_CosNaming::NamingContext // = TITLE |