summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-03-26 20:39:28 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-03-26 20:39:28 +0000
commit522861b8f33b47d01459aae398282aee71aeef00 (patch)
treeedbce118d950078549ea19fa20fe44b352b35555
parent03ef1583127d1e97b5db26a7aac4c14a47c3ee4e (diff)
downloadATCD-post_132_phase_3.tar.gz
ChangeLogTag: Mon Mar 24 18:15:51 2003 Jeff Parsons <j.parsons@vanderbilt.edu>post_132_phase_3
-rw-r--r--TAO/tao/ChangeLog16
-rw-r--r--TAO/tao/ORB_Core.cpp76
-rw-r--r--TAO/tao/ORB_Core.h15
-rw-r--r--TAO/tao/Object.cpp19
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp157
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.h7
6 files changed, 138 insertions, 152 deletions
diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog
index b6af167f84e..a17dfbb5f4c 100644
--- a/TAO/tao/ChangeLog
+++ b/TAO/tao/ChangeLog
@@ -1,3 +1,19 @@
+Wed Mar 26 14:32:40 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
+
+ * tao/ORB_Core.h:
+ * tao/ORB_Core.cpp: Removed methods initialize_collocated_object
+ () and create_collocated_object (). Added a new method
+ is_collocation_enabled () which abstracts the common code in the
+ above two methods.
+
+ * tao/Object.cpp: Cosmetic fixes!
+
+ * tao/PortableServer/Object_Adapter.cpp:
+ * tao/PortableServer/Object_Adapter.h: Added a new method
+ get_collocated_servant (), which houses the common code in
+ create_collocated_object () and initialize_collocated_object
+ ().
+
Tue Mar 25 18:16:05 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
* tao/Profile.cpp: Missed a definition of a constructor during the
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 407d1d89af2..510bfbad1fd 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1612,12 +1612,16 @@ TAO_ORB_Core::create_object (TAO_Stub *stub)
++i)
{
TAO_ORB_Core *other_core = (*i).int_id_;
- CORBA::Object_ptr x =
- this->create_collocated_object (stub,
- other_core,
- mprofile);
- if (x != 0)
- return x;
+
+ if (this->is_collocation_enabled (other_core,
+ mprofile))
+ {
+ TAO_Adapter_Registry *ar =
+ other_core->adapter_registry ();
+
+ return ar->create_collocated_object (stub,
+ mprofile);
+ }
}
}
@@ -1637,6 +1641,10 @@ CORBA::Long
TAO_ORB_Core::initialize_object (TAO_Stub *stub,
CORBA::Object_ptr obj)
{
+ // @@ What about forwarding. With this approach we are never forwarded
+ // when we use collocation!
+ const TAO_MProfile &mprofile =
+ stub->base_profiles ();
{
// @@ Ossama: maybe we need another lock for the table, to
// reduce contention on the Static_Object_Lock below, if so
@@ -1652,22 +1660,25 @@ TAO_ORB_Core::initialize_object (TAO_Stub *stub,
++i)
{
TAO_ORB_Core *other_core = (*i).int_id_;
- CORBA::Long retval =
- this->initialize_collocated_object (stub,
- other_core,
- obj);
- if (retval != -1)
- return 1;
+
+ if (this->is_collocation_enabled (other_core,
+ mprofile))
+ {
+ TAO_Adapter_Registry *ar =
+ other_core->adapter_registry ();
+
+ return ar->initialize_collocated_object (stub,
+ obj);
+ }
}
}
return 0;
}
-CORBA::Object_ptr
-TAO_ORB_Core::create_collocated_object (TAO_Stub *stub,
- TAO_ORB_Core *orb_core,
- const TAO_MProfile &mprofile)
+CORBA::Boolean
+TAO_ORB_Core::is_collocation_enabled (TAO_ORB_Core *orb_core,
+ const TAO_MProfile &mp)
{
if (!orb_core->optimize_collocation_objects ())
return 0;
@@ -1675,39 +1686,10 @@ TAO_ORB_Core::create_collocated_object (TAO_Stub *stub,
if (!orb_core->use_global_collocation () && orb_core != this)
return 0;
- if (!orb_core->is_collocated (mprofile))
+ if (!orb_core->is_collocated (mp))
return 0;
- // OK, the target ORB and the mprofile match, use the Adapter
- // Registry of each ORB to find the right one.
-
- return orb_core->adapter_registry ()->create_collocated_object (stub,
- mprofile);
-}
-
-
-CORBA::Long
-TAO_ORB_Core::initialize_collocated_object (TAO_Stub *stub,
- TAO_ORB_Core *orb_core,
- CORBA::Object_ptr obj)
-{
- // @@ What about forwarding. With this approach we are never forwarded
- // when we use collocation!
- const TAO_MProfile &mprofile = stub->base_profiles ();
-
- if (!orb_core->optimize_collocation_objects ())
- return -1;
-
- if (!orb_core->use_global_collocation () && orb_core != this)
- return -1;
-
- if (!orb_core->is_collocated (mprofile))
- return -1;
-
- // OK, the target ORB and the mprofile match, use the Adapter
- // Registry of each ORB to find the right one.
- return orb_core->adapter_registry ()->initialize_collocated_object (stub,
- obj);
+ return 1;
}
int
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index a1bcfc7e8e4..2e5e69b979d 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -1013,17 +1013,10 @@ private:
/// Obtain and cache the dynamic any factory object reference.
void resolve_ior_table_i (ACE_ENV_SINGLE_ARG_DECL);
- /// Try to create a new collocated object, using <other_orb> as the
- /// target ORB. If not possible return 0.
- CORBA::Object_ptr create_collocated_object (TAO_Stub *the_stub,
- TAO_ORB_Core *other_orb,
- const TAO_MProfile &mprofile);
-
- /// Try to initialize a new collocated object, using <other_orb> as the
- /// target ORB. If not possible return -1.
- CORBA::Long initialize_collocated_object (TAO_Stub *the_stub,
- TAO_ORB_Core *other_orb,
- CORBA::Object_ptr obj);
+ /// Checks to see whether collocation optimizations have to be
+ /// applied on objects in the <other_orb>
+ CORBA::Boolean is_collocation_enabled (TAO_ORB_Core *other_orb,
+ const TAO_MProfile &mp);
protected:
/// Synchronize internal state...
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
index 243ee1facf1..f525e8b152b 100644
--- a/TAO/tao/Object.cpp
+++ b/TAO/tao/Object.cpp
@@ -88,8 +88,6 @@ CORBA::Object::Object (IOP::IOR *ior,
{
this->refcount_lock_ =
this->orb_core_->resource_factory ()->create_corba_object_lock ();
-
-
}
// Too lazy to do this check in every method properly! This is useful
@@ -105,7 +103,8 @@ if (!this->is_evaluated_) \
if (!this->is_evaluated_) \
{ \
ACE_GUARD_RETURN (ACE_Lock , mon, *this->refcount_lock_, 0); \
- CORBA::Object::tao_object_initialize (this); \
+ if (!this->is_evaluated_) \
+ CORBA::Object::tao_object_initialize (this); \
}
void
@@ -669,11 +668,6 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::Object* x)
/*static*/ void
CORBA::Object::tao_object_initialize (CORBA::Object *obj)
{
- // Check if already evaluated..
- if (obj->is_evaluated_)
- return;
-
-
CORBA::ULong profile_count =
obj->ior_->profiles.length ();
@@ -767,11 +761,10 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
TAO_Stub_Auto_Ptr safe_objdata (objdata);
- // No hope. What happens if this fails or returns an error? No
- // chance to initialize the object again. Just give up. We will throw
- // an exception when someone tries to access something..
- (void) orb_core->initialize_object (safe_objdata.get (),
- obj);
+ if (orb_core->initialize_object (safe_objdata.get (),
+ obj) == -1)
+ return;
+
obj->protocol_proxy_ = objdata;
// If the object is collocated then set the broker using the
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index b62c6461c7e..a2efd1724fd 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -799,60 +799,34 @@ CORBA::Object_ptr
TAO_Object_Adapter::create_collocated_object (TAO_Stub *stub,
const TAO_MProfile &mp)
{
- for (TAO_PHandle j = 0;
- j != mp.profile_count ();
- ++j)
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
{
- const TAO_Profile *profile = mp.get_profile (j);
- TAO::ObjectKey_var objkey = profile->_key ();
-
- if (ACE_OS::memcmp (objkey->get_buffer (),
- &TAO_POA::objectkey_prefix[0],
- TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
- continue;
-
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- TAO_ServantBase *servant = 0;
-
- TAO_SERVANT_LOCATION servant_location =
- this->find_servant (objkey.in (),
- servant
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ TAO_ServantBase *sb =
+ this->get_collocated_servant (stub,
+ mp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
- if (servant_location != TAO_SERVANT_NOT_FOUND)
- {
- // Found collocated object. Perhaps we can get around
- // by simply setting the servant_orb, but let get this
- // to work first.
-
- // There could only be one ORB which is us.
-
- // @@ Do not duplicate the ORB here!
- // TAO_Stub::servant_orb() duplicates it.
- // -Ossama
- stub->servant_orb (this->orb_core_.orb ());
-
- CORBA::Object_ptr x;
- ACE_NEW_RETURN (x,
- CORBA::Object (stub,
- 1,
- servant),
- CORBA::Object::_nil ());
-
- // Here we set the strategized Proxy Broker.
- x->_proxy_broker (the_tao_strategized_object_proxy_broker ());
- return x;
- }
- }
- ACE_CATCHANY
+ if (sb)
{
- // Ignore the exception and continue with the next one.
+ CORBA::Object_ptr x;
+ ACE_NEW_RETURN (x,
+ CORBA::Object (stub,
+ 1,
+ sb),
+ CORBA::Object::_nil ());
+
+ // Here we set the strategized Proxy Broker.
+ x->_proxy_broker (the_tao_strategized_object_proxy_broker ());
+ return x;
}
- ACE_ENDTRY;
}
+ ACE_CATCHANY
+ {
+ // Ignore the exception and continue with the next one.
+ }
+ ACE_ENDTRY;
return 0;
}
@@ -866,6 +840,40 @@ TAO_Object_Adapter::initialize_collocated_object (TAO_Stub *stub,
const TAO_MProfile &mp =
stub->base_profiles ();
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ TAO_ServantBase *sb =
+ this->get_collocated_servant (stub,
+ mp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (sb)
+ {
+ obj->set_collocated_servant (sb);
+
+ // Here we set the strategized Proxy Broker.
+ obj->_proxy_broker (the_tao_strategized_object_proxy_broker ());
+
+ return 0;
+ }
+ }
+ ACE_CATCHANY
+ {
+ // Ignore exceptions..
+ }
+ ACE_ENDTRY;
+
+ return -1;
+}
+
+TAO_ServantBase *
+TAO_Object_Adapter::get_collocated_servant (TAO_Stub *stub,
+ const TAO_MProfile &mp
+ ACE_ENV_ARG_DECL)
+{
for (TAO_PHandle j = 0;
j != mp.profile_count ();
++j)
@@ -878,48 +886,35 @@ TAO_Object_Adapter::initialize_collocated_object (TAO_Stub *stub,
TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
continue;
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- TAO_ServantBase *servant = 0;
-
- TAO_SERVANT_LOCATION servant_location =
- this->find_servant (objkey.in (),
- servant
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (servant_location != TAO_SERVANT_NOT_FOUND)
- {
- // Found collocated object. Perhaps we can get around
- // by simply setting the servant_orb, but let get this
- // to work first.
+ TAO_ServantBase *servant = 0;
- // There could only be one ORB which is us.
+ TAO_SERVANT_LOCATION servant_location =
+ this->find_servant (objkey.in (),
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
- // @@ Do not duplicate the ORB here!
- // TAO_Stub::servant_orb() duplicates it.
- // -Ossama
- stub->servant_orb (this->orb_core_.orb ());
+ if (servant_location != TAO_SERVANT_NOT_FOUND)
+ {
+ // Found collocated object. Perhaps we can get around
+ // by simply setting the servant_orb, but let get this
+ // to work first.
- obj->set_collocated_servant (servant);
+ // There could only be one ORB which is us.
- // Here we set the strategized Proxy Broker.
- obj->_proxy_broker (the_tao_strategized_object_proxy_broker ());
+ // @@ Do not duplicate the ORB here!
+ // TAO_Stub::servant_orb() duplicates it.
+ // -Ossama
+ stub->servant_orb (this->orb_core_.orb ());
- return 1;
- }
- }
- ACE_CATCHANY
- {
- // Ignore the exception and continue with the next one.
+ return servant;
}
- ACE_ENDTRY;
- }
+ }
return 0;
}
+
// ****************************************************************
TAO_Object_Adapter_Factory::TAO_Object_Adapter_Factory (void)
diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h
index b8e057b341d..3835584d3e8 100644
--- a/TAO/tao/PortableServer/Object_Adapter.h
+++ b/TAO/tao/PortableServer/Object_Adapter.h
@@ -829,6 +829,13 @@ public:
private:
+ /// Helper method to get collocated servant
+ TAO_ServantBase *get_collocated_servant (TAO_Stub *stub,
+ const TAO_MProfile &mp
+ ACE_ENV_ARG_DECL);
+
+private:
+
/// Condition variable for waiting on non-servant upcalls to end.
TAO_SYNCH_CONDITION non_servant_upcall_condition_;