diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-02 23:27:30 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-02 23:27:30 +0000 |
commit | 1c4157819c2e022e9d5da941ad2cf11bc3e53a96 (patch) | |
tree | a2dec1587a1224eb7935739cc6bad826769eea0f | |
parent | 655c1e1771a602c7ec949de331337e196d9adbfa (diff) | |
download | ATCD-1c4157819c2e022e9d5da941ad2cf11bc3e53a96.tar.gz |
ChangeLogTag: Tue Dec 2 17:26:14 2003 Dale Wilson <wilson_d@ociweb.com>
22 files changed, 356 insertions, 339 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ae915d03828..752dd99a730 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,42 @@ +Tue Dec 2 17:26:14 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Factory_Set.h: + * orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h: + * orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Location_Equal_To.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Location_Hash.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Location_Map.h: + * orbsvcs/orbsvcs/PortableGroup/PG_MemberInfo.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Null_Property_Validator.h: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Operators.h: + * orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h: + * orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_conf.h: + * orbsvcs/orbsvcs/PortableGroup/POA_Hooks.h: + * orbsvcs/orbsvcs/PortableGroup/PortableGroup_Acceptor_Registry.h: + * orbsvcs/orbsvcs/PortableGroup/PortableGroup_Loader.h: + * orbsvcs/orbsvcs/PortableGroup/PortableGroup_ORBInitializer.h: + * orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.h: + * orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.h: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp: + * orbsvcs/orbsvcs/PortableGroup/miopconf.h: + Revert changes to portable group that aren't required + to support HAFT. + Tue Dec 2 17:21:43 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/orbsvcs/FaultTolerance/FT_ClientORBInitializer.cpp: diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.cpp index a106f168d16..a2214cc57e3 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.cpp @@ -10,18 +10,18 @@ ACE_RCSID (PortableGroup, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set>; -template class ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<ACE_UINT32, TAO_PG_Factory_Set>; +template class ACE_Hash_Map_Manager_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set> -#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_Factory_Set, ACE_Hash<PortableGroup::ObjectGroupId>, ACE_Equal_To<PortableGroup::ObjectGroupId>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<ACE_UINT32, TAO_PG_Factory_Set> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_UINT32, TAO_PG_Factory_Set, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.h index d3747ef190d..09df905cf90 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Map.h @@ -31,10 +31,10 @@ /// Factory hash map. typedef ACE_Hash_Map_Manager_Ex< - PortableGroup::ObjectGroupId, + ACE_UINT32, TAO_PG_Factory_Set, - ACE_Hash<PortableGroup::ObjectGroupId>, - ACE_Equal_To<PortableGroup::ObjectGroupId>, + ACE_Hash<ACE_UINT32>, + ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> TAO_PG_Factory_Map; #include /**/ "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Set.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Set.h index 9f99094f2bf..3bca619031f 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Set.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Factory_Set.h @@ -43,9 +43,6 @@ struct TAO_PG_Factory_Node /// Member factory information. PortableGroup::FactoryInfo factory_info; - /// The ObjectGroupId to which this member belongs - PortableGroup::ObjectGroupId object_group_id; - /// FactoryCreationId assigned to the member. PortableGroup::GenericFactory::FactoryCreationId_var factory_creation_id; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp index 03140458ff7..74ce8b32233 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp @@ -4,9 +4,6 @@ #include "PG_PropertyManager.h" #include "PG_Property_Utils.h" #include "PG_conf.h" -#include "orbsvcs/PortableGroupC.h" -#include "PG_Properties_Encoder.h" -#include "PG_Properties_Decoder.h" ACE_RCSID (PortableGroup, @@ -21,12 +18,10 @@ TAO_PG_GenericFactory::TAO_PG_GenericFactory ( object_group_manager_ (object_group_manager), property_manager_ (property_manager), factory_map_ (TAO_PG_MAX_OBJECT_GROUPS), -// next_fcid_ (0), + next_fcid_ (0), lock_ () { this->object_group_manager_.generic_factory (this); - this->domain_id_ = "default-domain"; - } TAO_PG_GenericFactory::~TAO_PG_GenericFactory (void) @@ -70,10 +65,6 @@ TAO_PG_GenericFactory::create_object ( PortableGroup::InvalidProperty, PortableGroup::CannotMeetCriteria)) { - - PortableGroup::ObjectGroup_var object_group = PortableGroup::ObjectGroup::_nil(); - - PortableGroup::Properties_var properties = this->property_manager_.get_type_properties (type_id ACE_ENV_ARG_PARAMETER); @@ -99,34 +90,51 @@ TAO_PG_GenericFactory::create_object ( ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); + CORBA::ULong fcid = 0; - PortableGroup::ObjectGroupId group_id; -// PortableGroup::ObjectGroup_var - object_group = - this->object_group_manager_.create_object_group (type_id, // in - this->domain_id_, // in - the_criteria, // in - group_id // out - ACE_ENV_ARG_PARAMETER); + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->lock_, + CORBA::Object::_nil ()); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - // Allocate a new FactoryCreationId for use as an "out" parameter. - PortableGroup::GenericFactory::FactoryCreationId_var factory_id = 0; - ACE_NEW_THROW_EX (factory_id, - PortableGroup::GenericFactory::FactoryCreationId, - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - *factory_id <<= group_id; + // Start out with an initial value. + fcid = this->next_fcid_; + // Loop until a free FactoryCreationId is found, being careful to + // search through the range of FactoryCreationIds only once. + while (this->factory_map_.find (this->next_fcid_) == 0) + { + this->next_fcid_++; + + // If this is true, then no FactoryCreationIds are available. + // This is highly unlikely since TAO implements a + // FactoryCreationId as a 32 bit unsigned integer, meaning + // that over 4 billion object groups are being managed by this + // generic factory! + if (this->next_fcid_ == fcid) + ACE_THROW_RETURN (PortableGroup::ObjectNotCreated (), + CORBA::Object::_nil ()); + } + // Just in case this->next_fcid_ was modified in the above search, + // reassign the value. + fcid = this->next_fcid_; + } + + // The ObjectId for the newly created object group is comprised + // solely of the FactoryCreationId. + PortableServer::ObjectId_var oid; + this->get_ObjectId (fcid, oid.out ()); + + PortableGroup::ObjectGroup_var object_group = + this->object_group_manager_.create_object_group (fcid, + oid.in (), + type_id, + the_criteria + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - TAO_PG_Factory_Set factory_set; const CORBA::ULong factory_infos_count = factory_infos.length (); @@ -139,21 +147,30 @@ TAO_PG_GenericFactory::create_object ( this->populate_object_group (object_group.in (), type_id, factory_infos, - minimum_number_members, + initial_number_members, factory_set ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + if (this->factory_map_.bind (fcid, factory_set) != 0) + ACE_TRY_THROW (PortableGroup::ObjectNotCreated ()); - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->lock_, - CORBA::Object::_nil ()); + } + // Allocate a new FactoryCreationId for use as an "out" parameter. + PortableGroup::GenericFactory::FactoryCreationId * tmp = 0; + ACE_NEW_THROW_EX (tmp, + PortableGroup::GenericFactory::FactoryCreationId, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); - if (this->factory_map_.bind (group_id, factory_set) != 0) - ACE_TRY_THROW (PortableGroup::ObjectNotCreated ()); - } + factory_creation_id = tmp; + + *tmp <<= fcid; } ACE_CATCHANY { @@ -162,7 +179,7 @@ TAO_PG_GenericFactory::create_object ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->object_group_manager_.destroy_object_group (group_id + this->object_group_manager_.destroy_object_group (oid.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -171,7 +188,16 @@ TAO_PG_GenericFactory::create_object ( ACE_ENDTRY; ACE_CHECK_RETURN (CORBA::Object::_nil ()); - factory_creation_id = factory_id._retn(); + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->lock_, + CORBA::Object::_nil ()); + + // Object group was successfully created. Increment the next + // FactoryCreationId in preparation for the next object group. + this->next_fcid_++; + } return object_group._retn (); } @@ -184,9 +210,9 @@ TAO_PG_GenericFactory::delete_object ( ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectNotFound)) { - PortableGroup::ObjectGroupId group_id; + CORBA::ULong fcid = 0; - if (factory_creation_id >>= group_id) // Extract the actual FactoryCreationId. + if (factory_creation_id >>= fcid) // Extract the actual FactoryCreationId. { // Successfully extracted the FactoryCreationId. Now find the // TAO_PG_Factory_Set corresponding to it. @@ -196,30 +222,34 @@ TAO_PG_GenericFactory::delete_object ( // If no entry exists in the factory map, infrastructure // controlled membership was not used. TAO_PG_Factory_Map::ENTRY *entry = 0; - if (this->factory_map_.find (group_id, entry) == 0) + if (this->factory_map_.find (fcid, entry) == 0) { TAO_PG_Factory_Set & factory_set = entry->int_id_; - this->delete_object_i (factory_set, 0 /* Do not ignore exceptions */ ACE_ENV_ARG_PARAMETER); ACE_CHECK; - if (this->factory_map_.unbind (group_id) != 0) + if (this->factory_map_.unbind (fcid) != 0) ACE_THROW (CORBA::INTERNAL ()); - - // Destroy the object group entry. - this->object_group_manager_.destroy_object_group ( - group_id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } } else ACE_THROW (PortableGroup::ObjectNotFound ()); // @@ // CORBA::BAD_PARAM // instead? + + // The ObjectId for the newly created object group is comprised + // solely of the FactoryCreationId. + PortableServer::ObjectId_var oid; + this->get_ObjectId (fcid, oid.out ()); + + // Destroy the object group entry. + this->object_group_manager_.destroy_object_group ( + oid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void @@ -275,7 +305,7 @@ TAO_PG_GenericFactory::delete_object_i (TAO_PG_Factory_Set & factory_set, void TAO_PG_GenericFactory::delete_member ( - PortableGroup::ObjectGroupId group_id, + CORBA::ULong group_id, const PortableGroup::Location & location ACE_ENV_ARG_DECL) { @@ -348,7 +378,7 @@ TAO_PG_GenericFactory::populate_object_group ( PortableGroup::ObjectGroup_ptr object_group, const char * type_id, const PortableGroup::FactoryInfos & factory_infos, - PortableGroup::MinimumNumberMembersValue minimum_number_members, + PortableGroup::InitialNumberMembersValue initial_number_members, TAO_PG_Factory_Set & factory_set ACE_ENV_ARG_DECL) { @@ -361,7 +391,7 @@ TAO_PG_GenericFactory::populate_object_group ( const PortableGroup::FactoryInfo &factory_info = factory_infos[j]; - if (j < ACE_static_cast (CORBA::ULong, minimum_number_members)) + if (j < ACE_static_cast (CORBA::ULong, initial_number_members)) { PortableGroup::GenericFactory_ptr factory = factory_info.the_factory.in (); @@ -391,6 +421,41 @@ TAO_PG_GenericFactory::populate_object_group ( } void +TAO_PG_GenericFactory::get_ObjectId ( + CORBA::ULong fcid, + PortableServer::ObjectId_out oid) +{ + // Since the POA used by the LoadManager uses the NON_RETAIN + // policy, explicitly choose an ObjectId that is unique to a given + // type. + + // Make the ObjectId be the next value of the number of types that + // have been registered with the LoadManager. For example, if two + // types of objects have been registered with the LoadManager, then + // the ObjectId for the object currently being registered will be + // "3" since the object will be the third type of object registered + // with the LoadManager. Previously used values will not be reused + // to ensure that a ServantLocator does not inadvertently return a + // reference to an object that had a previously used ObjectId. + // Specifcally, the numerical value used for the ObjectId increases + // monotonically. + + // 4294967295UL -- Largest 32 bit unsigned integer + // 123456789012 -- 10 digits + // + 2 for "UL" (unnecessary, but let's be safe) + // + 1 for null terminator + // + 1 for good luck. :-) + const size_t MAX_OID_LEN = 14; + + char oid_str[MAX_OID_LEN] = { 0 }; + ACE_OS::sprintf (oid_str, + "%ul", + fcid); + + oid = PortableServer::string_to_ObjectId (oid_str); +} + +void TAO_PG_GenericFactory::process_criteria ( const char * type_id, const PortableGroup::Criteria & criteria, @@ -420,22 +485,25 @@ TAO_PG_GenericFactory::process_criteria ( name.length (1); PortableGroup::Value value; + PortableGroup::Value value1; + PortableGroup::Value value2; + PortableGroup::Value value3; // MembershipStyle - name[0].id = CORBA::string_dup (PortableGroup::PG_MEMBERSHIP_STYLE); + name[0].id = CORBA::string_dup ("org.omg.PortableGroup.MembershipStyle"); if (TAO_PG::get_property_value (name, props.in (), value) && (!(value >>= membership_style) || (membership_style != PortableGroup::MEMB_APP_CTRL && membership_style != PortableGroup::MEMB_INF_CTRL))) { + // This only occurs if extraction of the actual value from the + // Any fails. ACE_THROW (PortableGroup::InvalidProperty (name, value)); } // Factories const PortableGroup::FactoryInfos * factory_infos_tmp = 0; - - PortableGroup::Value value1; - name[0].id = CORBA::string_dup (PortableGroup::PG_FACTORIES); + name[0].id = CORBA::string_dup ("org.omg.PortableGroup.Factories"); if (TAO_PG::get_property_value (name, props.in (), value1) && !(value1 >>= factory_infos_tmp)) { @@ -447,10 +515,9 @@ TAO_PG_GenericFactory::process_criteria ( const CORBA::ULong factory_infos_count = (factory_infos_tmp == 0 ? 0 : factory_infos_tmp->length ()); - PortableGroup::Value value2; // InitialNumberMembers name[0].id = - CORBA::string_dup (PortableGroup::PG_INITIAL_NUMBER_MEMBERS); + CORBA::string_dup ("org.omg.PortableGroup.InitialNumberMembers"); if (TAO_PG::get_property_value (name, props.in (), value2) && !(value2 >>= initial_number_members)) { @@ -466,7 +533,7 @@ TAO_PG_GenericFactory::process_criteria ( // possibly be created. if (factory_infos_count < ACE_static_cast (CORBA::ULong, - minimum_number_members)) + initial_number_members)) { unmet_criteria[uc].nam = name; unmet_criteria[uc++].val = value2; @@ -474,7 +541,6 @@ TAO_PG_GenericFactory::process_criteria ( } // MinimumNumberMembers - PortableGroup::Value value3; name[0].id = CORBA::string_dup ("org.omg.PortableGroup.MinimumNumberMembers"); if (TAO_PG::get_property_value (name, props.in (), value3) @@ -494,7 +560,7 @@ TAO_PG_GenericFactory::process_criteria ( // changed. if (membership_style == PortableGroup::MEMB_INF_CTRL) { - if (minimum_number_members > initial_number_members + if (minimum_number_members < initial_number_members || ACE_static_cast (CORBA::ULong, minimum_number_members) > factory_infos_count) { @@ -523,22 +589,11 @@ TAO_PG_GenericFactory::process_criteria ( void TAO_PG_GenericFactory::check_minimum_number_members ( PortableGroup::ObjectGroup_ptr object_group, - PortableGroup::ObjectGroupId group_id, + CORBA::ULong group_id, const char * type_id ACE_ENV_ARG_DECL) { - - //@@ TODO - Fix this code. The original implementation for the load balancer assumed - // that the factory-creation-id was the same as the object-group-id. This - // is not longer true. The find below is supposed to be a factory-creation-id. - ACE_UNUSED_ARG (object_group); - ACE_UNUSED_ARG (group_id); - ACE_UNUSED_ARG (type_id); - - return; - -#if 0 - // Check if we've dropped below the MinimumNumberMembers threshold. + // Check if we've dropped below the MinimumNumberMembers threshold. // If so, attempt to create enough new members to fill the gap. // If no entry exists in the factory map, infrastructure (this @@ -562,7 +617,7 @@ TAO_PG_GenericFactory::check_minimum_number_members ( // MinimumNumberMembers name[0].id = - CORBA::string_dup (PG_MINIMUM_NUMBER_MEMBERS); + CORBA::string_dup ("org.omg.PortableGroup.MinimumNumberMembers"); PortableGroup::MinimumNumberMembersValue minimum_number_members; @@ -637,7 +692,6 @@ TAO_PG_GenericFactory::check_minimum_number_members ( // threshold gap hasn't been filled, what do we do? Throw // a CORBA::TRANSIENT? } -#endif } PortableGroup::GenericFactory::FactoryCreationId * diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h index 8b6b853fa64..5037ace92f1 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h @@ -119,21 +119,21 @@ public: * This method is only used by the TAO_PG_ObjectGroupManager class * when ObjectGroupManager::remove_member() is explicitly called. */ - void delete_member (PortableGroup::ObjectGroupId group_id, + void delete_member (CORBA::ULong group_id, const PortableGroup::Location & location ACE_ENV_ARG_DECL); - /// Verify that the MinimumNumberReplicas criterion is satisfied. + /// Verify that the MinimumNumberMembers criterion is satisfied. /** * If the current number of members in the given object group is - * less than the MinimumNumberReplicas criterion in effect for that + * less than the MinimumNumberMembers criterion in effect for that * group, the infrastructure will attempt create and add more * members to the group by invoking any unused application-supplied * GenericFactorys. */ void check_minimum_number_members ( PortableGroup::ObjectGroup_ptr object_group, - PortableGroup::ObjectGroupId group_id, + CORBA::ULong group_id, const char * type_id ACE_ENV_ARG_DECL); @@ -154,7 +154,7 @@ public: PortableGroup::InvalidCriteria, PortableGroup::InvalidProperty, PortableGroup::CannotMeetCriteria, - PortableGroup::MemberAlreadyPresent)); + PortableGroup::MemberAlreadyPresent)); private: @@ -169,12 +169,20 @@ private: TAO_PG_Factory_Set & factory_set ACE_ENV_ARG_DECL); + /// Get a new ObjectId to be used when creating a new ObjectGroup. + /** + * An ObjectId created by this method will never be reused within + * the scope of a given ReplicationManager. A value suitable for + * use in a map association <ext_id> is also returned. + */ + void get_ObjectId (CORBA::ULong fcid, + PortableServer::ObjectId_out oid); /// Process criteria to be applied to the object group being /// created. /** - * Only the MemberShipStyle, Factories, InitialNumberReplicas and - * MinimumNumberReplicas criteria/properties are defined by the + * Only the MemberShipStyle, Factories, InitialNumberMembers and + * MinimumNumberMembers criteria/properties are defined by the * PortableGroup IDL. Other services that implement the * GenericFactory interface, such as load balancing and fault * tolerance, may choose to support more. @@ -224,9 +232,7 @@ private: * addition to another value that makes it unique to a given Load * Balancer. */ -// CORBA::ULong next_fcid_; - - const char * domain_id_; + CORBA::ULong next_fcid_; /// Lock used to synchronize access to the factory creation id /// index (i.e. next_fcid_). diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.cpp index a4318e9b8fe..7a7c359da50 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.cpp @@ -13,11 +13,11 @@ TAO_PG_Group_Guard::TAO_PG_Group_Guard ( TAO_PG_GenericFactory & generic_factory, TAO_PG_Factory_Set & factory_set, TAO_PG_ObjectGroupManager & group_manager, - const PortableGroup::ObjectGroupId group_id) + const PortableServer::ObjectId & oid) : generic_factory_ (generic_factory), factory_set_ (factory_set), group_manager_ (group_manager), - group_id_ (group_id), + oid_ (oid), released_ (0) { } @@ -36,7 +36,7 @@ TAO_PG_Group_Guard::~TAO_PG_Group_Guard (void) // This should never throw an exception if this Guard is // used properly. - this->group_manager_.destroy_object_group (this->group_id_ + this->group_manager_.destroy_object_group (this->oid_ ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } @@ -53,3 +53,4 @@ TAO_PG_Group_Guard::release (void) { this->released_ = 1; } + diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.h index ac32fbf6a2a..eaa065a6d6c 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Guard.h @@ -54,7 +54,7 @@ public: TAO_PG_Group_Guard (TAO_PG_GenericFactory & generic_factory, TAO_PG_Factory_Set & factory_set, TAO_PG_ObjectGroupManager & group_manager, - const PortableGroup::ObjectGroupId group_id); + const PortableServer::ObjectId & oid); /// Destructor. ~TAO_PG_Group_Guard (void); @@ -76,15 +76,15 @@ private: /// object group map. TAO_PG_ObjectGroupManager & group_manager_; - /// Reference to the ObjectGroupId that is the map key necessary to + /// Reference to the ObjectId that is the map key necessary to /// unbind the corresponding object group map entry from the map /// upon destruction. - const PortableGroup::ObjectGroupId group_id_; + const PortableServer::ObjectId & oid_; /// Flag that dictates whether or not the destructor will perform /// cleanup. int released_; - + }; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp index ae52bc4fc92..52a2a4d9bd5 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp @@ -2,7 +2,6 @@ #include "PG_GenericFactory.h" #include "PG_conf.h" #include "PG_Operators.h" -#include "PG_Utils.h" #include "tao/debug.h" @@ -20,8 +19,6 @@ TAO_PG_ObjectGroupManager::TAO_PG_ObjectGroupManager (void) location_map_ (TAO_PG_MAX_LOCATIONS), generic_factory_ (0), lock_ () -// , lock_ogid_ (), -// next_ogid_ (1) // don't use ogid 0 { } @@ -471,54 +468,22 @@ TAO_PG_ObjectGroupManager::get_member_ref ( CORBA::Object::_nil ()); } -PortableGroup::ObjectGroup_ptr -TAO_PG_ObjectGroupManager::get_object_group_ref_from_id ( - PortableGroup::ObjectGroupId group_id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , PortableGroup::ObjectGroupNotFound - )) -{ - //@@ If we change the PG's concept of ObjectGroupId from - // PortableServer::ObjectId to PortableGroup::ObjectGroupId, can - // just call TAO_PG_ObjectGroupManager::object_group() here. - - TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->lock_, - PortableGroup::ObjectGroup::_nil ()); - - if (this->object_group_map_.find (group_id, group_entry) != 0) - ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), - PortableGroup::ObjectGroup::_nil ()); - } - - if (group_entry == 0) - ACE_THROW_RETURN (CORBA::INTERNAL (), - PortableGroup::ObjectGroup::_nil ()); - - return - PortableGroup::ObjectGroup::_duplicate (group_entry->object_group.in ()); -} PortableGroup::ObjectGroup_ptr TAO_PG_ObjectGroupManager::create_object_group ( + CORBA::ULong group_id, + const PortableServer::ObjectId &oid, const char * type_id, - const char * domain_id, - const PortableGroup::Criteria & the_criteria, - PortableGroup::ObjectGroupId & group_id + const PortableGroup::Criteria & the_criteria ACE_ENV_ARG_DECL) { - CORBA::Object_var object_group = manipulator_.create_object_group ( - type_id, - domain_id, - group_id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableGroup::ObjectGroup::_nil()); + // Create a reference for the ObjectGroup corresponding to the + // RepositoryId of the object being created. + CORBA::Object_var object_group = + this->poa_->create_reference_with_id (oid, + type_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; ACE_NEW_THROW_EX (group_entry, @@ -542,18 +507,19 @@ TAO_PG_ObjectGroupManager::create_object_group ( CORBA::ULong len = the_criteria.length (); group_entry->properties.length (len); - for (CORBA::ULong i = 0; i < len; ++i) group_entry->properties[i] = the_criteria[i]; - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->lock_, - 0); + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->lock_, + 0); - if (this->object_group_map_.bind (group_id, group_entry) != 0) - ACE_THROW_RETURN (PortableGroup::ObjectNotCreated (), - PortableGroup::ObjectGroup::_nil ()); + if (this->object_group_map_.bind (oid, group_entry) != 0) + ACE_THROW_RETURN (PortableGroup::ObjectNotCreated (), + PortableGroup::ObjectGroup::_nil ()); + } (void) safe_group_entry.release (); @@ -562,13 +528,13 @@ TAO_PG_ObjectGroupManager::create_object_group ( void TAO_PG_ObjectGroupManager::destroy_object_group ( - const PortableGroup::ObjectGroupId group_id + const PortableServer::ObjectId & oid ACE_ENV_ARG_DECL) { ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; - if (this->object_group_map_.unbind (group_id, group_entry) != 0) + if (this->object_group_map_.unbind (oid, group_entry) != 0) ACE_THROW (PortableGroup::ObjectNotFound ()); delete group_entry; @@ -593,7 +559,7 @@ TAO_PG_ObjectGroupManager::type_id ( } PortableGroup::ObjectGroup_ptr -TAO_PG_ObjectGroupManager::object_group (const PortableGroup::ObjectGroupId ogid) +TAO_PG_ObjectGroupManager::object_group (const PortableServer::ObjectId & oid) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, @@ -601,7 +567,7 @@ TAO_PG_ObjectGroupManager::object_group (const PortableGroup::ObjectGroupId ogid PortableGroup::ObjectGroup::_nil ()); TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; - if (this->object_group_map_.find (ogid, group_entry) == 0) + if (this->object_group_map_.find (oid, group_entry) == 0) return PortableGroup::ObjectGroup::_duplicate (group_entry->object_group.in ()); else @@ -628,21 +594,13 @@ TAO_PG_ObjectGroupManager::member_count ( return ACE_static_cast (CORBA::ULong, group_entry->member_infos.size ()); } -int -TAO_PG_ObjectGroupManager::init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) +void +TAO_PG_ObjectGroupManager::poa (PortableServer::POA_ptr p) { - ACE_ASSERT (CORBA::is_nil (this->orb_.in ())); - ACE_ASSERT (CORBA::is_nil (this->poa_.in ())); - this->orb_ = CORBA::ORB::_duplicate (orb); - this->poa_ = PortableServer::POA::_duplicate (poa); - - ACE_ASSERT (! CORBA::is_nil (this->orb_.in ())); - ACE_ASSERT (! CORBA::is_nil (this->poa_.in ())); + ACE_ASSERT (CORBA::is_nil (this->poa_.in ()) + && !CORBA::is_nil (p)); - manipulator_.init (orb, poa ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - return 0; + this->poa_ = PortableServer::POA::_duplicate (p); } @@ -682,27 +640,6 @@ TAO_PG_ObjectGroupManager::get_properties ( return safe_properties._retn (); } - -PortableGroup::Properties * -TAO_PG_ObjectGroupManager::get_dynamic_properties ( - PortableGroup::ObjectGroup_ptr object_group - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound)) -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->lock_, - 0); - - TAO_PG_ObjectGroup_Map_Entry * group_entry = - this->get_group_entry (object_group - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return & group_entry->properties; -} - TAO_PG_ObjectGroup_Map_Entry * TAO_PG_ObjectGroupManager::get_group_entry ( CORBA::Object_ptr object_group @@ -713,16 +650,32 @@ TAO_PG_ObjectGroupManager::get_group_entry ( if (CORBA::is_nil (this->poa_.in ())) ACE_THROW_RETURN (CORBA::INTERNAL (), 0); - // { int _TODO_replace_this_with_commemted_out_version_; } - // extract the group_id from the object group reference - PortableGroup::TagGroupTaggedComponent tc; - TAO::PG_Utils::get_tagged_component (object_group, - tc); + PortableServer::ObjectId_var oid; + ACE_TRY + { + oid = this->poa_->reference_to_id (object_group + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (PortableServer::POA::WrongAdapter, ex) + { + if (TAO_debug_level > 0) + ACE_PRINT_EXCEPTION (ex, "TAO_PG (%P|%t) Unexpected exception\n"); + + ACE_TRY_THROW (CORBA::INTERNAL ()); + } + ACE_CATCH (PortableServer::POA::WrongPolicy, ex) + { + if (TAO_debug_level > 0) + ACE_PRINT_EXCEPTION (ex, "TAO_PG (%P|%t) Unexpected exception\n"); - PortableGroup::ObjectGroupId group_id = tc.object_group_id; + ACE_TRY_THROW (CORBA::INTERNAL ()); + } + ACE_ENDTRY; + ACE_CHECK_RETURN (0); TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; - if (this->object_group_map_.find (group_id, group_entry) != 0) + if (this->object_group_map_.find (oid.in (), group_entry) != 0) ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), 0); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h index 5be2b00d523..ab17a05ce25 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h @@ -24,11 +24,11 @@ #include "PG_ObjectGroup_Map.h" #include "PG_Location_Map.h" -#include "PG_Object_Group_Manipulator.h" #include "tao/PortableServer/Key_Adapters.h" #include "tao/PortableServer/PortableServerC.h" + /// Forward declarations class TAO_PG_GenericFactory; @@ -50,7 +50,7 @@ public: TAO_PG_ObjectGroupManager (void); /// Destructor. - virtual ~TAO_PG_ObjectGroupManager (void); + ~TAO_PG_ObjectGroupManager (void); /** * @name PortableGroup::ObjectGroupManager methods @@ -139,19 +139,6 @@ public: PortableGroup::ObjectGroupNotFound, PortableGroup::MemberNotFound)); - /** - * TAO-specific extension. - * Return the ObjectGroup reference for the given ObjectGroupId. - */ - virtual PortableGroup::ObjectGroup_ptr get_object_group_ref_from_id ( - PortableGroup::ObjectGroupId group_id - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , PortableGroup::ObjectGroupNotFound - )); - //@} /// TAO-specific member addition method. @@ -172,24 +159,25 @@ public: PortableGroup::MemberAlreadyPresent, PortableGroup::NoFactory)); - /// Create object an empty object. + /// Create object group hash map entry that represents an actual + /// ObjectGroup. /** * @note This method is used mainly by the * GenericFactory::create_object() method. */ PortableGroup::ObjectGroup_ptr create_object_group ( + CORBA::ULong group_id, + const PortableServer::ObjectId &oid, const char * type_id, - const char * domain_id, - const PortableGroup::Criteria & the_criteria, - PortableGroup::ObjectGroupId & group_id + const PortableGroup::Criteria & the_criteria ACE_ENV_ARG_DECL); - /// Destroy the object group corresponding to the given ObjectGroupId. + /// Destroy the object group corresponding to the given ObjectId. /** * @note This method is used mainly by the * GenericFactory::delete_object() method. */ - void destroy_object_group (const PortableGroup::ObjectGroupId group_id + void destroy_object_group (const PortableServer::ObjectId & oid ACE_ENV_ARG_DECL); /// Return the properties set when the object group was created, and @@ -200,13 +188,6 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound)); - /// Return the dynamic properties for the given group. - PortableGroup::Properties * get_dynamic_properties ( - PortableGroup::ObjectGroup_ptr object_group - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound)); - /// Return the type_id for the given object group. char * type_id (PortableGroup::ObjectGroup_ptr object_group ACE_ENV_ARG_DECL); @@ -217,7 +198,7 @@ public: * group corresponding to the given ObjectId exists. */ PortableGroup::ObjectGroup_ptr object_group ( - const PortableGroup::ObjectGroupId ogid); + const PortableServer::ObjectId & oid); /// Return the number of members in the given object group. CORBA::ULong member_count (PortableGroup::ObjectGroup_ptr group @@ -225,8 +206,9 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound)); - /// Initializes the group manager. - int init (CORBA::ORB_ptr orb, PortableServer::POA_ptr p); + /// Set the POA to use when converting object group references to + /// ObjectIds. + void poa (PortableServer::POA_ptr p); /// Set the pointer to the GenericFactory associated with this /// ObjectGroupManager. @@ -283,27 +265,11 @@ protected: CORBA::Object_ptr member ACE_ENV_ARG_DECL); - /** - * Allocate an ogid for a new object group - */ - void allocate_ogid (PortableGroup::ObjectGroupId & ogid); - - /** - * convert numeric OGID to Sequence<Octet> oid - */ - PortableServer::ObjectId * convert_ogid_to_oid (PortableGroup::ObjectGroupId ogid); - private: - /// The orb - CORBA::ORB_var orb_; - /// Reference to the POA that created the object group references. PortableServer::POA_var poa_; - /// The ObjectGroup Manipulation object - TAO::PG_Object_Group_Manipulator manipulator_; - /// The underlying table that contains all object group /// information. TAO_PG_ObjectGroup_Map object_group_map_; @@ -321,6 +287,7 @@ private: }; + #include /**/ "ace/post.h" #endif /* TAO_PG_OBJECT_GROUP_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp index 3cf6b42ede6..3c0f111538a 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp @@ -8,18 +8,22 @@ ACE_RCSID (PortableGroup, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *>; -template class ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *>; +template class ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex>; + +template class ACE_Equal_To<PortableServer::ObjectId>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *> -#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +#pragma instantiate ACE_Hash_Map_Entry<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *> +#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex> + +#pragma instantiate ACE_Equal_To<PortableServer::ObjectId> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h index d210a19925d..f33a0e344cd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h @@ -46,7 +46,13 @@ public: CORBA::String_var type_id; /// This is the PortableGroup::ObjectGroupId. - PortableGroup::ObjectGroupId group_id; + /** + * The spec states that PortableGroup::ObjectGroupId is a + * CORBA::ULongLong. However, the over 4 billion group IDs that can + * be represented by a CORBA::ULong should be plenty for any + * application. + */ + CORBA::ULong group_id; /// Reference to the ObjectGroup. PortableGroup::ObjectGroup_var object_group; @@ -63,10 +69,10 @@ public: /// ObjectId hash map typedef. typedef ACE_Hash_Map_Manager_Ex< - PortableGroup::ObjectGroupId, + PortableServer::ObjectId, TAO_PG_ObjectGroup_Map_Entry *, - ACE_Hash<ACE_UINT64>, - ACE_Equal_To<ACE_UINT64>, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, ACE_Null_Mutex> TAO_PG_ObjectGroup_Map; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp index 942490421c6..ff191f50869 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp @@ -16,32 +16,12 @@ TAO_PG_PropertyManager::TAO_PG_PropertyManager ( default_properties_ (), type_properties_ (), lock_ (), - property_validator_ (0) + property_validator_ () { } void -TAO_PG_PropertyManager::init ( - TAO_PG_Default_Property_Validator * property_validator ) -{ - if (property_validator) - { - property_validator_ = property_validator; - } - else - { - ACE_NEW_THROW_EX ( - property_validator_, - TAO_PG_Default_Property_Validator, - CORBA::NO_MEMORY () - ); - ACE_CHECK; - } -} - - -void TAO_PG_PropertyManager::set_default_properties ( const PortableGroup::Properties & props ACE_ENV_ARG_DECL) @@ -66,7 +46,7 @@ TAO_PG_PropertyManager::set_default_properties ( property.val)); } - this->property_validator_->validate_property (props + this->property_validator_.validate_property (props ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -126,7 +106,7 @@ TAO_PG_PropertyManager::set_type_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { - this->property_validator_->validate_property (overrides + this->property_validator_.validate_property (overrides ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -138,16 +118,11 @@ TAO_PG_PropertyManager::set_type_properties ( ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); Type_Prop_Table::ENTRY * entry; - if (this->type_properties_.find (type_id, entry) == 0) - { - PortableGroup::Properties & props = entry->int_id_; - props = overrides; - } - else - { - if (this->type_properties_.bind (type_id, overrides) != 0) - ACE_THROW (CORBA::UNKNOWN ()); - } + if (this->type_properties_.find (type_id, entry) != 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + PortableGroup::Properties & props = entry->int_id_; + props = overrides; } @@ -228,28 +203,41 @@ TAO_PG_PropertyManager::remove_type_properties ( void TAO_PG_PropertyManager::set_properties_dynamically ( - PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Properties & overrides + PortableGroup::ObjectGroup_ptr /* object_group */, + const PortableGroup::Properties & /* overrides */ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#if 0 + // First verify that the "InitialNumberMembers" property is not in + // the Properties sequence. According to the spec, it is not + // allowed to be set as part of the default properties. + PortableGroup::Name factories; + factories.length (1); + factories[0].id = + CORBA::string_dup ("org.omg.PortableGroup.InitialNumberMembers"); - this->property_validator_->validate_property (overrides + CORBA::ULong len = props.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + PortableGroup::Property property = props[i]; + + if (property.nam == factories) + ACE_THROW (PortableGroup::InvalidProperty (property.nam, + property.val)); + } + + this->property_validator_.validate_property (overrides ACE_ENV_ARG_PARAMETER); ACE_CHECK; - ACE_GUARD (TAO_SYNCH_MUTEX, property_map_guard, this->lock_); - - PortableGroup::Properties * dynamic_properties = - this->object_group_manager_.get_dynamic_properties (object_group - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + // @todo Set the properties in the object group map entry. +#endif /* 0 */ - // Now override the dynamic (object group) properties with the new values - TAO_PG::override_properties (overrides, *dynamic_properties); + ACE_THROW (CORBA::NO_IMPLEMENT ()); } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h index 5230e0127fd..c0121e9c022 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h @@ -55,10 +55,6 @@ public: /// Constructor. TAO_PG_PropertyManager (TAO_PG_ObjectGroupManager & object_group_manager); - /// Specifies the property validator to use (0 means: use the default) - virtual void init ( - TAO_PG_Default_Property_Validator * property_validator ); - /** * @name PortableGroup::PropertyManager methods * @@ -119,7 +115,7 @@ public: /** * Dynamically set the properties associated with a given object - * group as the replicas are being executed. + * group as the load balancer and replicas are being executed. * These properties override the type-specific and default * properties. */ @@ -182,7 +178,10 @@ private: TAO_SYNCH_MUTEX lock_; /// The property validator. - TAO_PG_Default_Property_Validator * property_validator_; + /** + * @todo Strategize the validator, or use template policies. + */ + TAO_PG_Default_Property_Validator property_validator_; }; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp index 8b17a4425f6..895c5bc8ad3 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp @@ -34,7 +34,14 @@ TAO_PG::override_properties ( return; const CORBA::ULong old_length = properties.length (); - // const CORBA::ULong new_length = old_length; + + const CORBA::ULong new_length = + (num_overrides > old_length ? num_overrides : old_length); + + // Increase the length wholesale as much as possible. The idea is + // to keep the cost of the incremental growth that may occur below + // to a minimum. + properties.length (new_length); // @@ Slow O(n^2) operation. Note that it may be slower than O(n^2) // if the length of the property sequence must be increased diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Loader.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Loader.h index ceb1912e470..de96b0bf840 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Loader.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Loader.h @@ -33,7 +33,7 @@ * This class acts as a facade for the PortableGroup library to the * ORB. */ -class TAO_PortableGroup_Export TAO_PortableGroup_Loader +class TAO_PortableGroup_Export TAO_PortableGroup_Loader : public ACE_Service_Object { friend class TAO_POA_Hooks; @@ -58,7 +58,7 @@ ACE_FACTORY_DECLARE (TAO_PortableGroup, TAO_PortableGroup_Loader) typedef int (*TAO_Module_Initializer) (void); static TAO_Module_Initializer -TAO_Requires_PortableGroup_Initializer = +TAO_Requires_PortableGroup_Initializer = &TAO_PortableGroup_Loader::Initializer; #else diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.h index 0837d9989db..23144844275 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.h @@ -4,7 +4,6 @@ /** * @file PortableGroup_Request_Dispatcher.h * - * $Id$ * * A class that strategizes the request dispatching procedure. diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h index 185cad17d0d..d0a3fa4d2bc 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/Portable_Group_Map.h @@ -67,11 +67,11 @@ class TAO_PortableGroup_Export TAO_Portable_Group_Map { public: - /** - * @struct Map_Entry - * - * @brief Value field of the portable group map. - */ + /** + * @struct Map_Entry + * + * @brief Value field of the portable group map. + */ struct Map_Entry { /// The key. diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.h b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.h index 5be819f9668..c259c04f960 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.h @@ -106,7 +106,7 @@ protected: * virtual to allow a derived class implementation to be invoked * instead. */ - virtual int open_i (const ACE_INET_Addr &addr, + virtual int open_i (const ACE_INET_Addr &addr, ACE_Reactor *reactor); /// Parse protocol specific options. diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp index 7cf8dcd3b92..21e73eb6a08 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp @@ -224,11 +224,7 @@ int TAO_UIPMC_Connection_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { - // No asserts here since the handler is registered with the Reactor - // and the handler ownership is given to the Reactor. When the - // Reactor closes, it will call handle_close() on the handler. It - // is however important to overwrite handle_close() to do nothing - // since the base class does too much. + ACE_ASSERT (0); return 0; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp index 8afe68d659b..9b04d83c7bd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp @@ -87,6 +87,7 @@ TAO_UIPMC_Transport::TAO_UIPMC_Transport (TAO_UIPMC_Connection_Handler *handler, TAO_UIPMC_Transport::~TAO_UIPMC_Transport (void) { + ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h index 0026d265d16..2678c92d575 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h @@ -12,7 +12,7 @@ #ifndef TAO_UIPMC_TRANSPORT_H #define TAO_UIPMC_TRANSPORT_H -#include /**/ "ace/pre.h" +#include "ace/pre.h" #include "tao/Transport.h" @@ -128,5 +128,5 @@ private: #include "UIPMC_Transport.i" #endif /* __ACE_INLINE__ */ -#include /**/ "ace/post.h" +#include "ace/post.h" #endif /* TAO_UIPMC_TRANSPORT_H */ |