diff options
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 27 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 50 | ||||
-rw-r--r-- | TAO/tao/Invocation.h | 21 | ||||
-rw-r--r-- | TAO/tao/Invocation.i | 9 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 46 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 18 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 2 | ||||
-rw-r--r-- | TAO/tao/Service_Callbacks.cpp | 30 | ||||
-rw-r--r-- | TAO/tao/Service_Callbacks.h | 14 | ||||
-rw-r--r-- | TAO/tao/Wait_On_Leader_Follower.cpp | 2 |
10 files changed, 178 insertions, 41 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 428f0231314..94b0cbecff6 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,30 @@ +Mon Oct 2 10:58:55 2000 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/Wait_On_Leader_Follower.cpp (connection_closed): Fixed a + typo that was a source of a bug. The reply_received value was + being set to -11 when that should have been set to -1. This was + not generating the right exceptions when the client's transport + detected that the server was shutdown. + + * tao/Invocation.cpp: + * tao/Invocation.h: + * tao/Invocation.i: Added hooks for transparent reinvocation for + FT CORBA. Transparent reinvocation happens only if certain + policies are set and if the FT library is loaded. Also added a + flag restart_flag_ to the Invocation classes. This flag is set + to true in the generated code whenever the Invocation classes + return TAO_INVOKE_RESTART. + + * tao/ORB_Core.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.i: Implementation of the hooks for the transparent + reinvocation. + + * tao/Service_Callbacks.h: + * tao/Service_Callbacks.cpp: Added calls to call in to the + services to return the right exception to the Invocation + classes. + Mon Oct 2 07:38:59 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> * performance-tests/RTCorba/Oneways/Reliable: Added new Borland C++ diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index 96bd944c99f..561032d74c1 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -90,7 +90,9 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (TAO_Stub *stub, transport_ (0), profile_ (0), endpoint_ (0), - max_wait_time_ (0) + max_wait_time_ (0), + ior_info_ (), + restart_flag_ (0) { } @@ -452,6 +454,7 @@ TAO_GIOP_Invocation::prepare_header (CORBA::Octet response_flags, // add to the service context lists this->orb_core_->service_context_list (this->stub_, this->service_info (), + this->restart_flag_, ACE_TRY_ENV); // The target specification mode @@ -1021,15 +1024,12 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV) TAO_INVOKE_EXCEPTION); } - this->close_connection (); - - // @@ BALA here is a place for FT REINVOCATION hooks - ACE_THROW_RETURN (CORBA::COMM_FAILURE ( - CORBA_SystemException::_tao_minor_code ( - TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, - errno), - CORBA::COMPLETED_MAYBE), - TAO_INVOKE_EXCEPTION); + // Call the ORB Core which would check whether we need to really + // raise an exception or are we going to base our decision on the + // loaded services. + return this->orb_core_->service_raise_comm_failure (this, + this->profile_, + ACE_TRY_ENV); } // @@ Alex: the old version of this had some error handling code, @@ -1273,14 +1273,9 @@ TAO_GIOP_Oneway_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) TAO_INVOKE_EXCEPTION); } - this->close_connection (); - // @@ BALA here is a place for FT REINVOCATION hooks - ACE_THROW_RETURN (CORBA::COMM_FAILURE ( - CORBA_SystemException::_tao_minor_code ( - TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, - errno), - CORBA::COMPLETED_MAYBE), - TAO_INVOKE_EXCEPTION); + return this->orb_core_->service_raise_comm_failure (this, + this->profile_, + ACE_TRY_ENV); } CORBA::ULong reply_status = rd.reply_status (); @@ -1473,13 +1468,10 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) // should decide? Remember that LocateRequests are part of // the strategy to establish a connection. - // @@ BALA here is a place for FT REINVOCATION hooks - ACE_THROW_RETURN (CORBA::TRANSIENT ( - CORBA_SystemException::_tao_minor_code ( - TAO_INVOCATION_SEND_REQUEST_MINOR_CODE, - errno), - CORBA::COMPLETED_MAYBE), - TAO_INVOKE_EXCEPTION); + return this->orb_core_->service_raise_transient_failure (this, + this->profile_, + ACE_TRY_ENV); + } // @@ Maybe the right place to do this is once the reply is @@ -1513,11 +1505,9 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) TAO_INVOKE_EXCEPTION); } - this->close_connection (); - // @@ BALA here is a place for FT REINVOCATION hooks - ACE_THROW_RETURN (CORBA::COMM_FAILURE (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_MAYBE), - TAO_INVOKE_EXCEPTION); + return this->orb_core_->service_raise_comm_failure (this, + this->profile_, + ACE_TRY_ENV); } CORBA::ULong locate_status = this->rd_.reply_status (); diff --git a/TAO/tao/Invocation.h b/TAO/tao/Invocation.h index 1cbad8a5017..6982ddfab53 100644 --- a/TAO/tao/Invocation.h +++ b/TAO/tao/Invocation.h @@ -107,13 +107,21 @@ public: TAO_OutputCDR &out_stream (void); // Return the underlying output stream. - void select_endpoint_based_on_policy (CORBA_Environment &ACE_TRY_ENV + void select_endpoint_based_on_policy (CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()) ACE_THROW_SPEC ((CORBA::SystemException)); // Select the endpoint (and profile) we will use to in this - // invocation, based on TAO::Client_Priority_Policy.) I think this + // invocation, based on TAO::Client_Priority_Policy.) I think this // function may be more appropriate in TAO_Stub class. + // CORBA::Boolean restart_flag (void); + void restart_flag (CORBA::Boolean flag); + // Set the value for the restart flag. + + int close_connection (void); + // resets the forwarding profile and behaves like we are fowarded + // (to the same server) + protected: void start (CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()) @@ -132,10 +140,6 @@ protected: // that the server closed the connection simply to release // resources. - int close_connection (void); - // resets the forwarding profile and behaves like we are fowarded - // (to the same server) - int location_forward (TAO_InputCDR &inp_stream, CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()) @@ -190,6 +194,11 @@ protected: // LOC_NEEDS_ADDRESSING_MODE. If we receive an exception we will // fill up this data atmost *once* and send it to the server. + CORBA::Boolean restart_flag_; + // This flag is turned on when the previous invocation on an + // endpoint or a profile returned a TAO_INVOKE_RESTART. FT CORBA + // relies on this flag for guarenteeing unique id's during + // reinvocations. }; // **************************************************************** diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i index b3d66f0b505..544fb1dee48 100644 --- a/TAO/tao/Invocation.i +++ b/TAO/tao/Invocation.i @@ -21,13 +21,20 @@ TAO_GIOP_Invocation::out_stream (void) return this->out_stream_; } +ACE_INLINE void +TAO_GIOP_Invocation::restart_flag (CORBA::Boolean flag) +{ + // Set the flag + this->restart_flag_ = flag; +} + // **************************************************************** ACE_INLINE TAO_GIOP_Twoway_Invocation:: TAO_GIOP_Twoway_Invocation (TAO_Stub *stub, const char *operation, - CORBA::ULong opname_len, + CORBA::ULong opname_len, TAO_ORB_Core *orb_core) : TAO_GIOP_Invocation (stub, operation, opname_len, orb_core), rd_ (orb_core, this->op_details_.service_info ()) diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index e1401da89a6..6a141dda4ab 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -36,7 +36,7 @@ #include "ace/Dynamic_Service.h" #include "ace/Arg_Shifter.h" #include "tao/Services_Activate.h" - +#include "tao/Invocation.h" #if defined(ACE_MVS) @@ -1372,6 +1372,50 @@ TAO_ORB_Core::services_callbacks_init (void) // @@ Other service callbacks can be added here } +int +TAO_ORB_Core::service_raise_comm_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV) +{ + if (this->ft_service_.service_callback ()) + { + return this->ft_service_.service_callback ()-> + raise_comm_failure (invoke, + profile, + ACE_TRY_ENV); + } + + invoke->close_connection (); + + ACE_THROW_RETURN (CORBA::COMM_FAILURE ( + CORBA_SystemException::_tao_minor_code ( + TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, + errno), + CORBA::COMPLETED_MAYBE), + TAO_INVOKE_EXCEPTION); +} + +int +TAO_ORB_Core::service_raise_transient_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV) +{ + if (this->ft_service_.service_callback ()) + { + return this->ft_service_.service_callback ()-> + raise_transient_failure (invoke, + profile, + ACE_TRY_ENV); + } + + ACE_THROW_RETURN (CORBA::TRANSIENT ( + CORBA_SystemException::_tao_minor_code ( + TAO_INVOCATION_SEND_REQUEST_MINOR_CODE, + errno), + CORBA::COMPLETED_MAYBE), + TAO_INVOKE_EXCEPTION); +} + TAO_Client_Strategy_Factory * diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 2351f2d5e63..d586184ad4d 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -58,6 +58,7 @@ class TAO_RT_ORB; class TAO_RT_Current; class TAO_MProfile; class TAO_Profile; +class TAO_GIOP_Invocation; #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) @@ -573,6 +574,7 @@ public: void service_context_list (TAO_Stub *&stub, IOP::ServiceContextList &service_list, + CORBA::Boolean retstart, CORBA::Environment &ACE_TRY_ENV); // Call the service layers with the IOP::ServiceContext to check // whether they would like to add something to the list. @@ -580,6 +582,20 @@ public: TAO_Fault_Tolerance_Service &fault_tolerance_service (void); // Return a reference to the Fault Tolerant service object + int service_raise_comm_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV); + // 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_transient_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV); + // 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. + protected: ~TAO_ORB_Core (void); @@ -606,7 +622,7 @@ protected: int set_default_policies (void); // Set ORB-level policy defaults for this ORB. Currently sets // default RTCORBA policies: ServerProtocolPolicy & - // ClientProtocolPolicy. + // ClientProtocolPolicy. void resolve_typecodefactory_i (CORBA::Environment &ACE_TRY_ENV); // Obtain and cache the dynamic any factory object reference diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index ddedb674f7a..8cf1e364bc9 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -148,6 +148,7 @@ ACE_INLINE void TAO_ORB_Core::service_context_list ( TAO_Stub *&stub, IOP::ServiceContextList &service_list, + CORBA::Boolean restart, CORBA::Environment &ACE_TRY_ENV) { // @@ We look at the services if they are loaded. But if more @@ -158,6 +159,7 @@ TAO_ORB_Core::service_context_list ( { this->ft_service_.service_callback ()->service_context_list (stub, service_list, + restart, ACE_TRY_ENV); ACE_CHECK; } diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp index 09600ca0502..5bbe9e5266b 100644 --- a/TAO/tao/Service_Callbacks.cpp +++ b/TAO/tao/Service_Callbacks.cpp @@ -13,7 +13,6 @@ TAO_Service_Callbacks::~TAO_Service_Callbacks (void) { } - CORBA::Boolean TAO_Service_Callbacks::select_profile (TAO_MProfile * /*mprofile*/, TAO_Profile *& /*pfile*/) @@ -54,7 +53,36 @@ TAO_Service_Callbacks::service_create_policy (CORBA::PolicyType /*policy */, void TAO_Service_Callbacks::service_context_list (TAO_Stub *& /*stub*/ , IOP::ServiceContextList & /*service_list*/, + CORBA::Boolean , CORBA::Environment & /*ACE_TRY_ENV*/) { return; } + +int +TAO_Service_Callbacks::raise_comm_failure ( + TAO_GIOP_Invocation * /*invoke*/, + TAO_Profile * /*profile*/, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW_RETURN (CORBA::COMM_FAILURE ( + CORBA_SystemException::_tao_minor_code ( + TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, + errno), + CORBA::COMPLETED_MAYBE), + 2); +} + +int +TAO_Service_Callbacks::raise_transient_failure ( + TAO_GIOP_Invocation * /*invoke*/, + TAO_Profile * /*profile*/, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_THROW_RETURN (CORBA::TRANSIENT ( + CORBA_SystemException::_tao_minor_code ( + TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, + errno), + CORBA::COMPLETED_MAYBE), + 2); +} diff --git a/TAO/tao/Service_Callbacks.h b/TAO/tao/Service_Callbacks.h index 71556c4417a..163bf80c187 100644 --- a/TAO/tao/Service_Callbacks.h +++ b/TAO/tao/Service_Callbacks.h @@ -29,6 +29,7 @@ class TAO_Profile; class TAO_MProfile; +class TAO_GIOP_Invocation; class TAO_Export TAO_Service_Callbacks { @@ -70,9 +71,22 @@ public: virtual void service_context_list (TAO_Stub *&stub, IOP::ServiceContextList &service_list, + CORBA::Boolean restart, CORBA::Environment &ACE_TRY_ENV); // Allow the services to add service specific service contexr // information. + + virtual int raise_comm_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV); + // Allow the service layer to decide whether the COMM_FAILURE + // exception should be thrown or a reinvocation is needed + + virtual int raise_transient_failure (TAO_GIOP_Invocation *invoke, + TAO_Profile *profile, + CORBA::Environment &ACE_TRY_ENV); + // Allow the service layer to decide whether the TRANSIENT + // exception should be thrown or a reinvocation is needed }; diff --git a/TAO/tao/Wait_On_Leader_Follower.cpp b/TAO/tao/Wait_On_Leader_Follower.cpp index 2190ba52c76..2aad7d8dfe5 100644 --- a/TAO/tao/Wait_On_Leader_Follower.cpp +++ b/TAO/tao/Wait_On_Leader_Follower.cpp @@ -329,7 +329,7 @@ TAO_Wait_On_Leader_Follower::connection_closed (int &reply_received_flag, // Obtain the lock. ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, leader_follower.lock ()); - reply_received_flag = -11; + reply_received_flag = -1; (void) leader_follower.remove_follower (condition); |