Map of object ids to servants. More...
#include <Active_Object_Map.h>
Map of object ids to servants.
Implementation to be used by the POA.
Definition at line 50 of file Active_Object_Map.h.
Servant hash map.
Definition at line 231 of file Active_Object_Map.h.
typedef ACE_Map_Manager_Adapter< PortableServer::Servant, TAO_Active_Object_Map_Entry *, ACE_Noop_Key_Generator<PortableServer::Servant> > TAO_Active_Object_Map::servant_linear_map |
Servant linear map.
Definition at line 238 of file Active_Object_Map.h.
typedef ACE_Map< PortableServer::Servant, TAO_Active_Object_Map_Entry *> TAO_Active_Object_Map::servant_map |
Base class of the servant map.
Definition at line 223 of file Active_Object_Map.h.
typedef ACE_Active_Map_Manager_Adapter< PortableServer::ObjectId, TAO_Active_Object_Map_Entry *, TAO_Ignore_Original_Key_Adapter> TAO_Active_Object_Map::user_id_active_map |
Id active map.
Definition at line 218 of file Active_Object_Map.h.
Id hash map.
Definition at line 206 of file Active_Object_Map.h.
typedef ACE_Map_Manager_Adapter< PortableServer::ObjectId, TAO_Active_Object_Map_Entry *, TAO_Incremental_Key_Generator> TAO_Active_Object_Map::user_id_linear_map |
Id linear map.
Definition at line 212 of file Active_Object_Map.h.
typedef ACE_Map< PortableServer::ObjectId, TAO_Active_Object_Map_Entry *> TAO_Active_Object_Map::user_id_map |
Base class of the id map.
Definition at line 198 of file Active_Object_Map.h.
TAO_Active_Object_Map::TAO_Active_Object_Map | ( | int | user_id_policy, | |
int | unique_id_policy, | |||
int | persistent_id_policy, | |||
const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters & | creation_parameters | |||
) |
Constructor.
Definition at line 77 of file Active_Object_Map.cpp.
: user_id_map_ (0) , servant_map_ (0) , id_uniqueness_strategy_ (0) , lifespan_strategy_ (0) , id_assignment_strategy_ (0) , id_hint_strategy_ (0) , using_active_maps_ (false) { TAO_Active_Object_Map::set_system_id_size (creation_parameters); TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0; if (unique_id_policy) { ACE_NEW_THROW_EX (id_uniqueness_strategy, TAO_Unique_Id_Strategy, CORBA::NO_MEMORY ()); } else { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_uniqueness_strategy, TAO_Multiple_Id_Strategy, CORBA::NO_MEMORY ()); #else ACE_ERROR ((LM_ERROR, "Multiple Id Strategy not supported with CORBA/e\n")); #endif } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy); TAO_Lifespan_Strategy *lifespan_strategy = 0; if (persistent_id_policy) { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (lifespan_strategy, TAO_Persistent_Strategy, CORBA::NO_MEMORY ()); #else ACE_UNUSED_ARG (persistent_id_policy); ACE_ERROR ((LM_ERROR, "Persistent Id Strategy not supported with CORBA/e\n")); #endif } else { ACE_NEW_THROW_EX (lifespan_strategy, TAO_Transient_Strategy, CORBA::NO_MEMORY ()); } // Give ownership to the auto pointer. auto_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy); TAO_Id_Assignment_Strategy *id_assignment_strategy = 0; if (user_id_policy) { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_assignment_strategy, TAO_User_Id_Strategy, CORBA::NO_MEMORY ()); #else ACE_ERROR ((LM_ERROR, "User Id Assignment not supported with CORBA/e\n")); #endif } else if (unique_id_policy) { ACE_NEW_THROW_EX (id_assignment_strategy, TAO_System_Id_With_Unique_Id_Strategy, CORBA::NO_MEMORY ()); } else { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_assignment_strategy, TAO_System_Id_With_Multiple_Id_Strategy, CORBA::NO_MEMORY ()); #else ACE_ERROR ((LM_ERROR, "System Id Assignment with multiple " "not supported with CORBA/e\n")); #endif } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy); TAO_Id_Hint_Strategy *id_hint_strategy = 0; if ((user_id_policy || creation_parameters.allow_reactivation_of_system_ids_) && creation_parameters.use_active_hint_in_ids_) { this->using_active_maps_ = true; ACE_NEW_THROW_EX (id_hint_strategy, TAO_Active_Hint_Strategy ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); } else { ACE_NEW_THROW_EX (id_hint_strategy, TAO_No_Hint_Strategy, CORBA::NO_MEMORY ()); } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy); servant_map *sm = 0; if (unique_id_policy) { switch (creation_parameters.reverse_object_lookup_strategy_for_unique_id_policy_) { case TAO_LINEAR: #if (TAO_HAS_MINIMUM_POA_MAPS == 0) ACE_NEW_THROW_EX (sm, servant_linear_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else ACE_ERROR ((LM_ERROR, "linear option for " "-ORBUniqueidPolicyReverseDemuxStrategy " "not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: ACE_NEW_THROW_EX (sm, servant_hash_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } // Give ownership to the auto pointer. auto_ptr<servant_map> new_servant_map (sm); user_id_map *uim = 0; if (user_id_policy || creation_parameters.allow_reactivation_of_system_ids_) { switch (creation_parameters.object_lookup_strategy_for_user_id_policy_) { case TAO_LINEAR: #if (TAO_HAS_MINIMUM_POA_MAPS == 0) ACE_NEW_THROW_EX (uim, user_id_linear_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else ACE_ERROR ((LM_ERROR, "linear option for -ORBUseridPolicyDemuxStrategy " "not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } else { switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: ACE_NEW_THROW_EX (uim, user_id_linear_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; case TAO_DYNAMIC_HASH: ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else case TAO_LINEAR: case TAO_DYNAMIC_HASH: ACE_ERROR ((LM_ERROR, "linear and dynamic options for -ORBSystemidPolicyDemuxStrategy " "are not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_ACTIVE_DEMUX: default: this->using_active_maps_ = true; ACE_NEW_THROW_EX (uim, user_id_active_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } // Give ownership to the auto pointer. auto_ptr<user_id_map> new_user_id_map (uim); id_uniqueness_strategy->set_active_object_map (this); lifespan_strategy->set_active_object_map (this); id_assignment_strategy->set_active_object_map (this); // Finally everything is fine. Make sure to take ownership away // from the auto pointer. this->id_uniqueness_strategy_ = new_id_uniqueness_strategy; this->lifespan_strategy_ = new_lifespan_strategy; this->id_assignment_strategy_ = new_id_assignment_strategy; this->id_hint_strategy_ = new_id_hint_strategy; this->servant_map_ = new_servant_map; this->user_id_map_ = new_user_id_map; #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1) ACE_NEW (this->monitor_, ACE::Monitor_Control::Size_Monitor); #endif /* TAO_HAS_MONITOR_POINTS==1 */ }
TAO_Active_Object_Map::~TAO_Active_Object_Map | ( | void | ) |
Destructor.
Definition at line 322 of file Active_Object_Map.cpp.
{ user_id_map::iterator iterator = this->user_id_map_->begin (); user_id_map::iterator end = this->user_id_map_->end (); for (; iterator != end; ++iterator) { user_id_map::value_type map_entry = *iterator; delete map_entry.second (); } #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1) this->monitor_->remove_from_registry (); this->monitor_->remove_ref (); #endif /* TAO_HAS_MONITOR_POINTS==1 */ }
int TAO_Active_Object_Map::bind_using_system_id_returning_system_id | ( | PortableServer::Servant | servant, | |
CORBA::Short | priority, | |||
PortableServer::ObjectId_out | system_id | |||
) |
Must be used with SYSTEM_ID policy.
Definition at line 18 of file Active_Object_Map.inl.
{ if (servant == 0 && !this->using_active_maps_) { PortableServer::ObjectId id; int result = this->user_id_map_->create_key (id); if (result == 0) { ACE_NEW_RETURN (system_id, PortableServer::ObjectId (id), -1); } return result; } TAO_Active_Object_Map_Entry *entry = 0; int result = this->id_assignment_strategy_->bind_using_system_id (servant, priority, entry); if (result == 0) { result = this->id_hint_strategy_->system_id (system_id, *entry); } return result; }
int TAO_Active_Object_Map::bind_using_system_id_returning_user_id | ( | PortableServer::Servant | servant, | |
CORBA::Short | priority, | |||
PortableServer::ObjectId_out | user_id | |||
) |
Must be used with SYSTEM_ID policy.
Definition at line 56 of file Active_Object_Map.inl.
{ TAO_Active_Object_Map_Entry *entry = 0; int result = this->id_assignment_strategy_->bind_using_system_id (servant, priority, entry); if (result == 0) ACE_NEW_RETURN (user_id, PortableServer::ObjectId (entry->user_id_), -1); return result; }
int TAO_Active_Object_Map::bind_using_user_id | ( | PortableServer::Servant | servant, | |
const PortableServer::ObjectId & | user_id, | |||
CORBA::Short | priority | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 75 of file Active_Object_Map.inl.
{ TAO_Active_Object_Map_Entry *entry = 0; return this->id_uniqueness_strategy_->bind_using_user_id (servant, user_id, priority, entry); }
size_t TAO_Active_Object_Map::current_size | ( | void | ) |
Size of the map.
Definition at line 281 of file Active_Object_Map.inl.
{ return this->user_id_map_->current_size (); }
int TAO_Active_Object_Map::find_entry_using_user_id | ( | const PortableServer::ObjectId & | user_id, | |
TAO_Active_Object_Map_Entry *& | entry | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is identical to system_id
.
-1 | Entry is not found or is deactivated. | |
0 | Entry is found. |
Definition at line 202 of file Active_Object_Map.inl.
{ int result = this->user_id_map_->find (user_id, entry); if (result == 0) { if (entry->deactivated_) { result = -1; } } return result; }
int TAO_Active_Object_Map::find_servant_and_system_id_using_user_id | ( | const PortableServer::ObjectId & | user_id, | |
PortableServer::Servant & | servant, | |||
PortableServer::ObjectId_out | system_id, | |||
CORBA::Short & | priority | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is identical to system_id.
Definition at line 220 of file Active_Object_Map.inl.
{ TAO_Active_Object_Map_Entry *entry = 0; int result = this->find_entry_using_user_id (user_id, entry); if (result == 0) { if (entry->servant_ == 0) { result = -1; } else { result = this->id_hint_strategy_->system_id (system_id, *entry); if (result == 0) { servant = entry->servant_; priority = entry->priority_; } } } return result; }
int TAO_Active_Object_Map::find_servant_using_system_id_and_user_id | ( | const PortableServer::ObjectId & | system_id, | |
const PortableServer::ObjectId & | user_id, | |||
PortableServer::Servant & | servant, | |||
TAO_Active_Object_Map_Entry *& | entry | |||
) |
Can be used with any policy.
Definition at line 187 of file Active_Object_Map.inl.
{ return this->lifespan_strategy_->find_servant_using_system_id_and_user_id ( system_id, user_id, servant, entry); }
int TAO_Active_Object_Map::find_servant_using_user_id | ( | const PortableServer::ObjectId & | user_id, | |
PortableServer::Servant & | servant | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 160 of file Active_Object_Map.inl.
{ TAO_Active_Object_Map_Entry *entry = 0; int result = this->user_id_map_->find (user_id, entry); if (result == 0) { if (entry->deactivated_) { result = -1; } else if (entry->servant_ == 0) { result = -1; } else { servant = entry->servant_; } } return result; }
int TAO_Active_Object_Map::find_system_id_using_servant | ( | PortableServer::Servant | servant, | |
PortableServer::ObjectId_out | system_id, | |||
CORBA::Short & | priority | |||
) |
Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 148 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->find_system_id_using_servant (servant, system_id, priority); }
int TAO_Active_Object_Map::find_system_id_using_user_id | ( | const PortableServer::ObjectId & | user_id, | |
CORBA::Short | priority, | |||
PortableServer::ObjectId_out | system_id | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 88 of file Active_Object_Map.inl.
{ if (!this->using_active_maps_) { ACE_NEW_RETURN (system_id, PortableServer::ObjectId (user_id), -1); return 0; } TAO_Active_Object_Map_Entry *entry = 0; int result = this->id_uniqueness_strategy_->bind_using_user_id (0, user_id, priority, entry); if (result == 0) { result = this->id_hint_strategy_->system_id (system_id, *entry); } return result; }
int TAO_Active_Object_Map::find_user_id_using_servant | ( | PortableServer::Servant | servant, | |
PortableServer::ObjectId_out | user_id | |||
) |
Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 138 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->find_user_id_using_servant (servant, user_id); }
int TAO_Active_Object_Map::find_user_id_using_system_id | ( | const PortableServer::ObjectId & | system_id, | |
PortableServer::ObjectId & | user_id | |||
) |
Can be used with any policy. When the SYSTEM_ID policy is used, the system_id is identical to user_id.
Definition at line 267 of file Active_Object_Map.inl.
{ return this->id_hint_strategy_->recover_key (system_id, user_id); }
int TAO_Active_Object_Map::find_user_id_using_system_id | ( | const PortableServer::ObjectId & | system_id, | |
PortableServer::ObjectId_out | user_id | |||
) |
Can be used with any policy. When the SYSTEM_ID policy is used, the system_id is identical to user_id.
Definition at line 251 of file Active_Object_Map.inl.
{ PortableServer::ObjectId id; if (this->id_hint_strategy_->recover_key (system_id, id) == 0) { ACE_NEW_RETURN (user_id, PortableServer::ObjectId (id), -1); } return 0; }
int TAO_Active_Object_Map::is_servant_in_map | ( | PortableServer::Servant | servant, | |
bool & | deactivated | |||
) |
Must be used with UNIQUE_ID policy.
Definition at line 10 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->is_servant_in_map (servant, deactivated); }
bool TAO_Active_Object_Map::is_user_id_in_map | ( | const PortableServer::ObjectId & | user_id, | |
CORBA::Short | priority, | |||
bool & | priorities_match, | |||
bool & | deactivated | |||
) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 342 of file Active_Object_Map.cpp.
{ TAO_Active_Object_Map_Entry *entry = 0; bool result = false; int const find_result = this->user_id_map_->find (user_id, entry); if (find_result == 0) { if (entry->servant_ == 0) { if (entry->priority_ != priority) { priorities_match = false; } } else { result = true; if (entry->deactivated_) { deactivated = true; } } } return result; }
int TAO_Active_Object_Map::rebind_using_user_id_and_system_id | ( | PortableServer::Servant | servant, | |
const PortableServer::ObjectId & | user_id, | |||
const PortableServer::ObjectId & | system_id, | |||
TAO_Active_Object_Map_Entry *& | entry | |||
) |
Can be used with any policy.
Definition at line 118 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->bind_using_user_id (servant, user_id, -1, entry); }
CORBA::Boolean TAO_Active_Object_Map::remaining_activations | ( | PortableServer::Servant | servant | ) |
Are there any remaining activations of servant in the active object map? Can be used with any policy.
Definition at line 275 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->remaining_activations (servant); }
void TAO_Active_Object_Map::set_system_id_size | ( | const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters & | creation_parameters | ) | [static] |
Set the system id size.
Definition at line 25 of file Active_Object_Map.cpp.
{ if (TAO_Active_Object_Map::system_id_size_ == 0) { if (creation_parameters.allow_reactivation_of_system_ids_) { switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); break; #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); break; } size_t hint_size = 0; if (creation_parameters.use_active_hint_in_ids_) hint_size = ACE_Active_Map_Manager_Key::size (); TAO_Active_Object_Map::system_id_size_ += hint_size; } else { switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); break; case TAO_DYNAMIC_HASH: TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); break; #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_ACTIVE_DEMUX: default: TAO_Active_Object_Map::system_id_size_ = ACE_Active_Map_Manager_Key::size (); break; } } } }
size_t TAO_Active_Object_Map::system_id_size | ( | void | ) | [static] |
Can be used with any policy.
Definition at line 288 of file Active_Object_Map.inl.
{ return TAO_Active_Object_Map::system_id_size_; }
int TAO_Active_Object_Map::unbind_using_user_id | ( | const PortableServer::ObjectId & | user_id | ) |
Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.
Definition at line 131 of file Active_Object_Map.inl.
{ return this->id_uniqueness_strategy_->unbind_using_user_id (user_id); }
Id assignment strategy.
Definition at line 254 of file Active_Object_Map.h.
Id hint strategy.
Definition at line 257 of file Active_Object_Map.h.
Id uniqueness strategy.
Definition at line 248 of file Active_Object_Map.h.
Lifespan strategy.
Definition at line 251 of file Active_Object_Map.h.
Servant map.
Definition at line 245 of file Active_Object_Map.h.
size_t TAO_Active_Object_Map::system_id_size_ = 0 [static] |
Size of the system id produced by the map.
Definition at line 264 of file Active_Object_Map.h.
Id map.
Definition at line 242 of file Active_Object_Map.h.
Flag to see if we are using active maps in this active object map.
Definition at line 261 of file Active_Object_Map.h.