00001
00002
00003 #include "tao/PortableServer/Active_Object_Map.h"
00004 #include "tao/PortableServer/Active_Object_Map_Entry.h"
00005 #include "tao/SystemException.h"
00006
00007 #if !defined (__ACE_INLINE__)
00008 # include "tao/PortableServer/Active_Object_Map.i"
00009 #endif
00010
00011 #include "ace/Auto_Ptr.h"
00012
00013 ACE_RCSID(PortableServer,
00014 Active_Object_Map,
00015 "Active_Object_Map.cpp,v 1.11 2006/03/10 07:19:13 jtc Exp")
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019
00020 size_t TAO_Active_Object_Map::system_id_size_ = 0;
00021
00022 void
00023 TAO_Active_Object_Map::set_system_id_size
00024 (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters)
00025 {
00026 if (TAO_Active_Object_Map::system_id_size_ == 0)
00027 {
00028 if (creation_parameters.allow_reactivation_of_system_ids_)
00029 {
00030 switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
00031 {
00032 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00033 case TAO_LINEAR:
00034 TAO_Active_Object_Map::system_id_size_ =
00035 sizeof (CORBA::ULong);
00036 break;
00037 #endif
00038
00039 case TAO_DYNAMIC_HASH:
00040 default:
00041 TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong);
00042 break;
00043 }
00044
00045 size_t hint_size = 0;
00046
00047 if (creation_parameters.use_active_hint_in_ids_)
00048 hint_size = ACE_Active_Map_Manager_Key::size ();
00049
00050 TAO_Active_Object_Map::system_id_size_ += hint_size;
00051 }
00052 else
00053 {
00054 switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
00055 {
00056 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00057 case TAO_LINEAR:
00058 TAO_Active_Object_Map::system_id_size_ =
00059 sizeof (CORBA::ULong);
00060 break;
00061
00062 case TAO_DYNAMIC_HASH:
00063 TAO_Active_Object_Map::system_id_size_ =
00064 sizeof (CORBA::ULong);
00065 break;
00066 #endif
00067
00068 case TAO_ACTIVE_DEMUX:
00069 default:
00070 TAO_Active_Object_Map::system_id_size_ =
00071 ACE_Active_Map_Manager_Key::size ();
00072 break;
00073 }
00074 }
00075 }
00076 }
00077
00078 TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy,
00079 int unique_id_policy,
00080 int persistent_id_policy,
00081 const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters
00082 ACE_ENV_ARG_DECL)
00083 : user_id_map_ (0),
00084 servant_map_ (0),
00085 id_uniqueness_strategy_ (0),
00086 lifespan_strategy_ (0),
00087 id_assignment_strategy_ (0),
00088 id_hint_strategy_ (0),
00089 using_active_maps_ (0)
00090 {
00091 TAO_Active_Object_Map::set_system_id_size (creation_parameters);
00092
00093 TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0;
00094
00095 if (unique_id_policy)
00096 {
00097 ACE_NEW_THROW_EX (id_uniqueness_strategy,
00098 TAO_Unique_Id_Strategy,
00099 CORBA::NO_MEMORY ());
00100 ACE_CHECK;
00101 }
00102 else
00103 {
00104 ACE_NEW_THROW_EX (id_uniqueness_strategy,
00105 TAO_Multiple_Id_Strategy,
00106 CORBA::NO_MEMORY ());
00107 ACE_CHECK;
00108 }
00109
00110
00111 auto_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy);
00112
00113 TAO_Lifespan_Strategy *lifespan_strategy = 0;
00114
00115 if (persistent_id_policy)
00116 {
00117 ACE_NEW_THROW_EX (lifespan_strategy,
00118 TAO_Persistent_Strategy,
00119 CORBA::NO_MEMORY ());
00120 ACE_CHECK;
00121 }
00122 else
00123 {
00124 ACE_NEW_THROW_EX (lifespan_strategy,
00125 TAO_Transient_Strategy,
00126 CORBA::NO_MEMORY ());
00127 ACE_CHECK;
00128 }
00129
00130
00131 auto_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy);
00132
00133 TAO_Id_Assignment_Strategy *id_assignment_strategy = 0;
00134
00135 if (user_id_policy)
00136 {
00137 ACE_NEW_THROW_EX (id_assignment_strategy,
00138 TAO_User_Id_Strategy,
00139 CORBA::NO_MEMORY ());
00140 ACE_CHECK;
00141 }
00142 else if (unique_id_policy)
00143 {
00144 ACE_NEW_THROW_EX (id_assignment_strategy,
00145 TAO_System_Id_With_Unique_Id_Strategy,
00146 CORBA::NO_MEMORY ());
00147 ACE_CHECK;
00148 }
00149 else
00150 {
00151 ACE_NEW_THROW_EX (id_assignment_strategy,
00152 TAO_System_Id_With_Multiple_Id_Strategy,
00153 CORBA::NO_MEMORY ());
00154 ACE_CHECK;
00155 }
00156
00157
00158 auto_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy);
00159
00160 TAO_Id_Hint_Strategy *id_hint_strategy = 0;
00161 if ((user_id_policy
00162 || creation_parameters.allow_reactivation_of_system_ids_)
00163 && creation_parameters.use_active_hint_in_ids_)
00164 {
00165 this->using_active_maps_ = 1;
00166
00167 ACE_NEW_THROW_EX (id_hint_strategy,
00168 TAO_Active_Hint_Strategy (creation_parameters.active_object_map_size_),
00169 CORBA::NO_MEMORY ());
00170 ACE_CHECK;
00171 }
00172 else
00173 {
00174 ACE_NEW_THROW_EX (id_hint_strategy,
00175 TAO_No_Hint_Strategy,
00176 CORBA::NO_MEMORY ());
00177 ACE_CHECK;
00178 }
00179
00180
00181 auto_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy);
00182
00183 servant_map *sm = 0;
00184 if (unique_id_policy)
00185 {
00186 switch (creation_parameters.reverse_object_lookup_strategy_for_unique_id_policy_)
00187 {
00188 case TAO_LINEAR:
00189 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00190 ACE_NEW_THROW_EX (sm,
00191 servant_linear_map (creation_parameters.active_object_map_size_),
00192 CORBA::NO_MEMORY ());
00193 ACE_CHECK;
00194 break;
00195 #else
00196 ACE_ERROR ((LM_ERROR,
00197 "linear option for -ORBUniqueidPolicyReverseDemuxStrategy "
00198 "not supported with minimum POA maps. "
00199 "Ingoring option to use default... \n"));
00200
00201 #endif
00202
00203 case TAO_DYNAMIC_HASH:
00204 default:
00205 ACE_NEW_THROW_EX (sm,
00206 servant_hash_map (creation_parameters.active_object_map_size_),
00207 CORBA::NO_MEMORY ());
00208 ACE_CHECK;
00209 break;
00210 }
00211 }
00212
00213
00214 auto_ptr<servant_map> new_servant_map (sm);
00215
00216 user_id_map *uim = 0;
00217 if (user_id_policy
00218 || creation_parameters.allow_reactivation_of_system_ids_)
00219 {
00220 switch (creation_parameters.object_lookup_strategy_for_user_id_policy_)
00221 {
00222 case TAO_LINEAR:
00223 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00224 ACE_NEW_THROW_EX (uim,
00225 user_id_linear_map (creation_parameters.active_object_map_size_),
00226 CORBA::NO_MEMORY ());
00227 ACE_CHECK;
00228 break;
00229 #else
00230 ACE_ERROR ((LM_ERROR,
00231 "linear option for -ORBUseridPolicyDemuxStrategy "
00232 "not supported with minimum POA maps. "
00233 "Ingoring option to use default... \n"));
00234
00235 #endif
00236
00237 case TAO_DYNAMIC_HASH:
00238 default:
00239 ACE_NEW_THROW_EX (uim,
00240 user_id_hash_map (creation_parameters.active_object_map_size_),
00241 CORBA::NO_MEMORY ());
00242 ACE_CHECK;
00243 break;
00244 }
00245 }
00246 else
00247 {
00248 switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
00249 {
00250 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00251 case TAO_LINEAR:
00252 ACE_NEW_THROW_EX (uim,
00253 user_id_linear_map (creation_parameters.active_object_map_size_),
00254 CORBA::NO_MEMORY ());
00255 ACE_CHECK;
00256 break;
00257
00258 case TAO_DYNAMIC_HASH:
00259 ACE_NEW_THROW_EX (uim,
00260 user_id_hash_map (creation_parameters.active_object_map_size_),
00261 CORBA::NO_MEMORY ());
00262 ACE_CHECK;
00263 break;
00264 #else
00265 case TAO_LINEAR:
00266 case TAO_DYNAMIC_HASH:
00267 ACE_ERROR ((LM_ERROR,
00268 "linear and dynamic options for -ORBSystemidPolicyDemuxStrategy "
00269 "are not supported with minimum POA maps. "
00270 "Ingoring option to use default... \n"));
00271
00272 #endif
00273
00274 case TAO_ACTIVE_DEMUX:
00275 default:
00276
00277 this->using_active_maps_ = 1;
00278
00279 ACE_NEW_THROW_EX (uim,
00280 user_id_active_map (creation_parameters.active_object_map_size_),
00281 CORBA::NO_MEMORY ());
00282 ACE_CHECK;
00283 break;
00284 }
00285 }
00286
00287
00288 auto_ptr<user_id_map> new_user_id_map (uim);
00289
00290 id_uniqueness_strategy->set_active_object_map (this);
00291 lifespan_strategy->set_active_object_map (this);
00292 id_assignment_strategy->set_active_object_map (this);
00293
00294
00295
00296 this->id_uniqueness_strategy_ = new_id_uniqueness_strategy.release ();
00297 this->lifespan_strategy_ = new_lifespan_strategy.release ();
00298 this->id_assignment_strategy_ = new_id_assignment_strategy.release ();
00299 this->id_hint_strategy_ = new_id_hint_strategy.release ();
00300 this->servant_map_ = new_servant_map.release ();
00301 this->user_id_map_ = new_user_id_map.release ();
00302 }
00303
00304 TAO_Active_Object_Map::~TAO_Active_Object_Map (void)
00305 {
00306 user_id_map::iterator iterator = this->user_id_map_->begin ();
00307 user_id_map::iterator end = this->user_id_map_->end ();
00308
00309 for (;
00310 iterator != end;
00311 ++iterator)
00312 {
00313 user_id_map::value_type map_entry = *iterator;
00314 delete map_entry.second ();
00315 }
00316
00317 delete this->id_uniqueness_strategy_;
00318 delete this->lifespan_strategy_;
00319 delete this->id_assignment_strategy_;
00320 delete this->id_hint_strategy_;
00321 delete this->servant_map_;
00322 delete this->user_id_map_;
00323 }
00324
00325 int
00326 TAO_Active_Object_Map::is_user_id_in_map (const PortableServer::ObjectId &user_id,
00327 CORBA::Short priority,
00328 int &priorities_match,
00329 int &deactivated)
00330 {
00331 TAO_Active_Object_Map_Entry *entry = 0;
00332 int result = this->user_id_map_->find (user_id,
00333 entry);
00334 if (result == 0)
00335 {
00336 if (entry->servant_ == 0)
00337 {
00338 result = 0;
00339
00340 if (entry->priority_ != priority)
00341 priorities_match = 0;
00342 }
00343 else
00344 {
00345 result = 1;
00346 if (entry->deactivated_)
00347 {
00348 deactivated = 1;
00349 }
00350 }
00351 }
00352 else
00353 {
00354 result = 0;
00355 }
00356
00357 return result;
00358 }
00359
00360
00361
00362 TAO_Id_Uniqueness_Strategy::~TAO_Id_Uniqueness_Strategy (void)
00363 {
00364 }
00365
00366 void
00367 TAO_Id_Uniqueness_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
00368 {
00369 this->active_object_map_ = active_object_map;
00370 }
00371
00372 int
00373 TAO_Unique_Id_Strategy::is_servant_in_map (PortableServer::Servant servant,
00374 int &deactivated)
00375 {
00376 TAO_Active_Object_Map_Entry *entry = 0;
00377 int result = this->active_object_map_->servant_map_->find (servant,
00378 entry);
00379 if (result == 0)
00380 {
00381 result = 1;
00382 if (entry->deactivated_)
00383 {
00384 deactivated = 1;
00385 }
00386 }
00387 else
00388 {
00389 result = 0;
00390 }
00391
00392 return result;
00393 }
00394
00395 int
00396 TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant,
00397 const PortableServer::ObjectId &user_id,
00398 CORBA::Short priority,
00399 TAO_Active_Object_Map_Entry *&entry)
00400 {
00401 int result = this->active_object_map_->user_id_map_->find (user_id,
00402 entry);
00403 if (result == 0)
00404 {
00405 if (servant != 0)
00406 {
00407 entry->servant_ = servant;
00408
00409 result = this->active_object_map_->servant_map_->bind (entry->servant_,
00410 entry);
00411 }
00412 }
00413 else
00414 {
00415 ACE_NEW_RETURN (entry,
00416 TAO_Active_Object_Map_Entry,
00417 -1);
00418 entry->user_id_ = user_id;
00419 entry->servant_ = servant;
00420 entry->priority_ = priority;
00421
00422 result = this->active_object_map_->id_hint_strategy_->bind (*entry);
00423
00424 if (result == 0)
00425 {
00426 result = this->active_object_map_->user_id_map_->bind (entry->user_id_,
00427 entry);
00428 if (result == 0)
00429 {
00430 if (servant != 0)
00431 result = this->active_object_map_->servant_map_->bind (entry->servant_,
00432 entry);
00433 if (result != 0)
00434 {
00435 this->active_object_map_->user_id_map_->unbind (entry->user_id_);
00436 this->active_object_map_->id_hint_strategy_->unbind (*entry);
00437 delete entry;
00438 }
00439 }
00440 else
00441 {
00442 this->active_object_map_->id_hint_strategy_->unbind (*entry);
00443 delete entry;
00444 }
00445 }
00446 else
00447 delete entry;
00448 }
00449
00450 return result;
00451 }
00452
00453 int
00454 TAO_Unique_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId &user_id)
00455 {
00456 TAO_Active_Object_Map_Entry *entry = 0;
00457 int result = this->active_object_map_->user_id_map_->unbind (user_id,
00458 entry);
00459 if (result == 0)
00460 {
00461 if (entry->servant_ != 0)
00462 result = this->active_object_map_->servant_map_->unbind (entry->servant_);
00463
00464 if (result == 0)
00465 result =
00466 this->active_object_map_->id_hint_strategy_->unbind (*entry);
00467
00468 if (result == 0)
00469 delete entry;
00470 }
00471 return result;
00472 }
00473
00474 int
00475 TAO_Unique_Id_Strategy::find_user_id_using_servant (PortableServer::Servant servant,
00476 PortableServer::ObjectId_out user_id)
00477 {
00478 TAO_Active_Object_Map_Entry *entry = 0;
00479 int result = this->active_object_map_->servant_map_->find (servant,
00480 entry);
00481 if (result == 0)
00482 {
00483 if (entry->deactivated_)
00484 result = -1;
00485 else
00486 ACE_NEW_RETURN (user_id,
00487 PortableServer::ObjectId (entry->user_id_),
00488 -1);
00489 }
00490
00491 return result;
00492 }
00493
00494 int
00495 TAO_Unique_Id_Strategy::find_system_id_using_servant (PortableServer::Servant servant,
00496 PortableServer::ObjectId_out system_id,
00497 CORBA::Short &priority)
00498 {
00499 TAO_Active_Object_Map_Entry *entry = 0;
00500 int result = this->active_object_map_->servant_map_->find (servant,
00501 entry);
00502 if (result == 0)
00503 {
00504 if (entry->deactivated_)
00505 result = -1;
00506 else
00507 {
00508 result = this->active_object_map_->id_hint_strategy_->system_id (system_id,
00509 *entry);
00510 if (result == 0)
00511 priority = entry->priority_;
00512 }
00513 }
00514
00515 return result;
00516 }
00517
00518 CORBA::Boolean
00519 TAO_Unique_Id_Strategy::remaining_activations (PortableServer::Servant servant)
00520 {
00521 ACE_UNUSED_ARG (servant);
00522
00523
00524 return 0;
00525 }
00526
00527
00528
00529 int
00530 TAO_Multiple_Id_Strategy::is_servant_in_map (PortableServer::Servant,
00531 int &)
00532 {
00533 return -1;
00534 }
00535
00536 int
00537 TAO_Multiple_Id_Strategy::bind_using_user_id (PortableServer::Servant servant,
00538 const PortableServer::ObjectId &user_id,
00539 CORBA::Short priority,
00540 TAO_Active_Object_Map_Entry *&entry)
00541 {
00542 int result = this->active_object_map_->user_id_map_->find (user_id,
00543 entry);
00544 if (result == 0)
00545 {
00546 if (servant != 0)
00547 entry->servant_ = servant;
00548 }
00549 else
00550 {
00551 ACE_NEW_RETURN (entry,
00552 TAO_Active_Object_Map_Entry,
00553 -1);
00554 entry->user_id_ = user_id;
00555 entry->servant_ = servant;
00556 entry->priority_ = priority;
00557
00558 result =
00559 this->active_object_map_->id_hint_strategy_->bind (*entry);
00560
00561 if (result == 0)
00562 {
00563 result = this->active_object_map_->user_id_map_->bind (entry->user_id_,
00564 entry);
00565 if (result != 0)
00566 {
00567 this->active_object_map_->id_hint_strategy_->unbind (*entry);
00568 delete entry;
00569 }
00570 }
00571 else
00572 delete entry;
00573 }
00574
00575 return result;
00576 }
00577
00578 int
00579 TAO_Multiple_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId &user_id)
00580 {
00581 TAO_Active_Object_Map_Entry *entry = 0;
00582 int result = this->active_object_map_->user_id_map_->unbind (user_id,
00583 entry);
00584 if (result == 0)
00585 {
00586 result = this->active_object_map_->id_hint_strategy_->unbind (*entry);
00587
00588 if (result == 0)
00589 delete entry;
00590 }
00591
00592 return result;
00593 }
00594
00595 int
00596 TAO_Multiple_Id_Strategy::find_user_id_using_servant (PortableServer::Servant servant,
00597 PortableServer::ObjectId_out user_id)
00598 {
00599 ACE_UNUSED_ARG (servant);
00600 ACE_UNUSED_ARG (user_id);
00601
00602 return -1;
00603 }
00604
00605 int
00606 TAO_Multiple_Id_Strategy::find_system_id_using_servant (PortableServer::Servant,
00607 PortableServer::ObjectId_out,
00608 CORBA::Short &)
00609 {
00610 return -1;
00611 }
00612
00613 CORBA::Boolean
00614 TAO_Multiple_Id_Strategy::remaining_activations (PortableServer::Servant servant)
00615 {
00616 TAO_Active_Object_Map::user_id_map::iterator end
00617 = this->active_object_map_->user_id_map_->end ();
00618
00619 for (TAO_Active_Object_Map::user_id_map::iterator iter
00620 = this->active_object_map_->user_id_map_->begin ();
00621 iter != end;
00622 ++iter)
00623 {
00624 TAO_Active_Object_Map::user_id_map::value_type map_pair = *iter;
00625 TAO_Active_Object_Map_Entry *entry = map_pair.second ();
00626
00627 if (entry->servant_ == servant)
00628 return 1;
00629 }
00630
00631 return 0;
00632 }
00633
00634 TAO_Lifespan_Strategy::~TAO_Lifespan_Strategy (void)
00635 {
00636 }
00637
00638 void
00639 TAO_Lifespan_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
00640 {
00641 this->active_object_map_ = active_object_map;
00642 }
00643
00644 int
00645 TAO_Transient_Strategy::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
00646 const PortableServer::ObjectId &user_id,
00647 PortableServer::Servant &servant,
00648 TAO_Active_Object_Map_Entry *&entry)
00649 {
00650 int result = this->active_object_map_->id_hint_strategy_->find (system_id,
00651 entry);
00652 if (result == 0)
00653 {
00654 if (entry->deactivated_)
00655 result = -1;
00656 else if (entry->servant_ == 0)
00657 result = -1;
00658 else
00659 servant = entry->servant_;
00660 }
00661 else
00662 {
00663 result = this->active_object_map_->user_id_map_->find (user_id,
00664 entry);
00665 if (result == 0)
00666 {
00667 if (entry->deactivated_)
00668 result = -1;
00669 else if (entry->servant_ == 0)
00670 result = -1;
00671 else
00672 servant = entry->servant_;
00673 }
00674 }
00675
00676 if (result == -1)
00677 entry = 0;
00678
00679 return result;
00680 }
00681
00682
00683
00684 int
00685 TAO_Persistent_Strategy::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
00686 const PortableServer::ObjectId &user_id,
00687 PortableServer::Servant &servant,
00688 TAO_Active_Object_Map_Entry *&entry)
00689 {
00690 int result = this->active_object_map_->id_hint_strategy_->find (system_id,
00691 entry);
00692 if (result == 0 &&
00693 user_id == entry->user_id_)
00694 {
00695 if (entry->deactivated_)
00696 result = -1;
00697 else if (entry->servant_ == 0)
00698 result = -1;
00699 else
00700 servant = entry->servant_;
00701 }
00702 else
00703 {
00704 result = this->active_object_map_->user_id_map_->find (user_id,
00705 entry);
00706 if (result == 0)
00707 {
00708 if (entry->deactivated_)
00709 result = -1;
00710 else if (entry->servant_ == 0)
00711 result = -1;
00712 else
00713 servant = entry->servant_;
00714 }
00715 }
00716
00717 if (result == -1)
00718 entry = 0;
00719
00720 return result;
00721 }
00722
00723 TAO_Id_Assignment_Strategy::~TAO_Id_Assignment_Strategy (void)
00724 {
00725 }
00726
00727 void
00728 TAO_Id_Assignment_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
00729 {
00730 this->active_object_map_ = active_object_map;
00731 }
00732
00733 int
00734 TAO_User_Id_Strategy::bind_using_system_id (PortableServer::Servant,
00735 CORBA::Short,
00736 TAO_Active_Object_Map_Entry *&)
00737 {
00738 return -1;
00739 }
00740
00741 int
00742 TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (PortableServer::Servant servant,
00743 CORBA::Short priority,
00744 TAO_Active_Object_Map_Entry *&entry)
00745 {
00746 ACE_NEW_RETURN (entry,
00747 TAO_Active_Object_Map_Entry,
00748 -1);
00749
00750 int result = this->active_object_map_->user_id_map_->bind_create_key (entry,
00751 entry->user_id_);
00752 if (result == 0)
00753 {
00754 entry->servant_ = servant;
00755 entry->priority_ = priority;
00756
00757 result = this->active_object_map_->id_hint_strategy_->bind (*entry);
00758
00759 if (result == 0)
00760 {
00761 if (servant != 0)
00762 result = this->active_object_map_->servant_map_->bind (entry->servant_,
00763 entry);
00764
00765 if (result != 0)
00766 {
00767 this->active_object_map_->user_id_map_->unbind (entry->user_id_);
00768 this->active_object_map_->id_hint_strategy_->unbind (*entry);
00769 delete entry;
00770 }
00771 }
00772 else
00773 {
00774 this->active_object_map_->user_id_map_->unbind (entry->user_id_);
00775 delete entry;
00776 }
00777 }
00778 else
00779 delete entry;
00780
00781 return result;
00782 }
00783
00784 int
00785 TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (PortableServer::Servant servant,
00786 CORBA::Short priority,
00787 TAO_Active_Object_Map_Entry *&entry)
00788 {
00789 ACE_NEW_RETURN (entry,
00790 TAO_Active_Object_Map_Entry,
00791 -1);
00792 int result = this->active_object_map_->user_id_map_->bind_create_key (entry,
00793 entry->user_id_);
00794 if (result == 0)
00795 {
00796 entry->servant_ = servant;
00797 entry->priority_ = priority;
00798
00799 result = this->active_object_map_->id_hint_strategy_->bind (*entry);
00800
00801 if (result != 0)
00802 {
00803 this->active_object_map_->user_id_map_->unbind (entry->user_id_);
00804 delete entry;
00805 }
00806 }
00807 else
00808 delete entry;
00809
00810 return result;
00811 }
00812
00813
00814
00815 TAO_Id_Hint_Strategy::~TAO_Id_Hint_Strategy (void)
00816 {
00817 }
00818
00819
00820
00821 TAO_Active_Hint_Strategy::TAO_Active_Hint_Strategy (CORBA::ULong map_size)
00822 : system_id_map_ (map_size)
00823 {
00824 }
00825
00826 TAO_Active_Hint_Strategy::~TAO_Active_Hint_Strategy (void)
00827 {
00828 }
00829
00830 int
00831 TAO_Active_Hint_Strategy::recover_key (const PortableServer::ObjectId &system_id,
00832 PortableServer::ObjectId &user_id)
00833 {
00834 return this->system_id_map_.recover_key (system_id,
00835 user_id);
00836 }
00837
00838 int
00839 TAO_Active_Hint_Strategy::bind (TAO_Active_Object_Map_Entry &entry)
00840 {
00841 entry.system_id_ = entry.user_id_;
00842
00843 return this->system_id_map_.bind_modify_key (&entry,
00844 entry.system_id_);
00845 }
00846
00847 int
00848 TAO_Active_Hint_Strategy::unbind (TAO_Active_Object_Map_Entry &entry)
00849 {
00850 return this->system_id_map_.unbind (entry.system_id_);
00851 }
00852
00853 int
00854 TAO_Active_Hint_Strategy::find (const PortableServer::ObjectId &system_id,
00855 TAO_Active_Object_Map_Entry *&entry)
00856 {
00857 return this->system_id_map_.find (system_id,
00858 entry);
00859 }
00860
00861 size_t
00862 TAO_Active_Hint_Strategy::hint_size (void)
00863 {
00864 return ACE_Active_Map_Manager_Key::size ();
00865 }
00866
00867 int
00868 TAO_Active_Hint_Strategy::system_id (PortableServer::ObjectId_out system_id,
00869 TAO_Active_Object_Map_Entry &entry)
00870 {
00871 ACE_NEW_RETURN (system_id,
00872 PortableServer::ObjectId (entry.system_id_),
00873 -1);
00874 return 0;
00875 }
00876
00877
00878
00879 TAO_No_Hint_Strategy::~TAO_No_Hint_Strategy (void)
00880 {
00881 }
00882
00883 int
00884 TAO_No_Hint_Strategy::recover_key (const PortableServer::ObjectId &system_id,
00885 PortableServer::ObjectId &user_id)
00886 {
00887
00888 user_id.replace (system_id.maximum (),
00889 system_id.length (),
00890 const_cast<CORBA::Octet *> (system_id.get_buffer ()),
00891 0);
00892
00893 return 0;
00894 }
00895
00896 int
00897 TAO_No_Hint_Strategy::bind (TAO_Active_Object_Map_Entry &entry)
00898 {
00899 ACE_UNUSED_ARG (entry);
00900
00901 return 0;
00902 }
00903
00904 int
00905 TAO_No_Hint_Strategy::unbind (TAO_Active_Object_Map_Entry &entry)
00906 {
00907 ACE_UNUSED_ARG (entry);
00908
00909 return 0;
00910 }
00911
00912 int
00913 TAO_No_Hint_Strategy::find (const PortableServer::ObjectId &system_id,
00914 TAO_Active_Object_Map_Entry *&entry)
00915 {
00916 ACE_UNUSED_ARG (system_id);
00917 ACE_UNUSED_ARG (entry);
00918
00919 return -1;
00920 }
00921
00922 size_t
00923 TAO_No_Hint_Strategy::hint_size (void)
00924 {
00925 return 0;
00926 }
00927
00928 int
00929 TAO_No_Hint_Strategy::system_id (PortableServer::ObjectId_out system_id,
00930 TAO_Active_Object_Map_Entry &entry)
00931 {
00932 ACE_NEW_RETURN (system_id,
00933 PortableServer::ObjectId (entry.user_id_),
00934 -1);
00935 return 0;
00936 }
00937
00938 TAO_END_VERSIONED_NAMESPACE_DECL