summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-10-28 01:23:45 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-10-28 01:23:45 +0000
commitd056e28387e86cf0997c3124a6768f82b75bcf4a (patch)
tree5b0bad734ebce981cae873b22bd34be136db023d
parentc914129859068961ea72c1d63eb9046dd49187b5 (diff)
downloadATCD-refactor-stage_7.tar.gz
ChangeLogTag:Mon Oct 27 19:14:25 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>refactor-stage_7
-rw-r--r--TAO/ChangeLog_ref16
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp5
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp406
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h43
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp53
-rw-r--r--TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h8
-rw-r--r--TAO/tao/ORB_Core.cpp32
-rw-r--r--TAO/tao/ORB_Core.h26
-rw-r--r--TAO/tao/Service_Callbacks.cpp8
-rw-r--r--TAO/tao/Service_Callbacks.h20
11 files changed, 252 insertions, 368 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index 93e8f3898e7..66e1c46929a 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,19 @@
+Mon Oct 27 19:14:25 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp:
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h:
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp:
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h:
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp:
+ * orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h:
+ * tao/ORB_Core.cpp:
+ * tao/ORB_Core.h:
+ * tao/Service_Callbacks.cpp:
+ * tao/Service_Callbacks.h:
+
+ Fixed the FT to use the latest and greatest stuff in ORB core.
+
+
Mon Oct 27 17:55:59 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* tao/IORManipulation/IORC.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp
index 7b59f7d14c4..7bfe8de055c 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.cpp
@@ -19,8 +19,8 @@ TAO_FT_Endpoint_Selector_Factory::~TAO_FT_Endpoint_Selector_Factory (void)
TAO_Invocation_Endpoint_Selector *
-TAO_FT_Endpoint_Selector_Factory::get_selector (TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL)
+TAO_FT_Endpoint_Selector_Factory::get_selector (
+ ACE_ENV_SINGLE_ARG_DECL)
{
if (this->ft_endpoint_selector_ == 0)
{
@@ -37,6 +37,7 @@ TAO_FT_Endpoint_Selector_Factory::get_selector (TAO_GIOP_Invocation *
CORBA::NO_MEMORY ());
}
}
+
return this->ft_endpoint_selector_;
}
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h
index a1ba25f33c5..8d2af50731e 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Endpoint_Selector_Factory.h
@@ -52,8 +52,7 @@ public:
/// Get an Invocation's endpoint selection strategy and
/// initialize the endpoint selection state instance.
virtual TAO_Invocation_Endpoint_Selector *get_selector (
- TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL);
+ ACE_ENV_SINGLE_ARG_DECL);
private:
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp
index 367432d7337..d7c694f21a6 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp
@@ -2,12 +2,13 @@
#include "FT_Invocation_Endpoint_Selectors.h"
-#include "tao/Invocation.h"
+#include "tao/Profile_Transport_Resolver.h"
#include "tao/Stub.h"
#include "tao/Profile.h"
#include "tao/Endpoint.h"
#include "tao/Base_Transport_Property.h"
#include "tao/debug.h"
+#include "ace/Log_Msg.h"
#if !defined (__ACE_INLINE__)
#include "tao/Invocation_Endpoint_Selectors.i"
@@ -18,9 +19,7 @@ ACE_RCSID (FaultTolerance,
"$Id$")
TAO_FT_Invocation_Endpoint_Selector::TAO_FT_Invocation_Endpoint_Selector (void)
- : TAO_Default_Endpoint_Selector (),
- is_primary_alive_ (1),
- is_rewound_ (0)
+ : TAO_Default_Endpoint_Selector ()
{
}
@@ -30,278 +29,192 @@ TAO_FT_Invocation_Endpoint_Selector::~TAO_FT_Invocation_Endpoint_Selector (void)
void
TAO_FT_Invocation_Endpoint_Selector::select_endpoint (
- TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL)
+ TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL)
{
+ bool retval =
+ this->select_primary (r,
+ val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
- int retval = this->select_endpoint_i (invocation
- ACE_ENV_ARG_PARAMETER);
+ if (retval)
+ return;
+
+ retval =
+ this->select_secondary (r,
+ val
+ ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (retval == 0)
+ if (retval == false)
{
- if (TAO_debug_level > 6)
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) TAO-FT - Primary doesnt exist.",
- "Falling back on the default selection routines \n"));
-
- TAO_Default_Endpoint_Selector::select_endpoint (invocation
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
+ // If we get here, we completely failed to find an endpoint selector
+ // that we know how to use, so throw an exception.
+ ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
}
return;
}
-// @@ RTCORBA_Subsetting - next should be deprecated...
-void
-TAO_FT_Invocation_Endpoint_Selector::next (TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL_NOT_USED)
-{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This method is DEPRECATED!\n")));
- // if (invocation->stub_->next_profile_retry () == 0)
- // ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
- // CORBA::COMPLETED_NO));
-}
-
-void
-TAO_FT_Invocation_Endpoint_Selector::forward (TAO_GIOP_Invocation
- *invocation,
- const TAO_MProfile &mprofile
- ACE_ENV_ARG_DECL)
-{
- invocation->stub ()->add_forward_profiles (mprofile);
- // This has to be and is thread safe.
- // TAO_Stub::add_forward_profiles() already makes a copy of the
- // MProfile, so do not make a copy here.
-
-
- // We may not need to do this since TAO_GIOP_Invocations
- // get created on a per-call basis. For now we'll play it safe.
- if (invocation->stub ()->next_profile () == 0)
- ACE_THROW (CORBA::TRANSIENT (
- CORBA::SystemException::_tao_minor_code (
- TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
- errno),
- CORBA::COMPLETED_NO));
-}
-
-void
-TAO_FT_Invocation_Endpoint_Selector::success (TAO_GIOP_Invocation *invocation)
-{
- invocation->stub ()->set_valid_profile ();
-}
-
-void
-TAO_FT_Invocation_Endpoint_Selector::close_connection (TAO_GIOP_Invocation *invocation)
-{
- // Get rid of any forwarding profiles and reset
- // the profile list to point to the first profile!
- // FRED For now we will not deal with recursive forwards!
- invocation->stub ()->reset_profiles ();
-}
-
-
-int
-TAO_FT_Invocation_Endpoint_Selector::select_endpoint_i(
- TAO_GIOP_Invocation *invocation
+bool
+TAO_FT_Invocation_Endpoint_Selector::select_primary (
+ TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *max_wait_time
ACE_ENV_ARG_DECL)
{
- int retval =
- this->select_primary (invocation
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
+ // Grab the forwarded list
+ TAO_MProfile *prof_list =
+ ACE_const_cast (TAO_MProfile *,
+ r->stub ()->forward_profiles ());
+ TAO_MProfile &basep = r->stub ()->base_profiles ();
- // We havent got any information on the primary ie. we dont have a
- // primary in the profile at all or we have a primary selected. We
- // return now.
- if (retval == 0 || retval == 1)
- return retval;
+ if (prof_list ==0)
+ prof_list = &basep;
- // Ok, to the tricky portion. Primary is dead.
- if (TAO_debug_level > 2)
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) The primary is dead,"
- " selecting a secondary \n"));
-
- // @@ todo: We could hold & release the locks a couple of times
- // here. We need to look into this after 1.2.1 for better
- // performance.
- if (this->is_rewound_ == 0)
- {
- // .. grab the lock
- ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
- guard,
- *(invocation->stub ()->profile_lock ()),
- 0));
-
- // DOUBLE checked optimization pattern
- if (this->is_rewound_ == 0)
- {
- // Reset the profile list
- invocation->stub ()->reset_profiles_i ();
+ if (prof_list == 0)
+ return false;
- // Set the flag
- this->is_rewound_ = 1;
- }
- }
+ // Did not succeed. Try to look for primaries all over the place
+ CORBA::ULong sz =
+ prof_list->size ();
- do
+ // Iterate through the list in a circular fashion. Stop one before
+ // the list instead of trying the same thing again.
+ for (CORBA::ULong i = 0;
+ i != sz;
+ ++i)
{
- IOP::TaggedComponent tagged_component;
- tagged_component.tag = IOP::TAG_FT_PRIMARY;
-
- // Get the tagged component from the profile
- TAO_Tagged_Components &pfile_tagged =
- invocation->stub ()->profile_in_use ()->tagged_components ();
+ TAO_Profile *tmp = prof_list->get_profile (i);
- // If it is a primary just skip to the next profile. We know
- // that the primary has failed anyway..
- if (pfile_tagged.get_component (tagged_component) != 1)
- {
- invocation->profile (invocation->stub ()->profile_in_use ());
- invocation->endpoint (invocation->profile ()->endpoint ());
-
- int status =
- this->endpoint_from_profile (invocation
+ bool retval =
+ this->check_profile_for_primary (tmp
ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
+ ACE_CHECK_RETURN (false);
- if (status == 1)
- return 1;
+ // Choose a non-primary
+ if (retval == true && tmp != 0)
+ {
+ retval =
+ this->try_connect (r,
+ tmp,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (retval == true)
+ return true;
}
}
- while (invocation->stub ()->next_profile_retry () != 0);
- // If we get here, we completely failed to find an endpoint selector
- // that we know how to use, so throw an exception.
- ACE_THROW_RETURN (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
- CORBA::COMPLETED_NO),
- 0);
+ return false;
}
-int
-TAO_FT_Invocation_Endpoint_Selector::select_primary (
- TAO_GIOP_Invocation *invoc
+bool
+TAO_FT_Invocation_Endpoint_Selector::select_secondary (
+ TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *max_wait_time
ACE_ENV_ARG_DECL)
{
- // Get the current profile
- TAO_Profile *temp_profile = 0;
+ // Grab the forwarded list
+ TAO_MProfile *prof_list =
+ ACE_const_cast (TAO_MProfile *,
+ r->stub ()->forward_profiles ());
- // Get the forwarded profile if it exists
- if (invoc->stub ()->forward_profiles ())
- {
- TAO_MProfile *tmp =
- ACE_const_cast (TAO_MProfile *,
- invoc->stub ()->forward_profiles ());
- temp_profile =
- tmp->get_current_profile ();
- }
- else
- {
- temp_profile =
- invoc->stub ()->base_profiles ().get_current_profile ();
- }
+ TAO_MProfile &basep =
+ r->stub ()->base_profiles ();
- int retval = 0;
+ if (prof_list ==0)
+ prof_list = &basep;
- if (temp_profile)
- {
- // Check whether we have a primary profile in hand.
- retval =
- this->check_profile_for_primary (invoc,
- temp_profile
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
- }
- else
- return 0;
+ if (prof_list == 0)
+ return false;
- // If we have a primary just return
- if (retval == 1)
- return retval;
+ CORBA::ULong sz =
+ prof_list->size ();
- // If we have detected a failure
- if (retval == -1)
+ for (CORBA::ULong i = 0;
+ i != sz;
+ ++i)
{
- // .. grab the lock
- ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
- guard,
- *invoc->stub ()->profile_lock (),
- 0));
+ TAO_Profile *tmp =
+ prof_list->get_profile (i);
- // set the primary flag to be dead..
- this->is_primary_alive_ = 0;
+ bool retval =
+ this->check_profile_for_primary (tmp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
- // .. and return
- return retval;
+ // Choose a non-primary
+ if (retval == false && tmp != 0)
+ {
+ retval =
+ this->try_connect (r,
+ tmp,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (retval == true)
+ return true;
+ }
}
+ return false;
+}
- // Doing the above helps us to avoid a lock for every
- // invocation. The funda is this. Try to select the first profile in
- // the list of profiles. If it is a primary, life is just great from
- // there. If not, hold a lock and go through the list to pick
- // one. The second invocation would just use that profile as the
- // starting point. Theoretically we should have just one lock if the
- // primary is hidden somewhere else.
-
- // If we know that the primary is dead return a -1, to choose a
- // secondary.
- if (this->is_primary_alive_ == 0)
- return -1;
+bool
+TAO_FT_Invocation_Endpoint_Selector::try_connect (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Profile *profile,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+{
+ r->profile (profile);
- // Now grab the lock
- ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
- guard,
- *invoc->stub ()->profile_lock (),
- 0));
+ size_t endpoint_count =
+ r->profile ()->endpoint_count ();
- temp_profile =
- invoc->stub ()->base_profiles ().get_next ();
+ TAO_Endpoint *ep =
+ r->profile ()->endpoint ();
- // While the profile is not null
- while (temp_profile)
+ for (size_t i = 0; i < endpoint_count; ++i)
{
- // Check whether we have a primary profile in hand.
- retval =
- this->check_profile_for_primary (invoc,
- temp_profile
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
+ TAO_Base_Transport_Property desc (ep);
+
+ bool retval =
+ r->try_connect (&desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // @@ Good place to handle timeouts.. We can omit timeouts and
+ // go ahead looking for other things... There are some small
+ // issues that needs ironed out first in the invocation
+ // classes.
- if (retval == 1 || retval == -1)
- return retval;
+ // Check if the connect has completed.
+ if (retval)
+ return true;
- temp_profile =
- invoc->stub ()->base_profiles ().get_next ();
+ // Go to the next endpoint in this profile.
+ ep = ep->next ();
}
- // Return failure. We havent found any
- // @@ Here is where another issue kicks in. Do we flag this
- // condition as an error. May be not. Probably the client
- // ORB that is FT compliant, has received an IOR from a
- // non-compliant ORB. We cannot think this of an error. Rather we
- // need to fall back on the default methodology. That would mean
- // that we return 0 and allow the ORB to do the rest.
- return 0;
-
- // @@ All said and done, what if we receive an IOGR from a
- // FT-compliant ORB with no primaries?
- // Ans: The default usage of the profile in the list
- // as the start point would NOT be a mistake. We should
- // get a LOCATION_FORWARD or some such thing to get to
- // the primary finally.
+ return false;
}
-
-int
+bool
TAO_FT_Invocation_Endpoint_Selector::check_profile_for_primary (
- TAO_GIOP_Invocation *invocation,
- TAO_Profile*pfile
- ACE_ENV_ARG_DECL)
+ TAO_Profile *pfile
+ ACE_ENV_ARG_DECL_NOT_USED)
{
+ if (pfile == 0)
+ return false;
+
IOP::TaggedComponent tagged_component;
tagged_component.tag = IOP::TAG_FT_PRIMARY;
@@ -310,43 +223,14 @@ TAO_FT_Invocation_Endpoint_Selector::check_profile_for_primary (
pfile->tagged_components ();
// Search for the TaggedComponent that we want
- if (pfile_tagged.get_component (tagged_component) == 1)
- {
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) TAO-FT - Got a primary component \n"));
- }
-
- invocation->profile (pfile);
- invocation->endpoint (invocation->profile ()->endpoint ());
-
- int status =
- this->endpoint_from_profile (invocation
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (status == 1)
- {
- if (TAO_debug_level > 4)
- ACE_DEBUG ((LM_DEBUG,
- "(P|%t) TAO-FT - Got a valid primary \n"));
-
- return 1;
- }
- else
- {
- if (TAO_debug_level > 2)
- ACE_ERROR ((LM_ERROR,
- "(P|%t) TAO-FT - We have a primary profile,"
- " but it is unreachable \n"));
- return -1;
- }
+ if (pfile_tagged.get_component (tagged_component) != 1)
+ return false;
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) TAO-FT - Got a primary component \n"));
}
- if (TAO_debug_level > 2)
- ACE_DEBUG ((LM_DEBUG,
- "(P|%t) TAO-FT - Not a primary profile \n"));
- return 0;
+ return true;
}
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h
index 660b40c44a9..9d6032ae498 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.h
@@ -57,36 +57,35 @@ public:
/// Implementation for FT. Please refer to
/// $TAO_ROOT/tao/Invocation_Endpoint_Selectors.h for details of
/// documentation.
- virtual void select_endpoint (TAO_GIOP_Invocation *invocation
+ virtual void select_endpoint (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
ACE_ENV_ARG_DECL);
- virtual void next (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
- virtual void forward (TAO_GIOP_Invocation *invocation,
- const TAO_MProfile &mprofile
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
- virtual void success (TAO_GIOP_Invocation *invocation);
- virtual void close_connection (TAO_GIOP_Invocation *invocation);
-
protected:
-
- int select_endpoint_i (TAO_GIOP_Invocation *invoc
+ /// Select the primary and try connecting to it.
+ bool select_primary (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL);
+
+ /// Select the secondary and try connecting to it. Returns true if
+ /// successfull.
+ bool select_secondary (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
ACE_ENV_ARG_DECL);
- int select_primary (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-
- int check_profile_for_primary (TAO_GIOP_Invocation *,
- TAO_Profile *
- ACE_ENV_ARG_DECL);
+ /// Helper method that tries to establish connections with all the
+ /// endpoints in the profile.
+ bool try_connect (TAO::Profile_Transport_Resolver *r,
+ TAO_Profile *profile,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL);
-private:
+ /// Helper method that checks whether the profile is a primary or
+ /// not.
+ bool check_profile_for_primary (TAO_Profile *
+ ACE_ENV_ARG_DECL);
- /// Is the primary alive? The default is yes.
- CORBA::Boolean is_primary_alive_;
- /// Has the profile list been rewound
- CORBA::Boolean is_rewound_;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp
index 5b2e26b9058..8acf84b15eb 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp
@@ -7,11 +7,10 @@
#include "tao/Profile.h"
#include "tao/Tagged_Components.h"
#include "tao/Stub.h"
-
-#include "tao/Invocation.h"
+#include "tao/Invocation_Utils.h"
#include "tao/ORB_Core.h"
#include "tao/Client_Strategy_Factory.h"
-#include <iostream>
+
#if !defined (__ACE_INLINE__)
# include "FT_Service_Callbacks.i"
@@ -171,32 +170,19 @@ TAO_FT_Service_Callbacks::hash_ft (TAO_Profile *p,
return group_component.object_group_id % max;
}
-int
+TAO::Invocation_Status
TAO_FT_Service_Callbacks::raise_comm_failure (
- TAO_GIOP_Invocation *invoke,
+ IOP::ServiceContextList &context_list,
TAO_Profile *profile
ACE_ENV_ARG_DECL)
{
- if (this->restart_policy_check (
- invoke->request_service_context ().service_info (),
- profile))
- {
- TAO_GIOP_Twoway_Invocation *invoc =
- ACE_dynamic_cast (TAO_GIOP_Twoway_Invocation *,
- invoke);
-
- if (invoc)
- {
- // Reset the states to start invocation on a different
- // target
- invoc->reset_states ();
- }
- return TAO_INVOKE_RESTART;
- }
+ if (this->restart_policy_check (context_list,
+ profile))
+ return TAO::TAO_INVOKE_RESTART;
// As the right tags are not found close the connection and throw an
// exception
- invoke->close_connection ();
+ // invoke->close_connection ();
ACE_THROW_RETURN (CORBA::COMM_FAILURE (
CORBA::SystemException::_tao_minor_code (
TAO_INVOCATION_RECV_REQUEST_MINOR_CODE,
@@ -205,28 +191,15 @@ TAO_FT_Service_Callbacks::raise_comm_failure (
TAO_INVOKE_EXCEPTION);
}
-int
+TAO::Invocation_Status
TAO_FT_Service_Callbacks::raise_transient_failure (
- TAO_GIOP_Invocation *invoke,
+ IOP::ServiceContextList &service,
TAO_Profile *profile
ACE_ENV_ARG_DECL)
{
- if (restart_policy_check (
- invoke->request_service_context ().service_info (),
- profile))
- {
- TAO_GIOP_Twoway_Invocation *invoc =
- ACE_dynamic_cast (TAO_GIOP_Twoway_Invocation *,
- invoke);
-
- if (invoc)
- {
- // Reset the states to start invocation on a different
- // target
- invoc->reset_states ();
- }
- return TAO_INVOKE_RESTART;
- }
+ if (this->restart_policy_check (service,
+ profile))
+ return TAO::TAO_INVOKE_RESTART;
// As the right tags are not found close the connection and throw an
// exception
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h
index c6fea69b413..4ff267ddfcc 100644
--- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h
+++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h
@@ -58,15 +58,15 @@ public:
/// Check whether we need to raise an exception or go for a
/// reinvocaton.
- virtual int raise_comm_failure (
- TAO_GIOP_Invocation *invoke,
+ virtual TAO::Invocation_Status raise_comm_failure (
+ IOP::ServiceContextList &clist,
TAO_Profile *profile
ACE_ENV_ARG_DECL);
/// Check whether we need to raise an exception or go for a
/// reinvocaton.
- virtual int raise_transient_failure (
- TAO_GIOP_Invocation *invoke,
+ virtual TAO::Invocation_Status raise_transient_failure (
+ IOP::ServiceContextList &clist,
TAO_Profile *profile
ACE_ENV_ARG_DECL);
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 840b69d116d..c416a4adae8 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1387,22 +1387,20 @@ TAO_ORB_Core::services_callbacks_init (void)
// @@ Other service callbacks can be added here
}
-#if 0
-int
-TAO_ORB_Core::service_raise_comm_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL)
+TAO::Invocation_Status
+TAO_ORB_Core::service_raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL)
{
if (this->ft_service_.service_callback ())
{
return this->ft_service_.service_callback ()->
- raise_comm_failure (invoke,
+ raise_comm_failure (clist,
profile
ACE_ENV_ARG_PARAMETER);
}
- invoke->close_connection ();
-
ACE_THROW_RETURN (CORBA::COMM_FAILURE (
CORBA::SystemException::_tao_minor_code (
TAO_INVOCATION_RECV_REQUEST_MINOR_CODE,
@@ -1412,17 +1410,18 @@ TAO_ORB_Core::service_raise_comm_failure (TAO_GIOP_Invocation *invoke,
}
-int
-TAO_ORB_Core::service_raise_transient_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL)
+TAO::Invocation_Status
+TAO_ORB_Core::service_raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL)
{
if (this->ft_service_.service_callback ())
{
- return this->ft_service_.service_callback ()->
- raise_transient_failure (invoke,
- profile
- ACE_ENV_ARG_PARAMETER);
+ return
+ this->ft_service_.service_callback ()->raise_transient_failure (clist,
+ profile
+ ACE_ENV_ARG_PARAMETER);
}
ACE_THROW_RETURN (CORBA::TRANSIENT (
@@ -1433,7 +1432,6 @@ TAO_ORB_Core::service_raise_transient_failure (TAO_GIOP_Invocation *invoke,
TAO_INVOKE_EXCEPTION);
}
-#endif /*if 0*/
void
TAO_ORB_Core::service_context_list (
TAO_Stub *stub,
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index 3bffac628cb..c9843f50fe2 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -36,6 +36,7 @@
#include "tao/ObjectKey_Table.h"
#include "tao/Messaging_SyncScopeC.h"
#include "tao/Object.h"
+#include "tao/Invocation_Utils.h"
#if TAO_HAS_INTERCEPTORS == 1
# include "Interceptor_List.h"
@@ -45,6 +46,7 @@
#include "ace/Thread_Manager.h"
#include "ace/Lock_Adapter_T.h"
+
// Forward declarations
class TAO_Acceptor;
class TAO_Connector;
@@ -114,6 +116,11 @@ namespace CORBA
class PolicyList;
}
+namespace IOP
+{
+ class ServiceContextList;
+}
+
namespace PortableInterceptor
{
class IORInterceptor;
@@ -865,24 +872,23 @@ public:
/// Return a reference to the Fault Tolerant service object.
TAO_Fault_Tolerance_Service &fault_tolerance_service (void);
-#if 0
/// Raise a comm failure exception if a service is not loaded, else
/// delegate to the service to see what the service has to do for
/// this case.
- int service_raise_comm_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL);
-
-
+ TAO::Invocation_Status service_raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
/// Raise a transient failure exception if a service is not loaded,
/// else delegate to the service to see what the service has to do
/// for this case.
- int service_raise_transient_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL);
+ TAO::Invocation_Status service_raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
+
//@}
-#endif /*if 0*/
/**
* @name Portable Interceptor Related Methods
diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp
index 31d53afbf6a..c902dac7363 100644
--- a/TAO/tao/Service_Callbacks.cpp
+++ b/TAO/tao/Service_Callbacks.cpp
@@ -59,9 +59,9 @@ TAO_Service_Callbacks::hash_ft (TAO_Profile *,
return 0;
}
-int
+TAO::Invocation_Status
TAO_Service_Callbacks::raise_comm_failure (
- TAO_GIOP_Invocation * /*invoke*/,
+ IOP::ServiceContextList &,
TAO_Profile * /*profile*/
ACE_ENV_ARG_DECL)
{
@@ -73,9 +73,9 @@ TAO_Service_Callbacks::raise_comm_failure (
2);
}
-int
+TAO::Invocation_Status
TAO_Service_Callbacks::raise_transient_failure (
- TAO_GIOP_Invocation * /*invoke*/,
+ IOP::ServiceContextList &,
TAO_Profile * /*profile*/
ACE_ENV_ARG_DECL)
{
diff --git a/TAO/tao/Service_Callbacks.h b/TAO/tao/Service_Callbacks.h
index 9720e758aee..767fbbff4a9 100644
--- a/TAO/tao/Service_Callbacks.h
+++ b/TAO/tao/Service_Callbacks.h
@@ -25,6 +25,7 @@
#include "tao/TAO_Export.h"
#include "tao/Basic_Types.h"
+#include "tao/Invocation_Utils.h"
class TAO_Profile;
class TAO_MProfile;
@@ -41,6 +42,11 @@ namespace CORBA
class Environment;
}
+namespace IOP
+{
+ class ServiceContextList;
+}
+
/**
* @class TAO_Service_Callbacks
*
@@ -86,15 +92,17 @@ public:
/// Allow the service layer to decide whether the COMM_FAILURE
/// exception should be thrown or a reinvocation is needed
- virtual int raise_comm_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL);
+ virtual TAO::Invocation_Status raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
/// Allow the service layer to decide whether the TRANSIENT
/// exception should be thrown or a reinvocation is needed
- virtual int raise_transient_failure (TAO_GIOP_Invocation *invoke,
- TAO_Profile *profile
- ACE_ENV_ARG_DECL);
+ virtual TAO::Invocation_Status raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
};
#if defined (__ACE_INLINE__)