diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-04-15 06:10:11 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-04-15 06:10:11 +0000 |
commit | e889c3b1f5bda6815de0b112e4abe5296a89d007 (patch) | |
tree | 06631fad7478770d35341816c14205eac1e6cba8 | |
parent | 720f6211fbaf4a02da05ef84ac6d5d24230a6616 (diff) | |
download | ATCD-e889c3b1f5bda6815de0b112e4abe5296a89d007.tar.gz |
ChangeLogTag:Wed Apr 14 23:07:54 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
24 files changed, 763 insertions, 512 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index c5b7e34d3a8..f5b048cc9ff 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,12 +1,107 @@ +Wed Apr 14 23:07:54 2004 Ossama Othman <ossama@dre.vanderbilt.edu> + + * tao/Abstract_Servant_Base.h: + * tao/Adapter.h: + * tao/Any.h: + + Include "tao/CORBA_methods.h" before "tao/Pseudo_VarOut_T.h" to + make sure CORBA::release() overrides are declared prior to + parsing the TAO_Pseudo_{Var,Out}_T template. Addresses g++ 3.4 + pre-release compile-time failures. + + * tao/Adapter.cpp: + * tao/ORB_Core.h: + * tao/DynamicInterface/Request.h: + * tao/Valuetype/AbstractBase.h: + + Reordered includes to prevent TAO_Pseudo_{Var,Out}_T template + from being parsed prior to declaring all types that could be + potential template parameters. + + * tao/CORBA_methods.h: + + Reverted change that added CORBA::ExceptionList related types + and functions to this header due to inconsistent DLL linkage + issues on MS Windows. + + * tao/Pseudo_VarOut_T.h: + + Do not include "tao/CORBA_methods.h" in this header. It + introduced compilation issues in g++ 3.4 pre-release builds due + to the fact some necessary types were declared after the + TAO_Pseudo_{Var,Out}_T template was parsed, essentially making + the type invisible to the template. This is due to the fact + that g++ 3.4.x performs name lookups and binding at template + parsing time, not instantiation time. + + * tao/default_environment.h: + + Include "tao/TAO_Export.h" to pull in TAO_Export macro + definitions. + + * tao/DynamicInterface/DII_CORBA_methods.h: + + Moved all DII related functions in the CORBA namespace + (e.g. release()) to this new header. This header makes it + easier to declare CORBA::release() prototypes before the + TAO_Pseudo_{Var,Out}_T templates are parsed. + + * tao/DynamicInterface/Context.h: + * tao/DynamicInterface/ExceptionList.h: + + Moved all DII related functions in the CORBA namespace + (e.g. release()) to the new DLL_CORBA_methods.h header. + + Include the new DII_CORBA_methods.h header before + tao/Pseudo_VarOut_T.h to make sure the DII types and functions + we care about are declared before the TAO_Pseudo_{Var,Out}_T + templates are parsed. Addresses g++ 3.4.x compile-time issues. + + * tao/DynamicInterface/ExceptionList.inl: + + Nuked trailing whitespace. + + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h (internals_): + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h (internals_): + + Declared this mutex member as "mutable" so that performing a + const_cast<> in const methods is unnecessary. + + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp: + + Removed all const_cast<> mutex hacks in const methods. They are + no longer necessary since the mutex member (internals_) is now + mutable. + + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h: + + Removed "InternalGuard" typedef. It is no longer used. + + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp: + + Replaced all ACE_Guard uses with the corresponding ACE_GUARD + macro. Addresses unused variable warnings. + + * orbsvcs/tests/Security/Big_Request/client.cpp: + + Cosmetic changes. + + * tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h: + * tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h: + + Made destructor protected to enforce proper memory management + through reference counting. + Wed Apr 14 17:48:40 2004 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: - + Fixed generation of TAO::Objref_Traits<>::tao_marshal() method to check for a null object reference. - + * TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp: - + Removed file, visitor is no longer used. Wed Apr 14 12:39:37 2004 Chad Elliott <elliott_c@ociweb.com> diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp index 35259445c96..35ba02315f6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -1,16 +1,17 @@ -// -*- C++ -*- -// // $Id$ #include "PG_Object_Group.h" #include "PG_conf.h" +#include "PG_Operators.h" // Borrow operator== on CosNaming::Name +#include "PG_Utils.h" + +#include "tao/PortableServer/ORB_Manager.h" +#include "tao/debug.h" + #include "ace/Get_Opt.h" #include "ace/Vector_T.h" -#include "tao/debug.h" -#include "tao/PortableServer/ORB_Manager.h" -#include "orbsvcs/orbsvcs/PortableGroup/PG_Operators.h" // Borrow operator == on CosNaming::Name -#include "orbsvcs/orbsvcs/PortableGroup/PG_Utils.h" + // Borland C++ 6 Update Pack 4 and earlier give a warning about comparing // signed and unsigned values in the minimum_polulate() and @@ -32,7 +33,7 @@ TAO::PG_Object_Group::MemberInfo::MemberInfo ( CORBA::Object_ptr member, const PortableGroup::Location & location) : member_ (CORBA::Object::_duplicate (member)) - , factory_(PortableGroup::GenericFactory::_nil()) + , factory_(PortableGroup::GenericFactory::_nil ()) , location_ (location) , is_primary_ (0) { @@ -87,22 +88,26 @@ TAO::PG_Object_Group::PG_Object_Group ( { } -TAO::PG_Object_Group::~PG_Object_Group () +TAO::PG_Object_Group::~PG_Object_Group (void) { for (MemberMap_Iterator it = this->members_.begin(); it != this->members_.end(); ++it) - { - MemberInfo * member = (*it).int_id_; - delete member; - } + { + MemberInfo * member = (*it).int_id_; + delete member; + } this->members_.unbind_all (); } #if 0 // may want this again someday ///////////////////// // q&d debug function -static void dump_ior (const char * base, const char * ext, unsigned long version, const char * iogr) +static void +dump_ior (const char * base, + const char * ext, + unsigned long version, + const char * iogr) { char filename[1000]; ACE_OS::sprintf(filename, "%s_%lu.%s", base, version, ext ); @@ -113,54 +118,69 @@ static void dump_ior (const char * base, const char * ext, unsigned long version } #endif // may want this again someday -PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group::reference()const +PortableGroup::ObjectGroup_ptr +TAO::PG_Object_Group::reference (void) const { - // const cast to simulate mutable - InternalGuard guard(ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + PortableGroup::ObjectGroup::_nil ()); return PortableGroup::ObjectGroup::_duplicate (this->reference_); } -void TAO::PG_Object_Group::get_group_specific_factories (PortableGroup::FactoryInfos & result) const +void +TAO::PG_Object_Group::get_group_specific_factories ( + PortableGroup::FactoryInfos & result) const { - // const cast to simulate mutable - InternalGuard guard(ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); + // copy is needed to have some semblance of thread safeness. // if performance is an issue avoid this method. result = this->group_specific_factories_; } -const PortableGroup::Location & TAO::PG_Object_Group::get_primary_location() const +const PortableGroup::Location & +TAO::PG_Object_Group::get_primary_location (void) const { - // const cast to simulate mutable - InternalGuard guard(ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + this->primary_location_); return this->primary_location_; } -PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group::add_member_to_iogr( - CORBA::Object_ptr member - ACE_ENV_ARG_DECL) +PortableGroup::ObjectGroup_ptr +TAO::PG_Object_Group::add_member_to_iogr (CORBA::Object_ptr member + ACE_ENV_ARG_DECL) { // assume internals is locked - PortableGroup::ObjectGroup_var result = PortableGroup::ObjectGroup::_nil(); + PortableGroup::ObjectGroup_var result; + //////////////////////////// // @@ HACK ALERT - // The PortableGroup::ObjectGroupManager creates an object reference containing - // a dummy entry so it will have a place to store the tagged group component. - // If this is the first entry, we need to remove that entry once we have a *real* member. - // This can be avoided when we get support for TAG_MULTIPLE_COMPONENTS - // For now, we already have a copy of the tagGroupTagged component and we're going to use - // it below wen we increment the group version so we can clean out the dummy entry. - PortableGroup::ObjectGroup_var cleaned = PortableGroup::ObjectGroup::_duplicate (this->reference_.in ()); + // The PortableGroup::ObjectGroupManager creates an object reference + // containing a dummy entry so it will have a place to store the + // tagged group component. If this is the first entry, we need to + // remove that entry once we have a *real* member. This can be + // avoided when we get support for TAG_MULTIPLE_COMPONENTS. For + // now, we already have a copy of the tagGroupTagged component and + // we're going to use it below wen we increment the group version so + // we can clean out the dummy entry. + PortableGroup::ObjectGroup_var cleaned = + PortableGroup::ObjectGroup::_duplicate (this->reference_.in ()); if (this->empty_) - { - // remove the original profile. It's a dummy entry supplied by create_object. - cleaned = - this->manipulator_.remove_profiles (cleaned.in (), this->reference_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableGroup::ObjectGroup::_nil()); - this->empty_ = 0; - } + { + // remove the original profile. It's a dummy entry supplied by + // create_object. + cleaned = + this->manipulator_.remove_profiles (cleaned.in (), + this->reference_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (PortableGroup::ObjectGroup::_nil()); + this->empty_ = 0; + } // create a list of references to be merged TAO_IOP::TAO_IOR_Manipulation::IORList iors (2); @@ -175,19 +195,19 @@ PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group::add_member_to_iogr( return result._retn (); } -void TAO::PG_Object_Group::add_member ( - const PortableGroup::Location & the_location, - CORBA::Object_ptr member - ACE_ENV_ARG_DECL) +void +TAO::PG_Object_Group::add_member (const PortableGroup::Location & the_location, + CORBA::Object_ptr member + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectNotAdded)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); ///////////////////////////////////////// // Convert the new member to a string IOR - // This keeps a clean IOR (not and IOGR!) + // This keeps a clean IOR (not an IOGR!) // while we add it to a group. We need a // IORs, not IOGRs to send new IOGRs out // to replicas. @@ -202,7 +222,6 @@ void TAO::PG_Object_Group::add_member ( ACE_ENV_ARG_PARAMETER); ACE_CHECK; - // Convert new member back to a (non group) ior. CORBA::Object_var member_ior = this->orb_->string_to_object (member_ior_string.in () @@ -211,8 +230,8 @@ void TAO::PG_Object_Group::add_member ( MemberInfo * info = 0; ACE_NEW_THROW_EX (info, - MemberInfo(member_ior.in(), - the_location), + MemberInfo (member_ior.in (), + the_location), CORBA::NO_MEMORY()); if (this->members_.bind (the_location, info) != 0) @@ -221,210 +240,236 @@ void TAO::PG_Object_Group::add_member ( ACE_THROW(CORBA::NO_MEMORY()); } - this->reference_ = new_reference; // note var-to-var assignment does a duplicate + this->reference_ = new_reference; // note var-to-var assignment does + // a duplicate if (this->increment_version ()) - { - this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } + { + this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } else - { - ACE_THROW (PortableGroup::ObjectNotAdded ()); - } + { + ACE_THROW (PortableGroup::ObjectNotAdded ()); + } if (TAO_debug_level > 6) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("PG (%P|%t) exit Object_Group add_member \n"))); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("PG (%P|%t) exit Object_Group add_member \n"))); + } } -int TAO::PG_Object_Group::set_primary_member ( - TAO_IOP::TAO_IOR_Property * prop, - const PortableGroup::Location & the_location - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , PortableGroup::MemberNotFound - )) +int +TAO::PG_Object_Group::set_primary_member ( + TAO_IOP::TAO_IOR_Property * prop, + const PortableGroup::Location & the_location + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableGroup::MemberNotFound)) { - InternalGuard guard(this->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + 0); int result = 1; MemberInfo * info; if (this->members_.find (the_location, info) == 0) - { - int cleared = 0; - this->primary_location_ = the_location; - for (MemberMap_Iterator it = this->members_.begin(); - !cleared && it != this->members_.end(); - ++it) { - cleared = (*it).int_id_->is_primary_; - (*it).int_id_->is_primary_ = 0; - } - info->is_primary_ = 1; + int cleared = 0; + this->primary_location_ = the_location; + for (MemberMap_Iterator it = this->members_.begin(); + !cleared && it != this->members_.end(); + ++it) + { + cleared = (*it).int_id_->is_primary_; + (*it).int_id_->is_primary_ = 0; + } + info->is_primary_ = 1; - int set_ok = this->manipulator_.set_primary (prop, this->reference_.in (), info->member_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - if (! set_ok) - { - if (TAO_debug_level > 3) - { - ACE_ERROR ( (LM_ERROR, - ACE_TEXT ("%T %n (%P|%t) - Can't set primary in IOGR .\n") - )); - } + int set_ok = + this->manipulator_.set_primary (prop, + this->reference_.in (), + info->member_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + if (!set_ok) + { + if (TAO_debug_level > 3) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%T %n (%P|%t) - ") + ACE_TEXT ("Can't set primary in IOGR .\n") + )); + } //@@: ACE_THROW (FT::PrimaryNotSet()); - result = 0; - } + result = 0; + } - if (result && this->increment_version()) - { - this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + if (result && this->increment_version ()) + { + this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + else + { + if (TAO_debug_level > 3) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO-PG (%P|%t) - set_primary_location ") + ACE_TEXT("throwing PrimaryNotSet because increment") + ACE_TEXT("version failed.\n") + )); + } +//@@: ACE_THROW (FT::PrimaryNotSet()); + result = 0; + } } - else + else { if (TAO_debug_level > 3) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO-PG (%P|%t) - set_primary_location throwing PrimaryNotSet because increment version failed.\n") - )); - } -//@@: ACE_THROW (FT::PrimaryNotSet()); - result = 0; + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO-PG (%P|%t) - set_primary_location ") + ACE_TEXT ("throwing MemberNotFound.\n"))); + } + ACE_THROW_RETURN (PortableGroup::MemberNotFound(), + -1); } - } - else - { - if (TAO_debug_level > 3) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO-PG (%P|%t) - set_primary_location ") - ACE_TEXT ("throwing MemberNotFound.\n"))); - } - ACE_THROW_RETURN (PortableGroup::MemberNotFound(), - -1); - } + return result; } -void TAO::PG_Object_Group::remove_member ( +void +TAO::PG_Object_Group::remove_member ( const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException, PortableGroup::MemberNotFound)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); MemberInfo * info; if (this->members_.unbind (the_location, info) == 0) - { - if (this->members_.current_size() > 0) - { - this->reference_ = - this->manipulator_.remove_profiles (this->reference_.in (), info->member_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - else { - empty_ = 1; - } + if (this->members_.current_size() > 0) + { + this->reference_ = + this->manipulator_.remove_profiles (this->reference_.in (), + info->member_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + { + empty_ = 1; + } - delete info; + delete info; - if (the_location == this->primary_location_) - { - this->primary_location_.length(0); - } + if (the_location == this->primary_location_) + { + this->primary_location_.length(0); + } - if (this->increment_version ()) - { - this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } + if (this->increment_version ()) + { + this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } - } + } else - { - if (TAO_debug_level > 6) { - - ACE_DEBUG ((LM_DEBUG, - "TAO-PG (%P|%t) - remove_member throwing MemberNotFound.\n" - )); + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + "TAO-PG (%P|%t) - " + "remove_member throwing MemberNotFound.\n" + )); + } + ACE_THROW (PortableGroup::MemberNotFound() ); } - ACE_THROW (PortableGroup::MemberNotFound() ); - } } -PortableGroup::ObjectGroupId TAO::PG_Object_Group::get_object_group_id () const +PortableGroup::ObjectGroupId +TAO::PG_Object_Group::get_object_group_id (void) const { - // const cast to simulate mutable - InternalGuard guard(ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + 0); return this->tagged_component_.object_group_id; } -void TAO::PG_Object_Group::set_properties_dynamically ( +void +TAO::PG_Object_Group::set_properties_dynamically ( const PortableGroup::Properties & overrides ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { - InternalGuard guard (this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); this->properties_.decode (overrides ACE_ENV_ARG_PARAMETER); //@@ int todo_override_rather_than_replace? } -void TAO::PG_Object_Group::get_properties (PortableGroup::Properties_var & result) const +void +TAO::PG_Object_Group::get_properties ( + PortableGroup::Properties_var & result) const ACE_THROW_SPEC ((CORBA::SystemException)) { - // const cast to simulate mutable - InternalGuard guard (ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); this->properties_.export_properties(*result); } -PortableGroup::TypeId TAO::PG_Object_Group::get_type_id () const +PortableGroup::TypeId +TAO::PG_Object_Group::get_type_id (void) const { - // const cast to simulate mutable - InternalGuard guard(ACE_const_cast (TAO::PG_Object_Group *, this)->internals_); - return CORBA::string_dup(this->type_id_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + 0); + return CORBA::string_dup (this->type_id_); } /////////////////// // Internal method -int TAO::PG_Object_Group::increment_version () +int +TAO::PG_Object_Group::increment_version (void) { // assume internals is locked int result = 0; this->tagged_component_.object_group_ref_version += 1; if (TAO_debug_level > 3) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%T %n (%P|%t) - Setting IOGR version to %u\n"), - ACE_static_cast(unsigned, this->tagged_component_.object_group_ref_version) - )); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%T %n (%P|%t) - Setting IOGR version to %u\n"), + ACE_static_cast (unsigned, + this->tagged_component_.object_group_ref_version) + )); + } // Set the version - if ( TAO::PG_Utils::set_tagged_component (this->reference_, this->tagged_component_) ) - { - result = 1; - } + if (TAO::PG_Utils::set_tagged_component (this->reference_, + this->tagged_component_)) + { + result = 1; + } return result; } ////////////////// // Internal method -void TAO::PG_Object_Group::distribute_iogr (ACE_ENV_SINGLE_ARG_DECL) +void +TAO::PG_Object_Group::distribute_iogr (ACE_ENV_SINGLE_ARG_DECL) { // assume internals is locked CORBA::String_var iogr = @@ -433,63 +478,71 @@ void TAO::PG_Object_Group::distribute_iogr (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; // size_t n_rep = 0; // for dump_ior below - for ( MemberMap_Iterator it = this->members_.begin(); - it != this->members_.end(); - ++it) - { - MemberInfo const * info = (*it).int_id_; - // - // Unchecked narrow means the member doesn't have to actually implement the TAO_UpdateObjectGroup interface - // PortableGroup::TAO_UpdateObjectGroup_var uog = PortableGroup::TAO_UpdateObjectGroup::_unchecked_narrow ( info->member_); - // but it doesn work: error message at replica is: - // TAO-FT (2996|976) - Wrong version information within the interceptor [1 | 0] - // TAO_Perfect_Hash_OpTable:find for operation 'tao_update_object_group' (length=23) failed - // back to using _narrow - PortableGroup::TAO_UpdateObjectGroup_var uog = - PortableGroup::TAO_UpdateObjectGroup::_narrow ( info->member_.in ()); - if (! CORBA::is_nil (uog.in ()) ) + for (MemberMap_Iterator it = this->members_.begin(); + it != this->members_.end (); + ++it) { - ACE_TRY_NEW_ENV - { - if (TAO_debug_level > 3) + MemberInfo const * info = (*it).int_id_; + // + // Unchecked narrow means the member doesn't have to actually implement the TAO_UpdateObjectGroup interface + // PortableGroup::TAO_UpdateObjectGroup_var uog = PortableGroup::TAO_UpdateObjectGroup::_unchecked_narrow ( info->member_); + // but it doesn work: error message at replica is: + // TAO-FT (2996|976) - Wrong version information within the interceptor [1 | 0] + // TAO_Perfect_Hash_OpTable:find for operation 'tao_update_object_group' (length=23) failed + // back to using _narrow + PortableGroup::TAO_UpdateObjectGroup_var uog = + PortableGroup::TAO_UpdateObjectGroup::_narrow ( info->member_.in ()); + if (!CORBA::is_nil (uog.in ())) { - ACE_DEBUG ((LM_DEBUG, - "PG (%P|%t) - Object_Group pushing IOGR to %s member: %s@%s.\n", - (info->is_primary_ ? "Primary" : "Backup"), - this->role_.c_str(), - ACE_static_cast(const char *, info->location_[0].id) - )); + ACE_TRY_NEW_ENV + { + if (TAO_debug_level > 3) + { + ACE_DEBUG ((LM_DEBUG, + "PG (%P|%t) - Object_Group pushing " + "IOGR to %s member: %s@%s.\n", + (info->is_primary_ ? "Primary" : "Backup"), + this->role_.c_str (), + ACE_static_cast (const char *, + info->location_[0].id) + )); + } + // dump_ior ("group", "iogr", this->tagged_component_.object_group_ref_version, iogr); + // CORBA::String_var replica_ior = this->orb_->object_to_string(uog.in() ACE_ENV_ARG_PARAMETER); + // dump_ior (info->location_[0].id, "ior", (this->tagged_component_.object_group_ref_version * 100) + n_rep++, replica_ior); + uog->tao_update_object_group (iogr.in (), + this->tagged_component_.object_group_ref_version, + info->is_primary_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // we expect an exception + // tao_update_object_group is not a real method + } + ACE_ENDTRY; + } + else + { + ACE_ERROR ((LM_ERROR, + "TAO::PG_Object_Group::distribute iogr can't " + "narrow member reference to " + "PortableGroup::TAO_UpdateObjectGroup.\n" + )); } -// dump_ior ("group", "iogr", this->tagged_component_.object_group_ref_version, iogr); -// CORBA::String_var replica_ior = this->orb_->object_to_string(uog.in() ACE_ENV_ARG_PARAMETER); -// dump_ior (info->location_[0].id, "ior", (this->tagged_component_.object_group_ref_version * 100) + n_rep++, replica_ior); - uog->tao_update_object_group (iogr.in (), - this->tagged_component_.object_group_ref_version, - info->is_primary_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - // we expect an exception - // tao_update_object_group is not a real method - } - ACE_ENDTRY; - } - else - { - ACE_ERROR ((LM_ERROR, - "TAO::PG_Object_Group::distribute iogr can't narrow member reference to PortableGroup::TAO_UpdateObjectGroup.\n" - )); } - } } -PortableGroup::Locations * TAO::PG_Object_Group::locations_of_members (ACE_ENV_SINGLE_ARG_DECL) +PortableGroup::Locations * +TAO::PG_Object_Group::locations_of_members (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - InternalGuard guard(this->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + 0); + PortableGroup::Locations * result = 0; size_t count = this->members_.current_size (); @@ -514,61 +567,76 @@ PortableGroup::Locations * TAO::PG_Object_Group::locations_of_members (ACE_ENV_S return result; } -CORBA::Object_ptr TAO::PG_Object_Group::get_member_reference ( +CORBA::Object_ptr +TAO::PG_Object_Group::get_member_reference ( const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, PortableGroup::MemberNotFound)) { - InternalGuard guard(this->internals_); - CORBA::Object_var result = CORBA::Object::_nil (); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->internals_, + CORBA::Object::_nil ()); + + CORBA::Object_var result; MemberInfo * info; if (this->members_.find (the_location, info) == 0) - { - result = CORBA::Object::_duplicate(info->member_.in ()); - } + { + result = CORBA::Object::_duplicate (info->member_.in ()); + } else - { - ACE_THROW_RETURN (PortableGroup::MemberNotFound(), result._retn ()); - } + { + ACE_THROW_RETURN (PortableGroup::MemberNotFound(), result._retn ()); + } return result._retn (); } -PortableGroup::MembershipStyleValue TAO::PG_Object_Group::get_membership_style () const +PortableGroup::MembershipStyleValue +TAO::PG_Object_Group::get_membership_style (void) const { PortableGroup::MembershipStyleValue membership_style = 0; - if (! TAO::find (properties_, PortableGroup::PG_MEMBERSHIP_STYLE, membership_style)) - { - membership_style = TAO_PG_MEMBERSHIP_STYLE; - } + if (!TAO::find (properties_, + PortableGroup::PG_MEMBERSHIP_STYLE, + membership_style)) + { + membership_style = TAO_PG_MEMBERSHIP_STYLE; + } return membership_style; } -PortableGroup::MinimumNumberMembersValue TAO::PG_Object_Group::get_minimum_number_members () const +PortableGroup::MinimumNumberMembersValue +TAO::PG_Object_Group::get_minimum_number_members (void) const { PortableGroup::MinimumNumberMembersValue minimum_number_members = 0; - if (! TAO::find (properties_, PortableGroup::PG_MINIMUM_NUMBER_MEMBERS, minimum_number_members)) - { - minimum_number_members = TAO_PG_MINIMUM_NUMBER_MEMBERS; - } + if (!TAO::find (properties_, + PortableGroup::PG_MINIMUM_NUMBER_MEMBERS, + minimum_number_members)) + { + minimum_number_members = TAO_PG_MINIMUM_NUMBER_MEMBERS; + } return minimum_number_members; } -PortableGroup::InitialNumberMembersValue TAO::PG_Object_Group::get_initial_number_members () const +PortableGroup::InitialNumberMembersValue +TAO::PG_Object_Group::get_initial_number_members (void) const { PortableGroup::InitialNumberMembersValue initial_number_members = 0; - if (! TAO::find (properties_, PortableGroup::PG_INITIAL_NUMBER_MEMBERS, initial_number_members)) - { - initial_number_members = TAO_PG_INITIAL_NUMBER_MEMBERS; - } + if (!TAO::find (properties_, + PortableGroup::PG_INITIAL_NUMBER_MEMBERS, + initial_number_members)) + { + initial_number_members = TAO_PG_INITIAL_NUMBER_MEMBERS; + } return initial_number_members; } -void TAO::PG_Object_Group::create_member ( +void +TAO::PG_Object_Group::create_member ( const PortableGroup::Location & the_location, const char * type_id, const PortableGroup::Criteria & the_criteria @@ -580,98 +648,103 @@ void TAO::PG_Object_Group::create_member ( PortableGroup::InvalidCriteria, PortableGroup::CannotMeetCriteria)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); + if (0 != this->members_.find (the_location)) - { - // @@ what if factories were passed as criteria? + { + // @@ what if factories were passed as criteria? - CORBA::String_var factory_type; - PortableGroup::FactoryInfos_var factories = - this->factory_registry_->list_factories_by_role ( + CORBA::String_var factory_type; + PortableGroup::FactoryInfos_var factories = + this->factory_registry_->list_factories_by_role ( role_.c_str(), factory_type.out () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // @@ what if factory_type != type_id != this->type_id_ - - int created = 0; // bool - CORBA::ULong factory_count = factories->length (); - for (CORBA::ULong factory_pos = 0; - ! created && factory_pos < factory_count; - ++factory_pos) - { - const PortableGroup::FactoryInfo & factory_info = (*factories)[factory_pos]; - if (factory_info.the_location == the_location) - { - // @@ should we merge the_criteria with factory_info.the_criteria? - - PortableGroup::GenericFactory::FactoryCreationId_var fcid; - CORBA::Object_var member = factory_info.the_factory->create_object ( - type_id, - the_criteria, - fcid. out() - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // convert the new member to a stringified IOR to avoid contamination with group info - CORBA::String_var member_ior_string = - orb_->object_to_string (member.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK; - PortableGroup::ObjectGroup_var new_reference = - this->add_member_to_iogr (member.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + // @@ what if factory_type != type_id != this->type_id_ - // Convert new member back to a (non group) ior. - CORBA::Object_var member_ior = - this->orb_->string_to_object (member_ior_string.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - MemberInfo * info = 0; - ACE_NEW_THROW_EX (info, MemberInfo( - member_ior.in(), - the_location, - factory_info.the_factory, - fcid.in ()), - CORBA::NO_MEMORY()); - ACE_CHECK; - - if (this->members_.bind (the_location, info) != 0) + int created = 0; // bool + CORBA::ULong factory_count = factories->length (); + for (CORBA::ULong factory_pos = 0; + ! created && factory_pos < factory_count; + ++factory_pos) { - ACE_THROW(CORBA::NO_MEMORY()); - } + const PortableGroup::FactoryInfo & factory_info = + (*factories)[factory_pos]; + if (factory_info.the_location == the_location) + { + // @@ should we merge the_criteria with + // factory_info.the_criteria? + + PortableGroup::GenericFactory::FactoryCreationId_var fcid; + CORBA::Object_var member = + factory_info.the_factory->create_object ( + type_id, + the_criteria, + fcid. out() + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // convert the new member to a stringified IOR to avoid + // contamination with group info + CORBA::String_var member_ior_string = + orb_->object_to_string (member.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - this->reference_ = new_reference; // note var-to-var assignment does a duplicate - if (this->increment_version ()) + PortableGroup::ObjectGroup_var new_reference = + this->add_member_to_iogr (member.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Convert new member back to a (non group) ior. + CORBA::Object_var member_ior = + this->orb_->string_to_object (member_ior_string.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + MemberInfo * info = 0; + ACE_NEW_THROW_EX (info, MemberInfo( + member_ior.in(), + the_location, + factory_info.the_factory, + fcid.in ()), + CORBA::NO_MEMORY()); + ACE_CHECK; + + if (this->members_.bind (the_location, info) != 0) + { + ACE_THROW(CORBA::NO_MEMORY()); + } + + this->reference_ = new_reference; // note var-to-var + // assignment does a + // duplicate + if (this->increment_version ()) + { + this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + created = 1; + } + } + if (! created) { - this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_THROW (PortableGroup::NoFactory ()); } - created = 1; - } } - if (! created) + else { - ACE_THROW (PortableGroup::NoFactory ()); + ACE_THROW (PortableGroup::MemberAlreadyPresent ()); } - } - else - { - ACE_THROW (PortableGroup::MemberAlreadyPresent ()); - } - } -void TAO::PG_Object_Group::create_members (size_t count ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - PortableGroup::NoFactory - )) +void +TAO::PG_Object_Group::create_members (size_t count ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableGroup::NoFactory)) { // assume internals is locked // @@ what if factories were passed as criteria? @@ -686,120 +759,134 @@ void TAO::PG_Object_Group::create_members (size_t count ACE_ENV_ARG_DECL) CORBA::ULong factory_count = factories->length (); if (factory_count > 0) - { - CORBA::ULong factory_pos = 0; - while (members_.current_size () < count && factory_pos < factory_count) { - const PortableGroup::FactoryInfo & factory_info = (*factories)[factory_pos]; - const PortableGroup::Location & factory_location = factory_info.the_location; - if (0 != this->members_.find (factory_location)) - { - /////////////////////////////////////////// - // If a factory refuses to create a replica - // it's not fatal. - ACE_TRY_NEW_ENV + CORBA::ULong factory_pos = 0; + while (members_.current_size () < count && factory_pos < factory_count) { - PortableGroup::GenericFactory::FactoryCreationId_var fcid; - CORBA::Object_var member = factory_info.the_factory->create_object ( - this->type_id_.in (), - factory_info.the_criteria, - fcid. out() - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // convert the new member to a stringified IOR to avoid - // contamination with group info - CORBA::String_var member_ior_string = - orb_->object_to_string (member.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableGroup::ObjectGroup_var new_reference = - this->add_member_to_iogr (member.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Convert new member back to a (non group) ior. - CORBA::Object_var member_ior = - this->orb_->string_to_object (member_ior_string.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - MemberInfo * info = 0; - ACE_NEW_THROW_EX (info, MemberInfo( - member_ior.in(), - factory_location, - factory_info.the_factory, - fcid.in ()), - CORBA::NO_MEMORY()); - ACE_TRY_CHECK; - - if (this->members_.bind (factory_location, info) != 0) - { - ACE_TRY_THROW(CORBA::NO_MEMORY()); - } - this->reference_ = new_reference; // note var-to-var assignment does a duplicate + const PortableGroup::FactoryInfo & factory_info = + (*factories)[factory_pos]; + const PortableGroup::Location & factory_location = + factory_info.the_location; + if (0 != this->members_.find (factory_location)) + { + /////////////////////////////////////////// + // If a factory refuses to create a replica + // it's not fatal. + ACE_TRY_NEW_ENV + { + PortableGroup::GenericFactory::FactoryCreationId_var fcid; + CORBA::Object_var member = + factory_info.the_factory->create_object ( + this->type_id_.in (), + factory_info.the_criteria, + fcid. out() + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // convert the new member to a stringified IOR to avoid + // contamination with group info + CORBA::String_var member_ior_string = + orb_->object_to_string (member.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableGroup::ObjectGroup_var new_reference = + this->add_member_to_iogr (member.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Convert new member back to a (non group) ior. + CORBA::Object_var member_ior = + this->orb_->string_to_object (member_ior_string.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + MemberInfo * info = 0; + ACE_NEW_THROW_EX (info, MemberInfo( + member_ior.in(), + factory_location, + factory_info.the_factory, + fcid.in ()), + CORBA::NO_MEMORY()); + ACE_TRY_CHECK; + + if (this->members_.bind (factory_location, info) != 0) + { + ACE_TRY_THROW(CORBA::NO_MEMORY()); + } + this->reference_ = + new_reference; // note var-to-var assignment does + // a duplicate + } + ACE_CATCHANY + { + // log, but otherwise ignore the errorf + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("PG (%P|%t) Replica Factory ") + ACE_TEXT ("@ %s refused create_object ") + ACE_TEXT ("request for type %s\n"), + ACE_static_cast (const char *, + factory_info.the_location[0].id), + ACE_static_cast (const char *, + this->type_id_.in ()) + )); + } + } + ACE_ENDTRY; + } } - ACE_CATCHANY + + if (this->increment_version ()) { - // log, but otherwise ignore the errorf - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("PG (%P|%t) Replica Factory @ %s refused create_object request for type %s\n"), - ACE_static_cast (const char *, factory_info.the_location[0].id), - ACE_static_cast (const char *, this->type_id_.in ()) - )); - } + this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; } - ACE_ENDTRY; - } } - - if (this->increment_version ()) + else { - this->distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_THROW (PortableGroup::NoFactory()); } - } - else - { - ACE_THROW (PortableGroup::NoFactory()); - } } void TAO::PG_Object_Group::initial_populate (ACE_ENV_SINGLE_ARG_DECL) { - InternalGuard guard(this->internals_); - if ( this->get_membership_style() == PortableGroup::MEMB_INF_CTRL ) - { - PortableGroup::InitialNumberMembersValue initial_number_members = - this->get_initial_number_members (); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); - if (this->members_.current_size () < initial_number_members) + if (this->get_membership_style () == PortableGroup::MEMB_INF_CTRL) { - this->create_members (initial_number_members - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + PortableGroup::InitialNumberMembersValue initial_number_members = + this->get_initial_number_members (); + + if (this->members_.current_size () < initial_number_members) + { + this->create_members (initial_number_members + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } } - } } -void TAO::PG_Object_Group::minimum_populate (ACE_ENV_SINGLE_ARG_DECL) +void +TAO::PG_Object_Group::minimum_populate (ACE_ENV_SINGLE_ARG_DECL) { - InternalGuard guard(this->internals_); - if ( this->get_membership_style() == PortableGroup::MEMB_INF_CTRL ) - { - PortableGroup::MinimumNumberMembersValue minimum_number_members = this->get_minimum_number_members (); - if (members_.current_size () < minimum_number_members) + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); + + if ( this->get_membership_style () == PortableGroup::MEMB_INF_CTRL ) { - this->create_members (minimum_number_members ACE_ENV_ARG_PARAMETER); + PortableGroup::MinimumNumberMembersValue minimum_number_members = + this->get_minimum_number_members (); + if (members_.current_size () < minimum_number_members) + { + this->create_members (minimum_number_members ACE_ENV_ARG_PARAMETER); + } } - } } -int TAO::PG_Object_Group::has_member_at (const PortableGroup::Location & location ) +int +TAO::PG_Object_Group::has_member_at (const PortableGroup::Location & location) { return (0 == this->members_.find (location)); } @@ -813,21 +900,21 @@ int TAO::PG_Object_Group::has_member_at (const PortableGroup::Location & locatio #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Hash_Map_Manager_Ex < - PortableGroup::Location, - TAO::PG_Object_Group::MemberInfo *, - TAO_PG_Location_Hash, - TAO_PG_Location_Equal_To, - TAO_SYNCH_MUTEX>; - template class ACE_Hash_Map_Entry < - PortableGroup::Location, - TAO::PG_Object_Group::MemberInfo *>; - template class ACE_Hash_Map_Iterator_Ex < - PortableGroup::Location, - TAO::PG_Object_Group::MemberInfo *, - TAO_PG_Location_Hash, - TAO_PG_Location_Equal_To, - TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Manager_Ex < + PortableGroup::Location, + TAO::PG_Object_Group::MemberInfo *, + TAO_PG_Location_Hash, + TAO_PG_Location_Equal_To, + TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Entry < + PortableGroup::Location, + TAO::PG_Object_Group::MemberInfo *>; +template class ACE_Hash_Map_Iterator_Ex < + PortableGroup::Location, + TAO::PG_Object_Group::MemberInfo *, + TAO_PG_Location_Hash, + TAO_PG_Location_Equal_To, + TAO_SYNCH_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -846,4 +933,3 @@ int TAO::PG_Object_Group::has_member_at (const PortableGroup::Location & locatio TAO::PG_Object_Group::MemberMapMutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h index 09ae9b5d8af..fd15c9ed07a 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h @@ -20,30 +20,23 @@ #define TAO_PG_OBJECT_GROUP_H_ #include /**/ "ace/pre.h" -#include "ace/ACE.h" +#include "portablegroup_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "portablegroup_export.h" -#include "PG_Property_Set.h" - -////////////////////////////////// -// Classes declared in this header -namespace TAO -{ - class PG_Object_Group; -} ///////////////////////////////// // Includes needed by this header -#include "orbsvcs/orbsvcs/PortableGroupC.h" -#include "tao/PortableServer/PortableServer.h" -#include "ace/Hash_Map_Manager_T.h" +#include "PG_Property_Set.h" #include "PG_Location_Hash.h" #include "PG_Location_Equal_To.h" #include "PG_Object_Group_Manipulator.h" +#include "orbsvcs/orbsvcs/PortableGroupC.h" +#include "tao/PortableServer/PortableServer.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/ACE.h" ///////////////////// // Forward references @@ -324,8 +317,7 @@ namespace TAO /** * Protect internal state. */ - TAO_SYNCH_MUTEX internals_; - typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; + mutable TAO_SYNCH_MUTEX internals_; CORBA::ORB_var orb_; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp index e888aa0a37f..1f311775cb6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp @@ -69,7 +69,7 @@ TAO::PG_Properties_Support::set_type_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); TAO::PG_Property_Set * typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) @@ -93,7 +93,7 @@ TAO::PG_Properties_Support::get_type_properties ( PortableGroup::Properties_var result; ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ()); - InternalGuard guard(this->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); TAO::PG_Property_Set * typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) @@ -115,7 +115,7 @@ TAO::PG_Properties_Support::remove_type_properties ( // Reference counted pointers could be used to allow property sets // for unused typeids to be deleted. - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); TAO::PG_Property_Set * typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) @@ -131,7 +131,7 @@ TAO::PG_Properties_Support::find_typeid_properties ( ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - InternalGuard guard(this->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); TAO::PG_Property_Set * typeid_properties = 0; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h index 981264f4fa6..a56bbc9a168 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h @@ -197,7 +197,6 @@ namespace TAO * Protect internal state. */ TAO_SYNCH_MUTEX internals_; - typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; /// The default property set. TAO::PG_Property_Set default_properties_; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp index 1b53912826c..50f350c3e12 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp @@ -57,10 +57,12 @@ TAO::PG_Property_Set::~PG_Property_Set () this->clear (); } -void TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_set ACE_ENV_ARG_DECL) +void +TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_set + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); size_t count = property_set.length (); for (size_t nItem = 0; nItem < count; ++nItem) @@ -71,14 +73,18 @@ void TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_se // @@ TODO: fix this const CosNaming::NameComponent & nc = nsName[0]; - this->set_property (ACE_static_cast (const char *, nc.id), property.val ACE_ENV_ARG_PARAMETER); + this->set_property (ACE_static_cast (const char *, nc.id), + property.val + ACE_ENV_ARG_PARAMETER); ACE_CHECK; #if 0 ACE_CString name = ACE_static_cast (const char *, nc.id); const PortableGroup::Value * value_copy; - ACE_NEW_THROW_EX (value_copy, PortableGroup::Value (property.val), CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (value_copy, + PortableGroup::Value (property.val), + CORBA::NO_MEMORY ()); ACE_CHECK; const PortableGroup::Value * replaced_value = 0; @@ -106,7 +112,7 @@ void TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_se void TAO::PG_Property_Set::clear () { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); for (ValueMapIterator it = this->values_.begin (); it != this->values_.end (); ++it) @@ -119,7 +125,7 @@ void TAO::PG_Property_Set::clear () void TAO::PG_Property_Set::remove (const PortableGroup::Properties & property_set) ACE_THROW_SPEC ((CORBA::SystemException)) { - InternalGuard guard(this->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); size_t count = property_set.length (); for (size_t nItem = 0; nItem < count; ++nItem) { @@ -207,7 +213,7 @@ void TAO::PG_Property_Set::export_properties(PortableGroup::Properties & propert void TAO::PG_Property_Set::merge_properties (ValueMap & merged_values) const { - InternalGuard guard(ACE_const_cast (TAO::PG_Property_Set *, this)->internals_); + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); if (0 != this->defaults_) { this->defaults_->merge_properties (merged_values); @@ -228,7 +234,7 @@ int TAO::PG_Property_Set::find ( const ACE_CString & key, const PortableGroup::Value *& pValue) const { - InternalGuard guard(ACE_const_cast (TAO::PG_Property_Set *, this)->internals_); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); int found = (0 == this->values_.find (key, pValue)); if (! found) { diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h index aa99a927ecb..df3ef19c8bd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h @@ -158,11 +158,11 @@ namespace TAO /////////////// // Data Members private: + /** * Protect internal state. */ - TAO_SYNCH_MUTEX internals_; - typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; + mutable TAO_SYNCH_MUTEX internals_; ValueMap values_; /** diff --git a/TAO/orbsvcs/tests/Security/Big_Request/client.cpp b/TAO/orbsvcs/tests/Security/Big_Request/client.cpp index 0a600c32d78..a3e3c40cfdb 100644 --- a/TAO/orbsvcs/tests/Security/Big_Request/client.cpp +++ b/TAO/orbsvcs/tests/Security/Big_Request/client.cpp @@ -1,4 +1,3 @@ - #include "TX_ObjectC.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" @@ -42,7 +41,11 @@ main (int argc, char *argv[]) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + "" + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (::parse_args (argc, argv) != 0) @@ -63,7 +66,7 @@ main (int argc, char *argv[]) DataSeq data_input; - CORBA::ULong len = 3461724; + const CORBA::ULong len = 3461724; data_input.length (len); @@ -73,7 +76,7 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "Sending octet sequence of length:\t%u\n", - data_input.length())); + data_input.length ())); txObject->send (data_input ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -85,7 +88,7 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "Received octet sequence of length:\t%u\n", - data_output->length())); + data_output->length ())); txObject->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index 4d3ab16209c..2fb1e26a510 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -29,6 +29,7 @@ #include "tao/TAO_Export.h" #include "tao/Basic_Types.h" #include "tao/Collocation_Strategy.h" +#include "tao/CORBA_methods.h" #include "tao/Pseudo_VarOut_T.h" class TAO_ServerRequest; diff --git a/TAO/tao/Adapter.cpp b/TAO/tao/Adapter.cpp index e074f40532e..e36437e5688 100644 --- a/TAO/tao/Adapter.cpp +++ b/TAO/tao/Adapter.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "Adapter.h" #include "Object.h" +#include "Adapter.h" #include "debug.h" #include "ace/Dynamic_Service.h" diff --git a/TAO/tao/Adapter.h b/TAO/tao/Adapter.h index 918e7dc3844..f8c1cea0e5d 100644 --- a/TAO/tao/Adapter.h +++ b/TAO/tao/Adapter.h @@ -22,7 +22,6 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/Exception.h" -#include "tao/Pseudo_VarOut_T.h" #if defined(_MSC_VER) #if (_MSC_VER >= 1200) @@ -31,10 +30,11 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ +#include "tao/CORBA_methods.h" +#include "tao/Pseudo_VarOut_T.h" + namespace CORBA { - class Object; - typedef Object *Object_ptr; typedef TAO_Pseudo_Var_T<Object> Object_var; typedef TAO_Pseudo_Out_T<Object, Object_var> Object_out; } diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 1732c28915c..451359a9795 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -13,16 +13,19 @@ #define TAO_ANY_H #include /**/ "ace/pre.h" -#include "ace/CDR_Stream.h" + +#include "tao/Exception.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Exception.h" +#include "tao/CORBA_methods.h" #include "tao/Pseudo_VarOut_T.h" #include "tao/Arg_Traits_T.h" +#include "ace/CDR_Stream.h" + namespace TAO { class Any_Impl; diff --git a/TAO/tao/CORBA_methods.h b/TAO/tao/CORBA_methods.h index 2b357c06515..df252c7cba5 100644 --- a/TAO/tao/CORBA_methods.h +++ b/TAO/tao/CORBA_methods.h @@ -56,9 +56,6 @@ namespace CORBA class OperationDef; typedef OperationDef *OperationDef_ptr; - class ExceptionList; - typedef ExceptionList *ExceptionList_ptr; - /** * @name ORB Initialization * @@ -96,9 +93,6 @@ namespace CORBA TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (TypeCode_ptr); TAO_NAMESPACE_INLINE_FUNCTION void release (TypeCode_ptr); - - TAO_NAMESPACE_INLINE_FUNCTION void release (ExceptionList_ptr); - TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ExceptionList_ptr); } #include /**/ "ace/post.h" diff --git a/TAO/tao/DynamicInterface/Context.h b/TAO/tao/DynamicInterface/Context.h index a782f6e6d48..dd917caf083 100644 --- a/TAO/tao/DynamicInterface/Context.h +++ b/TAO/tao/DynamicInterface/Context.h @@ -24,6 +24,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "DII_CORBA_methods.h" + #include "tao/Pseudo_VarOut_T.h" #include "tao/orbconf.h" #include "tao/Basic_Types.h" @@ -47,20 +49,8 @@ namespace CORBA class NVList; typedef NVList *NVList_ptr; - class ContextList; - typedef ContextList *ContextList_ptr; - - class Context; - typedef Context *Context_ptr; - class Environment; - TAO_NAMESPACE_INLINE_FUNCTION void release (Context_ptr); - TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Context_ptr); - - TAO_NAMESPACE_INLINE_FUNCTION void release (ContextList_ptr); - TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ContextList_ptr ); - typedef TAO_Pseudo_Var_T<Context> Context_var; typedef TAO_Pseudo_Out_T<Context, Context_var> Context_out; diff --git a/TAO/tao/DynamicInterface/DII_CORBA_methods.h b/TAO/tao/DynamicInterface/DII_CORBA_methods.h new file mode 100644 index 00000000000..28e1db13875 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_CORBA_methods.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DII_CORBA_methods.h + * + * $Id$ + * + * Declarations of DII methods in the CORBA namespace. + * + * @author Ossama Othman <ossama@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_DII_CORBA_METHODS_H +#define TAO_DII_CORBA_METHODS_H + +#include /**/ "ace/pre.h" + +#include "tao/DynamicInterface/dynamicinterface_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/CORBA_methods.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif + +#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export + + +namespace CORBA +{ + class ContextList; + typedef ContextList *ContextList_ptr; + + class Context; + typedef Context *Context_ptr; + + class ExceptionList; + typedef ExceptionList *ExceptionList_ptr; + + TAO_NAMESPACE_INLINE_FUNCTION void release (Context_ptr); + TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Context_ptr); + + TAO_NAMESPACE_INLINE_FUNCTION void release (ContextList_ptr); + TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ContextList_ptr ); + + TAO_NAMESPACE_INLINE_FUNCTION void release (ExceptionList_ptr); + TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ExceptionList_ptr); +} + +#include /**/ "ace/post.h" + +#endif /* TAO_DII_CORBA_METHODS_H */ diff --git a/TAO/tao/DynamicInterface/ExceptionList.h b/TAO/tao/DynamicInterface/ExceptionList.h index c6e7021ccf1..270515cd1bf 100644 --- a/TAO/tao/DynamicInterface/ExceptionList.h +++ b/TAO/tao/DynamicInterface/ExceptionList.h @@ -30,6 +30,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "DII_CORBA_methods.h" #include "tao/Pseudo_VarOut_T.h" #include "tao/orbconf.h" #include "tao/Basic_Types.h" @@ -47,12 +48,6 @@ namespace CORBA { - class ExceptionList; - typedef ExceptionList *ExceptionList_ptr; - - TAO_NAMESPACE_INLINE_FUNCTION void release (ExceptionList_ptr); - TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ExceptionList_ptr); - typedef TAO_Pseudo_Var_T<ExceptionList> ExceptionList_var; typedef TAO_Pseudo_Out_T<ExceptionList, ExceptionList_var> ExceptionList_out; diff --git a/TAO/tao/DynamicInterface/ExceptionList.inl b/TAO/tao/DynamicInterface/ExceptionList.inl index d08578a70ec..fda8385bd58 100644 --- a/TAO/tao/DynamicInterface/ExceptionList.inl +++ b/TAO/tao/DynamicInterface/ExceptionList.inl @@ -27,21 +27,21 @@ CORBA::ExceptionList::ExceptionList (void) { } -ACE_INLINE +ACE_INLINE CORBA::ULong CORBA::ExceptionList::count (void) { return (CORBA::ULong) this->tc_list_.size (); } -ACE_INLINE +ACE_INLINE CORBA::ExceptionList_ptr CORBA::ExceptionList::_nil (void) { return (CORBA::ExceptionList_ptr)0; } -ACE_INLINE +ACE_INLINE CORBA::ExceptionList_ptr CORBA::ExceptionList::_duplicate (CORBA::ExceptionList_ptr x) { @@ -52,4 +52,3 @@ CORBA::ExceptionList::_duplicate (CORBA::ExceptionList_ptr x) return x; } - diff --git a/TAO/tao/DynamicInterface/Request.h b/TAO/tao/DynamicInterface/Request.h index 8891fb9ad32..81a8cdf665b 100644 --- a/TAO/tao/DynamicInterface/Request.h +++ b/TAO/tao/DynamicInterface/Request.h @@ -29,8 +29,9 @@ // that registers the dynamic service object. #include "Dynamic_Adapter_Impl.h" -#include "Context.h" #include "ExceptionList.h" +#include "Context.h" + #include "tao/ORB.h" #include "tao/NVList.h" #include "tao/Environment.h" diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 801165373c7..385e2c2b3a1 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -24,7 +24,6 @@ #include "tao/Collocation_Strategy.h" #include "tao/params.h" -#include "tao/Adapter.h" #include "tao/ORB_Constants.h" #include "tao/PolicyFactory_Registry.h" #include "tao/Parser_Registry.h" @@ -37,6 +36,7 @@ #include "tao/Messaging_SyncScopeC.h" #include "tao/Object.h" #include "tao/Invocation_Utils.h" +#include "tao/Adapter.h" #if TAO_HAS_INTERCEPTORS == 1 # include "Interceptor_List.h" diff --git a/TAO/tao/Pseudo_VarOut_T.h b/TAO/tao/Pseudo_VarOut_T.h index d732515dced..c4fdd42c254 100644 --- a/TAO/tao/Pseudo_VarOut_T.h +++ b/TAO/tao/Pseudo_VarOut_T.h @@ -6,16 +6,37 @@ * * $Id$ * - * @author Jeff Parsons + * @note This header should be included after all types to be passed + * as template parameters to the TAO_Pseudo_{Var,Out}_T template + * classes have been declared. If the types in question are defined + * in another header, include that header before this one. + * @par + * Including other headers like "tao/CORBA_methods.h" here can cause + * circular dependency related problems when using compilers that + * lookup and bind non-dependent names in templates at definition time + * (i.e. while parsing the code) instead of at instantiation time. + * + * @todo Look into adding a template parameter to each of the + * templates in question that would be a trait containing the + * means for releasing references managed by the templates. + * Doing so should work around the non-dependent name issues in + * g++ 3.4, thus easing the requirement that this header be + * parsed last. + * + * -Ossama + * + * + * @author Jeff Parsons */ //============================================================================= #ifndef TAO_PSEUDO_VAROUT_T_H #define TAO_PSEUDO_VAROUT_T_H + #include /**/ "ace/pre.h" -#include "tao/CORBA_methods.h" +//#include "tao/CORBA_methods.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h index 0b0a717d9b7..4c27a462bf7 100644 --- a/TAO/tao/Valuetype/AbstractBase.h +++ b/TAO/tao/Valuetype/AbstractBase.h @@ -21,12 +21,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Pseudo_VarOut_T.h" #include "ace/CORBA_macros.h" #include "tao/Object_Argument_T.h" #include "tao/Arg_Traits_T.h" #include "tao/Objref_VarOut_T.h" #include "tao/Object.h" /* For CORBA::Object_var */ +#include "tao/Pseudo_VarOut_T.h" class TAO_Stub; class TAO_Abstract_ServantBase; diff --git a/TAO/tao/default_environment.h b/TAO/tao/default_environment.h index 8a8b5a1f0bc..ec261119089 100644 --- a/TAO/tao/default_environment.h +++ b/TAO/tao/default_environment.h @@ -9,10 +9,13 @@ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> */ //============================================================================= + #ifndef TAO_DEFAULT_ENVIRONMENT_H #define TAO_DEFAULT_ENVIRONMENT_H + #include /**/ "ace/pre.h" -#include "ace/config-all.h" + +#include "tao/TAO_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,4 +35,5 @@ namespace CORBA TAO_Export CORBA::Environment& TAO_default_environment (void); #include /**/ "ace/post.h" -#endif /*TAO_DEFAULT_ENVIRONMENT_H*/ + +#endif /* TAO_DEFAULT_ENVIRONMENT_H */ diff --git a/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h index cd4fb27371b..3fbc6234d29 100644 --- a/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h @@ -63,9 +63,6 @@ public: /// Constructor. Server_Request_Interceptor (void); - /// Destructor. - ~Server_Request_Interceptor (void); - /// Set the references to which requests will be forwarded. virtual void forward_references (CORBA::Object_ptr obj1, CORBA::Object_ptr obj2 @@ -118,6 +115,11 @@ public: PortableInterceptor::ForwardRequest)); //@} +protected: + + /// Destructor. + ~Server_Request_Interceptor (void); + private: /// The number of requests intercepted by this interceptor. diff --git a/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h index 581c8fbeee9..b7042294fdf 100644 --- a/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h @@ -51,9 +51,6 @@ public: /// Constructor. Server_Request_Interceptor (bool & destroy_called); - /// Destructor. - ~Server_Request_Interceptor (void); - /** * @name Methods Required by the Server Request Interceptor * Interface @@ -100,6 +97,11 @@ public: PortableInterceptor::ForwardRequest)); //@} +protected: + + /// Destructor. + ~Server_Request_Interceptor (void); + private: /// Flag that states whether this interceptor's @c destroy() method |