summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-03-19 21:30:03 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-03-19 21:30:03 +0000
commit1af945a97442437d2afa397ee3c3090dac47752e (patch)
tree5118ae828e435f2f80ea4fa1857516e8fdb585e7
parent4f822f3847517e0b15804ec72ef9bbc895915138 (diff)
downloadATCD-1af945a97442437d2afa397ee3c3090dac47752e.tar.gz
ChangeLogTag: Sat Feb 22 09:50:31 2003 Ossama Othman <ossama@uci.edu>
-rw-r--r--TAO/tao/ChangeLog39
-rw-r--r--TAO/tao/Connector_Registry.cpp158
-rw-r--r--TAO/tao/ORB_Core.cpp14
-rw-r--r--TAO/tao/Object.cpp70
-rw-r--r--TAO/tao/Object.h6
-rw-r--r--TAO/tao/Object.i8
6 files changed, 101 insertions, 194 deletions
diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog
index 4af708c3cb2..b7f20531e91 100644
--- a/TAO/tao/ChangeLog
+++ b/TAO/tao/ChangeLog
@@ -1,3 +1,42 @@
+Wed Mar 19 14:30:43 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
+
+ * tao/Connector_Registry.cpp: Removed preconnect () completely
+ from the code.
+
+ * tao/ORB_Core.cpp: Implemented the initialize_object () for
+ non-local and non-collocated cases.
+
+ * tao/Object.h:
+ * tao/Object.cpp (Object):
+ * tao/Object.i: Made the following changes
+
+ - Changed the constructor that took a const IOP::IOR_var to take
+ a pointer to IOP::IOR. The pointer would be owned by
+ CORBA::Object class and released at the end of its
+ lifetime. It may be possible for us to release the memory
+ owned by IOR_var if needed after the complete evaluation is
+ done. At this point of time it is future work.
+
+ - Added a new method is_evaluated () which returns the status of
+ the evaluation done on the IOR.
+
+ - Added a non-const version of _stubobj ().
+
+ - In the main constructor we set the ORB_Core if it is null
+ before calling the resource factory to create the refcount
+ lock.
+
+ - In the method is_nil_i () we now use the ORB_Core to access
+ new definitions instead of going through the stub object. This
+ would prevent accidental evaluation of IOR while calling
+ is_nil () from the stubs or skeletons.
+
+ - Completed implementation of tao_object_initialize () for
+ non-local and non-collocated objects.
+
+ With this checkin the Hello test and IORsize test work fine.
+
+
Fri Mar 7 13:29:43 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
* tao/Object.cpp:
diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp
index 4c4d2aaaa50..9a767d2f7fe 100644
--- a/TAO/tao/Connector_Registry.cpp
+++ b/TAO/tao/Connector_Registry.cpp
@@ -280,161 +280,3 @@ TAO_Connector_Registry::object_key_delimiter (const char *ior)
// against the provided string.
return 0;
}
-
-
-#if 0
-
-/*
- * To be removed..
- *
- * These methods are not needed since they have been deprecated. But
- * just having them in the bottom of the file to be removed later.
- *
- */
-int
-TAO_Connector_Registry::preconnect (TAO_ORB_Core *orb_core,
- TAO_EndpointSet &preconnections)
-{
- // Put the preconnects in a form that makes it simple for protocol
- // implementers to parse.
- if (this->preprocess_preconnects (orb_core, preconnections) != 0)
- {
- if (TAO_debug_level > 0)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("TAO (%P|%t) Unable to preprocess the preconnections.\n")));
-
- return -1;
- }
-
- TAO_EndpointSetIterator preconnects = preconnections.begin ();
-
- for (ACE_CString *i = 0;
- preconnects.next (i) != 0;
- preconnects.advance ())
- {
- TAO_ConnectorSetIterator first_connector = this->begin ();
- TAO_ConnectorSetIterator last_connector = this->end ();
-
- for (TAO_ConnectorSetIterator connector = first_connector;
- connector != last_connector;
- ++connector)
- if (*connector)
- (*connector)->preconnect (i->c_str ());
- }
-
- // No longer need the preconnect set since all associated
- // preconnections have been opened by now. Reclaim the memory used
- // by the preconnect set.
- preconnections.reset ();
-
- return 0; // Success
-}
-
-int
-TAO_Connector_Registry::preprocess_preconnects (TAO_ORB_Core *orb_core,
- TAO_EndpointSet &preconnects)
-{
- // Organize all matching protocol endpoints and addrs into a single
- // endpoint for the given protocol.
- //
- // For example, the following endpoints:
- //
- // uiop://1.1@/tmp/foobar,/tmp/chicken
- // iiop://1.0@localhost
- // uiop:///tmp/soup
- // iiop://1.1@mopbucket
- //
- // will be merged to create the following preconnects:
- //
- // uiop://1.1@/tmp/foobar,/tmp/chicken,/tmp/soup
- // iiop://1.0@localhost,1.1@mopbucket
- //
- // The four elements in the preconnect set will be squeezed into two
- // elements, in this case. This is done to simplify the preconnect
- // parsing code in each protocol specific connector and to make sure
- // that all preconnections are established during the first
- // attempt. Otherwise, secondary attempts to establish
- // preconnections will not be successful since all preconnections
- // will have been idled after during the first attempt, hence the
- // need to pass all preconnects during the first attempt.
-
- const size_t num_protocols =
- orb_core->protocol_factories ()->size ();
-
- ACE_CString *processed = 0;
-
- ACE_NEW_RETURN (processed,
- ACE_CString[num_protocols],
- -1);
-
- // Open one connector for each loaded protocol!
- TAO_ProtocolFactorySetItor begin =
- orb_core->protocol_factories ()->begin ();
- TAO_ProtocolFactorySetItor end =
- orb_core->protocol_factories ()->end ();
-
- ACE_CString *tmp = processed;
-
- // Iterate over the protocols, *not* the connectors!
- for (TAO_ProtocolFactorySetItor factory = begin;
- factory != end;
- ++factory, ++tmp)
- {
- (*tmp) =
- ACE_CString ((*factory)->factory ()->prefix ()) + ACE_CString ("://");
-
- TAO_EndpointSetIterator p = preconnects.begin ();
-
- for (ACE_CString *i = 0;
- p.next (i) != 0;
- p.advance ())
- {
- const int slot = i->find ("://");
-
- ACE_CString protocol_name = i->substring (0, slot);
-
- if (slot != ACE_CString::npos &&
- (slot != ACE_static_cast (int, i->length ()) - 3) &&
- (*factory)->factory ()->match_prefix (protocol_name.c_str ()))
- {
- (*tmp) += i->substring (slot + 3); // +3 due to "://"
- (*tmp) += ACE_CString (',');
- }
- }
-
- // Remove the trailing comma ','.
- if ((*tmp)[tmp->length () - 1] == ',')
- (*tmp) = tmp->substring (0, tmp->length () - 1);
- }
-
- // Empty the preconnect container.
- preconnects.reset ();
-
- // Now enqueue the re-formed preconnect strings.
- for (size_t n = 0; n < num_protocols; ++n)
- {
- // If no preconnects for the given protocol exist then don't
- // enqueue the empty preconnect list for that protocol.
- // Such an empty preconnect string should be of the form
- //
- // protocol://
- //
- // so check for the forward slash '/' at the end of the string.
- if (processed[n][processed[n].length () - 1] != '/')
- {
- if (preconnects.enqueue_tail (processed[n]) != 0)
- {
- delete [] processed;
-
- return -1;
- }
- }
- }
-
- delete [] processed;
-
- return 0;
-}
-
-// End of the portion that needs to be removed.
-#endif /*If 0 */
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 30040267f43..e2d7ce698db 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1646,7 +1646,6 @@ CORBA::Long
TAO_ORB_Core::initialize_object (TAO_Stub *stub,
CORBA::Object_ptr obj)
{
- /*
{
// @@ Ossama: maybe we need another lock for the table, to
// reduce contention on the Static_Object_Lock below, if so
@@ -1667,21 +1666,10 @@ TAO_ORB_Core::initialize_object (TAO_Stub *stub,
other_core,
obj);
if (retval != -1)
- return retval;
+ return 1;
}
}
- // @@ We should thow CORBA::NO_MEMORY in platforms with exceptions,
- // but we are stuck in platforms without exceptions!
- CORBA::Object_ptr x;
-
- // The constructor sets the proxy broker as the
- // Remote one.
- ACE_NEW_RETURN (x,
- CORBA::Object (stub, 0),
- 0);
- return x;
- */
return 0;
}
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
index 17186358e47..dbd41548a5b 100644
--- a/TAO/tao/Object.cpp
+++ b/TAO/tao/Object.cpp
@@ -56,8 +56,11 @@ CORBA::Object::Object (TAO_Stub * protocol_proxy,
/// requirement.
ACE_ASSERT (this->protocol_proxy_ != 0);
+ if (this->orb_core_ == 0)
+ this->orb_core_ = this->protocol_proxy_->orb_core ();
+
this->refcount_lock_ =
- this->protocol_proxy_->orb_core ()->resource_factory ()->create_corba_object_lock ();
+ this->orb_core_->resource_factory ()->create_corba_object_lock ();
// If the object is collocated then set the broker using the
// factory otherwise use the remote proxy broker.
@@ -68,7 +71,7 @@ CORBA::Object::Object (TAO_Stub * protocol_proxy,
this->proxy_broker_ = the_tao_remote_object_proxy_broker ();
}
-CORBA::Object::Object (const IOP::IOR_var &ior,
+CORBA::Object::Object (IOP::IOR *ior,
TAO_ORB_Core *orb_core)
: is_collocated_ (0)
, servant_ (0)
@@ -219,6 +222,13 @@ CORBA::Object::_is_local (void) const
return this->is_local_;
}
+TAO_Stub *
+CORBA::Object::_stubobj (void)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ return this->protocol_proxy_;
+}
+
CORBA::ULong
CORBA::Object::_hash (CORBA::ULong maximum
ACE_ENV_ARG_DECL)
@@ -320,9 +330,9 @@ CORBA::Boolean
CORBA::Object::is_nil_i (CORBA::Object_ptr obj)
{
// To accomodate new definitions.
- if (obj->_stubobj ())
+ if (obj->orb_core_)
{
- return obj->_stubobj ()->orb_core ()->object_is_nil (obj);
+ return obj->orb_core_->object_is_nil (obj);
}
return 0;
@@ -667,7 +677,7 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
obj->ior_->profiles.length ();
// Assumption is that after calling this method, folks should test
- // for protocol_procy_ or whatever to make sure that things have
+ // for protocol_proxy_ or whatever to make sure that things have
// been initialized!
if (profile_count == 0)
return;
@@ -689,6 +699,7 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
}
TAO_Stub *objdata = 0;
+
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
@@ -698,8 +709,25 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
for (CORBA::ULong i = 0; i != profile_count; ++i)
{
- TAO_Profile *pfile = 0;
- //connector_registry->create_profile (obj->ior_->profiles.);
+ IOP::TaggedProfile &tpfile =
+ obj->ior_->profiles[i];
+
+ // NOTE: This is a place for optimizations. Here we have an
+ // 2 allocations and 2 copies. Future optimizations should
+ // target this place.
+ TAO_OutputCDR o_cdr;
+
+ o_cdr << tpfile;
+
+ TAO_InputCDR cdr (o_cdr,
+ orb_core->input_cdr_buffer_allocator (),
+ orb_core->input_cdr_dblock_allocator (),
+ orb_core->input_cdr_msgblock_allocator (),
+ orb_core);
+
+ TAO_Profile *pfile =
+ connector_registry->create_profile (cdr);
+
if (pfile != 0)
mp.give_profile (pfile);
}
@@ -710,18 +738,18 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
// @@ This occurs when profile creation fails when decoding the
// profile from the IOR.
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("TAO (%P|%t) ERROR: Could not create all ")
+ ACE_LIB_TEXT ("TAO (%P|%t) ERROR: XXXXX Could not create all ")
ACE_LIB_TEXT ("profiles while extracting object\n")
ACE_LIB_TEXT ("TAO (%P|%t) ERROR: reference from the ")
ACE_LIB_TEXT ("CDR stream.\n")));
}
- /* objdata =
- orb_core->create_stub (type_hint.in (),
+ objdata =
+ orb_core->create_stub (obj->ior_->type_id.in (),
mp
ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK; */
+ ACE_TRY_CHECK;
}
ACE_CATCHANY
{
@@ -741,14 +769,13 @@ CORBA::Object::tao_object_initialize (CORBA::Object *obj)
int retval =
orb_core->initialize_object (safe_objdata.get (),
obj);
- if (retval == -1)
- return;
-
- obj->protocol_proxy_ = objdata;
+ if (retval == 0)
+ obj->protocol_proxy_ = objdata;
// Transfer ownership to the CORBA::Object
(void) safe_objdata.release ();
+ obj->is_evaluated_ = 1;
return;
}
@@ -773,7 +800,6 @@ operator>> (TAO_InputCDR& cdr, CORBA::Object*& x)
if (orb_core->resource_factory ()->resource_usage_strategy () ==
TAO_Resource_Factory::TAO_LAZY)
lazy_strategy = 1;
- cout << "Amba here " << endl;
}
if (!lazy_strategy)
@@ -874,15 +900,15 @@ operator>> (TAO_InputCDR& cdr, CORBA::Object*& x)
else
{
// Lazy strategy!
- IOP::IOR ior;
+ IOP::IOR *ior = 0;
- cdr >> ior;
-
- // Maken IOR_var that can be use to initialize the CORBA::Object
- IOP::IOR_var ior_var (&ior);
+ ACE_NEW_RETURN (ior,
+ IOP::IOR (),
+ 0);
+ cdr >> *ior;
ACE_NEW_RETURN (x,
- CORBA::Object (ior_var,
+ CORBA::Object (ior,
orb_core),
0);
}
diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h
index cc8976bc93e..ab8ae2e4ade 100644
--- a/TAO/tao/Object.h
+++ b/TAO/tao/Object.h
@@ -239,11 +239,12 @@ namespace CORBA
TAO_Abstract_ServantBase *servant = 0,
TAO_ORB_Core *orb_core = 0);
- Object (const IOP::IOR_var &ior,
+ Object (IOP::IOR *ior,
TAO_ORB_Core *orb_core = 0);
/// Get the underlying stub object.
virtual TAO_Stub *_stubobj (void) const;
+ virtual TAO_Stub *_stubobj (void);
/// Set the proxy broker.
virtual void _proxy_broker (TAO_Object_Proxy_Broker *proxy_broker);
@@ -251,6 +252,9 @@ namespace CORBA
/// Get the proxy broker.
virtual TAO_Object_Proxy_Broker *_proxy_broker (void);
+ /// Accessor to the flag..
+ CORBA::Boolean is_evaluated (void) const;
+
protected:
/// Initializing a local object.
diff --git a/TAO/tao/Object.i b/TAO/tao/Object.i
index 3deb41590d7..f8c5034f84f 100644
--- a/TAO/tao/Object.i
+++ b/TAO/tao/Object.i
@@ -90,6 +90,14 @@ CORBA::Object::_stubobj (void) const
return this->protocol_proxy_;
}
+
+
+ACE_INLINE CORBA::Boolean
+CORBA::Object::is_evaluated (void) const
+{
+ return this->is_evaluated_;
+}
+
// *************************************************************
// Inline operations for class CORBA::Object_var
// *************************************************************