summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authordai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-24 21:52:20 +0000
committerdai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-24 21:52:20 +0000
commitcbe2326f7c3f74253e30bcc7b94d5d63430a3da1 (patch)
treeb9d0dc6c96aa6814d2e0947611506ab3bb52caa9 /TAO/tao
parenta4b0369e902b970f3c29d909a768aa675550e2e1 (diff)
downloadATCD-cbe2326f7c3f74253e30bcc7b94d5d63430a3da1.tar.gz
Fri Jul 24 21:48:40 UTC 2009 Yan Dai <dai_y@ociweb.com>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Invocation_Utils.h10
-rw-r--r--TAO/tao/ORB_Core.cpp37
-rw-r--r--TAO/tao/Stub.cpp1
-rw-r--r--TAO/tao/Stub.h8
-rw-r--r--TAO/tao/Stub.inl14
-rw-r--r--TAO/tao/Synch_Invocation.cpp50
-rw-r--r--TAO/tao/params.cpp2
-rw-r--r--TAO/tao/params.h9
-rw-r--r--TAO/tao/params.inl12
9 files changed, 127 insertions, 16 deletions
diff --git a/TAO/tao/Invocation_Utils.h b/TAO/tao/Invocation_Utils.h
index d719a87c7e1..f0593cf5eb6 100644
--- a/TAO/tao/Invocation_Utils.h
+++ b/TAO/tao/Invocation_Utils.h
@@ -70,6 +70,16 @@ namespace TAO
TAO_DII_DEFERRED_INVOCATION,
TAO_DII_ASYNCH_INVOCATION
};
+
+ enum Forward_Once_Exception
+ {
+ FOE_NON = 0x0,
+ FOE_OBJECT_NOT_EXIST = 0x1,
+ FOE_COMM_FAILURE = 0x2,
+ FOE_TRANSIENT = 0x4,
+ FOE_INV_OBJREF = 0x8,
+ FOE_ALL = 0xFFFFFFFF
+ };
}
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 658135a32b8..6cb8131f129 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1083,6 +1083,43 @@ TAO_ORB_Core::init (int &argc, char *argv[] )
arg_shifter.consume_arg ();
}
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBForwardOnceOnObjectNotExist"))))
+ {
+ int forward = ACE_OS::atoi (current_arg);
+ if (forward)
+ this->orb_params_.forward_once_exception (TAO::FOE_OBJECT_NOT_EXIST);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBForwardOnceOnCommFailure"))))
+ {
+ int forward = ACE_OS::atoi (current_arg);
+ if (forward)
+ this->orb_params_.forward_once_exception (TAO::FOE_COMM_FAILURE);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBForwardOnceOnTransient"))))
+ {
+ int forward = ACE_OS::atoi (current_arg);
+ if (forward)
+ this->orb_params_.forward_once_exception (TAO::FOE_TRANSIENT);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBForwardOnceOnInvObjref"))))
+ {
+ int forward = ACE_OS::atoi (current_arg);
+ if (forward)
+ this->orb_params_.forward_once_exception (TAO::FOE_INV_OBJREF);
+
+ arg_shifter.consume_arg ();
+ }
+
////////////////////////////////////////////////////////////////
// catch any unknown -ORB args //
////////////////////////////////////////////////////////////////
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
index 0b782775c4e..419ba5cb684 100644
--- a/TAO/tao/Stub.cpp
+++ b/TAO/tao/Stub.cpp
@@ -56,6 +56,7 @@ TAO_Stub::TAO_Stub (const char *repository_id,
, ior_info_ (0)
, forwarded_ior_info_ (0)
, collocation_opt_ (orb_core->optimize_collocation_objects ())
+ , forwarded_on_exception_ (false)
{
if (this->orb_core_.get() == 0)
{
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index 06cbc602e9f..66bb2ed25ce 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -262,6 +262,9 @@ public:
/// Needed to avoid copying forward_profiles for thread safety
CORBA::Boolean marshal (TAO_OutputCDR&);
+ void forwarded_on_exception (bool forwarded);
+ bool forwarded_on_exception () const;
+
protected:
/// Destructor is to be called only through _decr_refcnt() to
@@ -399,6 +402,11 @@ protected:
* stubs to be decoubled from ORB_Core. Please do not move it away.
*/
CORBA::Boolean const collocation_opt_;
+
+
+ // True if forwarding request upon some specific exceptions
+ // (e.g. OBJECT_NOT_EXIST) already happened.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, bool> forwarded_on_exception_;
};
// Define a TAO_Stub auto_ptr class.
diff --git a/TAO/tao/Stub.inl b/TAO/tao/Stub.inl
index cbf1ac1d2ac..a0ecaed898c 100644
--- a/TAO/tao/Stub.inl
+++ b/TAO/tao/Stub.inl
@@ -335,6 +335,19 @@ TAO_Stub::transport_queueing_strategy (void)
return 0;
}
+ACE_INLINE
+void TAO_Stub::forwarded_on_exception (bool forwarded)
+{
+ forwarded_on_exception_ = forwarded;
+}
+
+ACE_INLINE
+bool TAO_Stub::forwarded_on_exception () const
+{
+ return forwarded_on_exception_.value ();
+}
+
+
// ---------------------------------------------------------------
// Creator methods for TAO_Stub_Auto_Ptr (TAO_Stub Auto Pointer)
@@ -413,4 +426,5 @@ TAO_Stub_Auto_Ptr::operator *() const
return *this->get ();
}
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp
index a0fa1e08742..8d924308df7 100644
--- a/TAO/tao/Synch_Invocation.cpp
+++ b/TAO/tao/Synch_Invocation.cpp
@@ -543,22 +543,40 @@ namespace TAO
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
- // Special handling for non-fatal system exceptions.
- //
- // Note that we are careful to retain "at most once" semantics.
- if ((CORBA::CompletionStatus) completion != CORBA::COMPLETED_YES &&
- (ACE_OS_String::strcmp (type_id.in (),
- "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0 ||
- ACE_OS_String::strcmp (type_id.in (),
- "IDL:omg.org/CORBA/OBJ_ADAPTER:1.0") == 0 ||
- ACE_OS_String::strcmp (type_id.in (),
- "IDL:omg.org/CORBA/NO_RESPONSE:1.0") == 0 ||
- ACE_OS_String::strcmp (type_id.in (),
- "IDL:omg.org/CORBA/COMM_FAILURE:1.0") == 0 ||
- (this->stub ()->orb_core ()->orb_params ()->forward_invocation_on_object_not_exist()
- && ACE_OS_String::strcmp (type_id.in (),
- "IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0") == 0)))
- {
+ bool do_forward = false;
+ int foe_kind = this->stub ()->orb_core ()->orb_params ()->forward_once_exception();
+
+ if ((CORBA::CompletionStatus) completion != CORBA::COMPLETED_YES
+ && (((foe_kind & TAO::FOE_TRANSIENT) == 0
+ && ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0) ||
+ ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/OBJ_ADAPTER:1.0") == 0 ||
+ ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/NO_RESPONSE:1.0") == 0 ||
+ ((foe_kind & TAO::FOE_COMM_FAILURE) == 0
+ && ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/COMM_FAILURE:1.0") == 0) ||
+ (this->stub ()->orb_core ()->orb_params ()->forward_invocation_on_object_not_exist ()
+ && ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0") == 0) ||
+ (do_forward = ! this->stub ()->forwarded_on_exception ()
+ && ((((foe_kind & TAO::FOE_OBJECT_NOT_EXIST) == TAO::FOE_OBJECT_NOT_EXIST)
+ && (ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0") == 0)) ||
+ (((foe_kind & TAO::FOE_COMM_FAILURE) == TAO::FOE_COMM_FAILURE)
+ && (ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/COMM_FAILURE:1.0") == 0)) ||
+ (((foe_kind & TAO::FOE_TRANSIENT) == TAO::FOE_TRANSIENT)
+ && (ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0)) ||
+ (((foe_kind & TAO::FOE_INV_OBJREF) == TAO::FOE_INV_OBJREF)
+ && (ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/INV_OBJREF:1.0") == 0))))))
+ {
+ if (do_forward)
+ this->stub ()->forwarded_on_exception (true);
+
// Start the special case for FTCORBA.
/**
* There has been a unanimous view that this is not the
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
index 7008353587a..aa56422ed7a 100644
--- a/TAO/tao/params.cpp
+++ b/TAO/tao/params.cpp
@@ -9,6 +9,7 @@
#include "ace/OS_NS_Thread.h"
#include "ace/Service_Config.h"
+#include "tao/Invocation_Utils.h"
ACE_RCSID (tao,
params,
@@ -62,6 +63,7 @@ TAO_ORB_Parameters::TAO_ORB_Parameters (void)
"_make_TAO_Object_Adapter_Factory",
""))
, forward_invocation_on_object_not_exist_ (false)
+ , forward_once_exception_ (TAO::FOE_NON)
, collocation_resolver_name_ ("Default_Collocation_Resolver")
{
for (int i = 0; i != TAO_NO_OF_MCAST_SERVICES; ++i)
diff --git a/TAO/tao/params.h b/TAO/tao/params.h
index 636988d3763..e7af1a651e0 100644
--- a/TAO/tao/params.h
+++ b/TAO/tao/params.h
@@ -255,6 +255,9 @@ public:
void forward_invocation_on_object_not_exist (bool opt);
bool forward_invocation_on_object_not_exist (void) const;
+ void forward_once_exception (const int);
+ int forward_once_exception () const;
+
private:
// Each "endpoint" is of the form:
//
@@ -472,6 +475,12 @@ private:
*/
bool forward_invocation_on_object_not_exist_;
+
+ /**
+ * The exceptions upon which the requests will be forwarded once.
+ */
+ int forward_once_exception_;
+
/**
* Name of the collocation resolver that needs to be instantiated.
* The default value is "Default_Collocation_Resolver". If
diff --git a/TAO/tao/params.inl b/TAO/tao/params.inl
index 35bb921d258..d148ea835e3 100644
--- a/TAO/tao/params.inl
+++ b/TAO/tao/params.inl
@@ -364,5 +364,17 @@ TAO_ORB_Parameters::forward_invocation_on_object_not_exist (bool x)
this->forward_invocation_on_object_not_exist_ = x;
}
+ACE_INLINE int
+TAO_ORB_Parameters::forward_once_exception (void) const
+{
+ return this->forward_once_exception_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::forward_once_exception (const int ef)
+{
+ this->forward_once_exception_ |= ef;
+}
+
TAO_END_VERSIONED_NAMESPACE_DECL