summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-23 07:06:47 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-23 07:06:47 +0000
commit44a53cc6daca4f8b97b48802b11be327b66c8a5f (patch)
tree0d3471b4787ee9d1363089fbf29e1140bc47382a
parentc3cfca88bd47d120efd6ae382d6f36c4c7acdb4a (diff)
downloadATCD-44a53cc6daca4f8b97b48802b11be327b66c8a5f.tar.gz
ChangeLogTag:Fri Jul 23 02:02:21 1999 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--TAO/tao/ORB.cpp81
1 files changed, 46 insertions, 35 deletions
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index bf063986f94..ece9aeca6a6 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -1015,7 +1015,10 @@ CORBA_ORB::key_to_object (const TAO_ObjectKey &key,
ACE_CHECK_RETURN (CORBA::Object::_nil ());
// Create the CORBA level proxy
- CORBA_Object *new_obj = new CORBA_Object (data, servant, collocated);
+ CORBA_Object *new_obj =
+ this->orb_core_->optimize_collocation_objects () ?
+ new_obj = new CORBA_Object (data, servant, collocated) :
+ new CORBA_Object (data, 0, 0);
// Clean up in case of errors.
if (CORBA::is_nil (new_obj))
@@ -1682,48 +1685,56 @@ TAO_SERVANT_LOCATION
CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj,
TAO_ServantBase *&servant)
{
- if (sobj == 0 || !this->_optimize_collocation_objects ())
+ if (sobj == 0)
return TAO_SERVANT_NOT_FOUND;
// @@ What about forwarding. Which this approach we are never forwarded
// when we use collocation!
-
const TAO_MProfile &mprofile = sobj->get_base_profiles ();
- if (this->orb_core_->use_global_collocation ())
+ // We always look for collocation in ourselves first if we support
+ // collocation optimization since single ORB is the most common use
+ // case.
+ if (this->_optimize_collocation_objects ())
{
- // @@ Ossama: maybe we need another lock for the table, to
- // reduce contention on the Static_Object_Lock below, if so
- // then we need to use that lock in the ORB_init() function.
-
- ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard,
- *ACE_Static_Object_Lock::instance (), TAO_SERVANT_NOT_FOUND));
-
- TAO_ORB_Table *table = TAO_ORB_Table::instance ();
- TAO_ORB_Table::Iterator end = table->end ();
- for (TAO_ORB_Table::Iterator i = table->begin ();
- i != end;
- ++i)
- {
- TAO_SERVANT_LOCATION servant_location =
- this->_find_collocated_servant (sobj,
- (*i).int_id_,
- servant,
- mprofile);
- if (servant_location != TAO_SERVANT_NOT_FOUND)
- return servant_location;
- }
-
- // If we don't find one by this point, we return 0.
- return TAO_SERVANT_NOT_FOUND;
- }
- else
- {
- return this->_find_collocated_servant (sobj,
- this->orb_core_,
- servant,
- mprofile);
+ TAO_SERVANT_LOCATION servant_location =
+ this->_find_collocated_servant (sobj,
+ this->orb_core_,
+ servant,
+ mprofile);
+ if (servant_location != TAO_SERVANT_NOT_FOUND)
+ return servant_location;
}
+
+ {
+ // @@ Ossama: maybe we need another lock for the table, to
+ // reduce contention on the Static_Object_Lock below, if so
+ // then we need to use that lock in the ORB_init() function.
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard,
+ *ACE_Static_Object_Lock::instance (), TAO_SERVANT_NOT_FOUND));
+
+ TAO_ORB_Table *table = TAO_ORB_Table::instance ();
+ TAO_ORB_Table::Iterator end = table->end ();
+ for (TAO_ORB_Table::Iterator i = table->begin ();
+ i != end;
+ ++i)
+ {
+ // Skip ourselve. This should never happen if this ORB doesn't use
+ // collocation optimization.
+ if ((*i).int_id_ == this->orb_core_)
+ continue;
+
+ TAO_SERVANT_LOCATION servant_location =
+ this->_find_collocated_servant (sobj,
+ (*i).int_id_,
+ servant,
+ mprofile);
+ if (servant_location != TAO_SERVANT_NOT_FOUND)
+ return servant_location;
+ }
+ }
+ // If we don't find one by this point, we return 0.
+ return TAO_SERVANT_NOT_FOUND;
}
TAO_SERVANT_LOCATION