summaryrefslogtreecommitdiff
path: root/TAO/tao/Stub.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/Stub.cpp')
-rw-r--r--TAO/tao/Stub.cpp180
1 files changed, 92 insertions, 88 deletions
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
index ccb6164dd08..dfc7e67b32c 100644
--- a/TAO/tao/Stub.cpp
+++ b/TAO/tao/Stub.cpp
@@ -61,7 +61,7 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_TAO_Stub_Timeprobe_Description,
#endif /* ACE_ENABLE_TIMEPROBES */
TAO_Stub::TAO_Stub (char *repository_id,
- const TAO_MProfile &profiles,
+ TAO_MProfile &profiles,
TAO_ORB_Core* orb_core)
: type_id (repository_id),
base_profiles_ ((CORBA::ULong) 0),
@@ -92,9 +92,86 @@ TAO_Stub::TAO_Stub (char *repository_id,
this->profile_lock_ptr_ =
this->orb_core_->client_factory ()->create_iiop_profile_lock ();
+ this->set_base_profiles (&profiles);
+}
+
+TAO_Stub::TAO_Stub (char *repository_id,
+ TAO_MProfile *profiles,
+ TAO_ORB_Core* orb_core)
+ : type_id (repository_id),
+ base_profiles_ ((CORBA::ULong) 0),
+ forward_profiles_ (0),
+ profile_in_use_ (0),
+ profile_lock_ptr_ (0),
+ profile_success_ (0),
+ // what about ACE_SYNCH_MUTEX refcount_lock_
+ refcount_ (1),
+ use_locate_request_ (0),
+ first_locate_request_ (0),
+ orb_core_ (orb_core)
+{
+ if (this->orb_core_ == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO: (%P|%t) TAO_Stub created with default "
+ "ORB core\n"));
+ }
+ this->orb_core_ = TAO_ORB_Core_instance ();
+ }
+
+ // @@ does this need to be freed?
+ this->profile_lock_ptr_ =
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
+
this->set_base_profiles (profiles);
}
+#if 0
+TAO_Stub::TAO_Stub (char *repository_id,
+ TAO_Profile *profile)
+ : type_id (repository_id),
+ base_profiles_ ((CORBA::ULong) 0),
+ forward_profiles_ (0),
+ profile_in_use_ (0),
+ profile_lock_ptr_ (0),
+ profile_success_ (0),
+ // what about ACE_SYNCH_MUTEX refcount_lock_
+ refcount_ (1),
+ use_locate_request_ (0),
+ first_locate_request_ (0)
+{
+ // @@ XXX need to verify type and deal with wrong types
+
+ this->profile_lock_ptr_ =
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
+
+ base_profiles_.set (1);
+
+ base_profiles_.give_profile (profile);
+
+ reset_base ();
+
+}
+
+TAO_Stub::TAO_Stub (char *repository_id)
+ : type_id (repository_id),
+ base_profiles_ ((CORBA::ULong) 0),
+ forward_profiles_ (0),
+ profile_in_use_ (0),
+ profile_lock_ptr_ (0),
+ profile_success_ (0),
+ // what about ACE_SYNCH_MUTEX refcount_lock_
+ refcount_ (1),
+ use_locate_request_ (0),
+ first_locate_request_ (0)
+{
+ this->profile_lock_ptr_ =
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
+}
+#endif /* 0 */
+
// Quick'n'dirty hash of objref data, for partitioning objrefs into
// sets.
//
@@ -104,7 +181,7 @@ TAO_Stub::TAO_Stub (char *repository_id,
// can get different values, depending on the profile_in_use!!
CORBA::ULong
TAO_Stub::hash (CORBA::ULong max,
- CORBA::Environment &env)
+ CORBA::Environment &env)
{
// we rely on the profile object to has it's address info
if (profile_in_use_)
@@ -121,7 +198,7 @@ TAO_Stub::hash (CORBA::ULong max,
// @@ Two object references are the same if any two profiles are the same!
CORBA::Boolean
TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj,
- CORBA::Environment &env)
+ CORBA::Environment &env)
{
if (CORBA::is_nil (other_obj) == 1)
return 0;
@@ -559,22 +636,6 @@ TAO_Stub::do_dynamic_call (const char *opname,
// that contained this parameter, The
// application should use the appropriate >>=
// operator to retrieve the value
-
- char *begin = call.inp_stream ().rd_ptr ();
- CORBA::Any *any = result->value ();
- CORBA::TypeCode::traverse_status retval =
- call.inp_stream ().skip (any->type_,
- ACE_TRY_ENV);
- ACE_CHECK;
-
- if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
- {
- char *end = call.inp_stream ().rd_ptr ();
- any->cdr_ = new ACE_Message_Block (begin,
- end - begin);
- any->cdr_->wr_ptr (end - begin);
- }
-#if 0
char *begin, *end;
TAO_InputCDR temp (call.inp_stream ());
CORBA::TypeCode::traverse_status retval;
@@ -588,20 +649,19 @@ TAO_Stub::do_dynamic_call (const char *opname,
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
end = temp.rd_ptr ();
- any->cdr_ = new ACE_Message_Block (begin, end - begin);
- any->cdr_->wr_ptr (end - begin);
+ any->cdr_ = new ACE_Message_Block (end - begin);
TAO_OutputCDR out (any->cdr_);
+
retval = out.append (any->type_,
&call.inp_stream (), ACE_TRY_ENV);
ACE_CHECK;
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
+ any->any_owns_data_ = 1;
any->value_ = 0;
- any->any_owns_data_ = 0;
}
}
-#endif
}
else
{
@@ -672,8 +732,8 @@ TAO_Stub::do_dynamic_call (const char *opname,
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
+ any->any_owns_data_ = 1;
any->value_ = 0;
- any->any_owns_data_ = 0;
}
}
}
@@ -758,7 +818,6 @@ TAO_Stub::put_params (TAO_GIOP_Invocation &call,
// ****************************************************************
#if defined (TAO_HAS_CORBA_MESSAGING)
-
CORBA::Policy_ptr
TAO_Stub::get_policy (
CORBA::PolicyType type,
@@ -792,9 +851,13 @@ TAO_Stub::get_client_policy (
if (CORBA::is_nil (result.in ()))
{
- TAO_Policy_Current &policy_current = this->orb_core_->policy_current ();
- result = policy_current.get_policy (type, ACE_TRY_ENV);
- ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ TAO_Policy_Current *policy_current =
+ this->orb_core_->policy_current ();
+ if (policy_current != 0)
+ {
+ result = policy_current->get_policy (type, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
}
if (CORBA::is_nil (result.in ()))
@@ -817,38 +880,6 @@ TAO_Stub::get_client_policy (
return result._retn ();
}
-POA_Messaging::RelativeRoundtripTimeoutPolicy*
-TAO_Stub::relative_roundtrip_timeout (void)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard,
- this->refcount_lock_,
- 0);
-
- POA_Messaging::RelativeRoundtripTimeoutPolicy* result = 0;
- if (this->policies_ != 0)
- result = this->policies_->relative_roundtrip_timeout ();
-
- if (result == 0)
- {
- TAO_Policy_Current &policy_current =
- this->orb_core_->policy_current ();
- result = policy_current.relative_roundtrip_timeout ();
- }
-
- if (result == 0)
- {
- TAO_Policy_Manager *policy_manager =
- this->orb_core_->policy_manager ();
- if (policy_manager != 0)
- result = policy_manager->relative_roundtrip_timeout ();
- }
-
- if (result == 0)
- result = this->orb_core_->default_relative_roundtrip_timeout ();
-
- return result;
-}
-
TAO_Stub*
TAO_Stub::set_policy_overrides (
const CORBA::PolicyList & policies,
@@ -883,7 +914,7 @@ TAO_Stub::set_policy_overrides (
TAO_Stub* stub;
ACE_NEW_RETURN (stub, TAO_Stub (CORBA::string_dup (this->type_id.in ()),
- this->base_profiles_,
+ this->get_profiles (),
this->orb_core_),
0);
stub->policies_ = policy_manager.release ();
@@ -911,33 +942,6 @@ TAO_Stub::validate_connection (
return 0;
}
-void
-TAO_Stub::add_forward_profiles (const TAO_MProfile &mprofiles)
-{
- // we assume that the profile_in_use_ is being
- // forwarded! Grab the lock so things don't change.
- ACE_MT (ACE_GUARD (ACE_Lock,
- guard,
- *this->profile_lock_ptr_));
-
- TAO_MProfile *now_pfiles = this->forward_profiles_;
- if (now_pfiles == 0)
- now_pfiles = &this->base_profiles_;
-
- ACE_NEW (this->forward_profiles_,
- TAO_MProfile (mprofiles));
-
- // forwarded profile points to the new IOR (profiles)
- this->profile_in_use_->forward_to (this->forward_profiles_);
-
- // new profile list points back to the list which was forwarded.
- this->forward_profiles_->forward_from (now_pfiles);
-
- // make sure we start at the beginning of mprofiles
- this->forward_profiles_->rewind ();
-}
-
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class auto_ptr<TAO_Policy_Manager_Impl>;