diff options
author | bala <balanatarajan@users.noreply.github.com> | 2000-09-29 15:48:12 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2000-09-29 15:48:12 +0000 |
commit | 1cfe7c3afc11b96a8b1a790ed3e838d003983f18 (patch) | |
tree | 816573bae9064a1269359873fc183b657292a2bd /TAO | |
parent | b4c28265366b386414c13a342617e0f015e3b6ce (diff) | |
download | ATCD-1cfe7c3afc11b96a8b1a790ed3e838d003983f18.tar.gz |
ChangeLogTag: Fri Sep 29 10:14:52 2000 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 84 | ||||
-rw-r--r-- | TAO/tao/Client_Strategy_Factory.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/Client_Strategy_Factory.h | 4 | ||||
-rw-r--r-- | TAO/tao/Fault_Tolerance_Service.cpp | 49 | ||||
-rw-r--r-- | TAO/tao/Fault_Tolerance_Service.h | 110 | ||||
-rw-r--r-- | TAO/tao/Fault_Tolerance_Service.i | 46 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 25 | ||||
-rw-r--r-- | TAO/tao/Makefile | 3 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 20 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 7 | ||||
-rw-r--r-- | TAO/tao/ORB.i | 1 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 29 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 28 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 72 | ||||
-rw-r--r-- | TAO/tao/Service_Callbacks.cpp | 22 | ||||
-rw-r--r-- | TAO/tao/Service_Callbacks.h | 24 | ||||
-rw-r--r-- | TAO/tao/default_client.cpp | 23 | ||||
-rw-r--r-- | TAO/tao/default_client.h | 1 |
18 files changed, 479 insertions, 75 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 50fc929f171..67ebaef9ac1 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,43 @@ +Fri Sep 29 10:14:52 2000 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/ORB_Core.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.i: + * tao/Invocation.cpp: + * tao/Service_Callbacks.h: + * tao/Service_Callbacks.cpp: Added some more hooks for the FT + CORBA implementation. These hooks are used for creating service + context list based on some policies set in the ORB. Hooks for + the creation of policy objects have also been added. + + * tao/ORB.h: + * tao/ORB.cpp: + * tao/ORB.i: Added TAO specific methods _tao_ft_client_id () that + would allow applications to set a client id for Fault + Tolerance. A combination of client id and a unique retention id + (more or less like a request id) helps to identify the + requests. + + * tao/Fault_Tolerance_Service.h: + * tao/Fault_Tolerance_Service.cpp: + * tao/Fault_Tolerance_Service.i: New files. A collection of ORB & + ORB_Core related properties that are specific to FT CORBA. These + would not get activated unless the FT library has been loaded in + to the ORB_Core. + + * tao/Client_Strategy_Factory.cpp: + * tao/Client_Strategy_Factory.h: Added a method for the creation + of a lock (create_ft_service_retention_id_lock ()) for the + creation of a unique retention id in the Fault Tolerance Service + class. + + * tao/default_client.cpp: + * tao/default_client.h: Implementation of + create_ft_service_retention_id_lock () for the default_client. + + * tao/Makefile: Added the new file. + + Fri Sep 29 09:17:15 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp: @@ -11,13 +51,13 @@ Fri Sep 29 09:17:15 2000 Jeff Parsons <parsons@cs.wustl.edu> Fri Sep 29 02:09:32 2000 Irfan Pyarali <irfan@cs.wustl.edu> - * tao/diffs/RTPortableServerC.h.diff: - * tao/diffs/RTPortableServerC.cpp.diff: + * tao/diffs/RTPortableServerC.h.diff: + * tao/diffs/RTPortableServerC.cpp.diff: Added diff files. - * tao/PortableServer/PortableServer.pidl: - * tao/PortableServer/RTPortableServer.pidl: + * tao/PortableServer/PortableServer.pidl: + * tao/PortableServer/RTPortableServer.pidl: Updated documentation. @@ -34,8 +74,8 @@ Fri Sep 29 01:41:05 2000 Irfan Pyarali <irfan@cs.wustl.edu> * tao/PortableServer/PortableServer.pidl: Improved IDL code generation and patching information and comments. - * tao/PortableServer/TAO_PortableServer.dsp: - * tao/PortableServer/Makefile: + * tao/PortableServer/TAO_PortableServer.dsp: + * tao/PortableServer/Makefile: Added RTPortableServerC.* files. @@ -49,11 +89,11 @@ Fri Sep 29 01:41:05 2000 Irfan Pyarali <irfan@cs.wustl.edu> RTPortableServer::POA or PortableServer::POA depending on TAO_HAS_RT_CORBA. - * tao/PortableServer/PortableServer.h: - * tao/PortableServer/Object_Adapter.h: + * tao/PortableServer/PortableServer.h: + * tao/PortableServer/Object_Adapter.h: - #include "RTPortableServerC.h" instead of - #include "PortableServerC.h". + #include "RTPortableServerC.h" instead of + #include "PortableServerC.h". RTPortableServerC.h includes PortableServerC.h. @@ -72,8 +112,8 @@ Fri Sep 29 01:27:26 2000 Marina Spivak <marina@cs.wustl.edu> * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h: Removed <init_tcp_properties> method and <tcp_properties_> - member because we already inherit them from TAO_IIOP_Acceptor. - + member because we already inherit them from TAO_IIOP_Acceptor. + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -81,7 +121,7 @@ Fri Sep 29 01:27:26 2000 Marina Spivak <marina@cs.wustl.edu> Added support for client protocol properties configurations through RTCORBA::ClientProtocolPolicy. - + Thu Sep 28 23:51:11 2000 Marina Spivak <marina@cs.wustl.edu> * tao/IIOP_Connect.cpp @@ -100,16 +140,16 @@ Thu Sep 28 23:51:11 2000 Marina Spivak <marina@cs.wustl.edu> * tao/ORB_Core.h: Added ORB default RTCORBA::ClientProtocolPolicy. - + * tao/Policy_Manager.cpp * tao/Policy_Manager.h: Added <client_protocol> setter. - + Thu Sep 28 20:34:38 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp: - + Put back a generated 'const' that was inadvertently removed. Thu Sep 28 17:47:24 2000 Jeff Parsons <parsons@cs.wustl.edu> @@ -119,7 +159,7 @@ Thu Sep 28 17:47:24 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp: Fixed generated code for more use cases of interceptors. The - errors that prompted this fix were in FT_CORBA.idl and + errors that prompted this fix were in FT_CORBA.idl and reported by Aniruddha Gokhale <gokhale@research.bell-labs.com>. Thu Sep 28 14:35:32 2000 Pradeep Gore <pradeep@cs.wustl.edu> @@ -127,12 +167,12 @@ Thu Sep 28 14:35:32 2000 Pradeep Gore <pradeep@cs.wustl.edu> * orbsvcs/tests/Notify/performance_tests/RedGreen/Makefile: * orbsvcs/tests/Notify/performance_tests/RedGreen/README: * orbsvcs/tests/Notify/performance_tests/RedGreen/RedGreen_Test.cpp: - * orbsvcs/tests/Notify/performance_tests/RedGreen/RedGreen_Test.h: + * orbsvcs/tests/Notify/performance_tests/RedGreen/RedGreen_Test.h: * orbsvcs/tests/Notify/performance_tests/RedGreen/main.cpp: * orbsvcs/tests/Notify/performance_tests/RedGreen/listener.conf: * orbsvcs/tests/Notify/performance_tests/RedGreen/lookup.conf: * orbsvcs/tests/Notify/performance_tests/RedGreen/reactive.conf: - * orbsvcs/tests/Notify/performance_tests/RedGreen/svc.conf: + * orbsvcs/tests/Notify/performance_tests/RedGreen/svc.conf: * orbsvcs/tests/Notify/performance_tests/Throughput/Makefile: * orbsvcs/tests/Notify/performance_tests/Throughput/README: * orbsvcs/tests/Notify/performance_tests/Throughput/Throughput.cpp: @@ -186,7 +226,7 @@ Thu Sep 28 01:49:36 2000 Marina Spivak <marina@cs.wustl.edu> * tao/iiop_endpoints.pidl * tao/uiop_endpoints.pidl * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Endpoint.h * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp @@ -204,8 +244,8 @@ Wed Sep 27 18:54:29 2000 Jeff Parsons <parsons@cs.wustl.edu> Added code generation for the const version of the [] operator for the sequence _var classes. According to H & V, page 212 and 214, both versions must be - there for sequences. We were generating only the - non-const version. Thanks to Michael Rinne + there for sequences. We were generating only the + non-const version. Thanks to Michael Rinne <Michael.Rinne@ZN-AG.de> for reporting this. Wed Sep 27 17:44:12 2000 Angelo Corsaro <corsaro@cs.wustl.edu> diff --git a/TAO/tao/Client_Strategy_Factory.cpp b/TAO/tao/Client_Strategy_Factory.cpp index 80dcfec9c20..0d954abd9a6 100644 --- a/TAO/tao/Client_Strategy_Factory.cpp +++ b/TAO/tao/Client_Strategy_Factory.cpp @@ -35,3 +35,9 @@ TAO_Client_Strategy_Factory::create_cached_connector_lock (void) { return 0; } + +ACE_Lock * +TAO_Client_Strategy_Factory::create_ft_service_retention_id_lock (void) +{ + return 0; +} diff --git a/TAO/tao/Client_Strategy_Factory.h b/TAO/tao/Client_Strategy_Factory.h index fd1e245ccda..9e00b4b9507 100644 --- a/TAO/tao/Client_Strategy_Factory.h +++ b/TAO/tao/Client_Strategy_Factory.h @@ -58,6 +58,10 @@ public: virtual ACE_Lock *create_cached_connector_lock (void); // Create the lock to be used by the cached connector. + + virtual ACE_Lock *create_ft_service_retention_id_lock (void); + // Create a lock to be used by the TAO_Fault_Tolerant_Service class + // to generate unique retention ids }; #include "ace/post.h" diff --git a/TAO/tao/Fault_Tolerance_Service.cpp b/TAO/tao/Fault_Tolerance_Service.cpp new file mode 100644 index 00000000000..46206cc8efe --- /dev/null +++ b/TAO/tao/Fault_Tolerance_Service.cpp @@ -0,0 +1,49 @@ +#include "tao/Fault_Tolerance_Service.h" +#include "tao/Service_Callbacks.h" +#include "ace/Dynamic_Service.h" +#include "tao/Services_Activate.h" +#include "tao/ORB_Core.h" +#include "tao/Client_Strategy_Factory.h" + +#if !defined (__ACE_INLINE__) +# include "tao/Fault_Tolerance_Service.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(tao, Fault_Tolerance_Service, "$Id$") + +TAO_Fault_Tolerance_Service::~TAO_Fault_Tolerance_Service (void) +{ + delete this->ft_service_callback_; + delete this->ft_object_retention_id_lock_; +} + +void +TAO_Fault_Tolerance_Service::init (TAO_ORB_Core *orb_core) +{ + // Look in to the svc conf stuff to get an instance of the + // FT_Service. + if (this->ft_service_callback_ == 0) + { + TAO_Services_Activate *service = + ACE_Dynamic_Service <TAO_Services_Activate>::instance ("FT_Service_Activate"); + + // Activate the callback + if (service) + this->ft_service_callback_ = service->activate_services (orb_core); + } + + // If we have a valid service then we instantiate our lock and the + // client id + if (this->ft_service_callback_) + { + // Initialize the lock + this->ft_object_retention_id_lock_ = + orb_core->client_factory () + ->create_ft_service_retention_id_lock (); + + // Initialize the client id + this->ft_object_id_ = "TAO_Client"; + } + + return; +} diff --git a/TAO/tao/Fault_Tolerance_Service.h b/TAO/tao/Fault_Tolerance_Service.h new file mode 100644 index 00000000000..d2c49277774 --- /dev/null +++ b/TAO/tao/Fault_Tolerance_Service.h @@ -0,0 +1,110 @@ +//-*- C++ -*- +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// Fault_Tolerance_Service.h +// +// = DESCRIPTION +// A collection of the ORB and ORB core related properties that are +// specific to FT service. The TAO_ORB_Core holds an instance of this +// class. +// +// = AUTHOR +// Bala Natarajan <bala@cs.wustl.edu> +// ============================================================================ + +#ifndef TAO_FAULT_TOLERANCE_SERVICE_H +#define TAO_FAULT_TOLERANCE_SERVICE_H +#include "ace/pre.h" + +#include "ace/SString.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/corbafwd.h" + + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class TAO_Service_Callbacks; +class TAO_ORB_Core; + +class TAO_Fault_Tolerance_Service +{ + // = TITLE + // TAO_Fault_Tolerant_Service + // + // = DESCRIPTION + // A collection of ORB & ORB_Core related stuff that is needed at + // the ORB level. The ORB Core would carry an instance of this + // class and invoke methods on this. + // Note: This collection would be really useful when we have + // logging in place. The contents of this class can be logged at + // regular check point intervals. + +public: + TAO_Fault_Tolerance_Service (void); + // Ctor + + ~TAO_Fault_Tolerance_Service (void); + // Dtor + + void init (TAO_ORB_Core *orb_core); + // Initialise the internal data structures + + TAO_Service_Callbacks *service_callback (void); + // Return the underlying callback object + + const ACE_CString &client_id (void); + // Return the underlying <ft_object_id> + + void client_id (const char *id); + // Set the client id + + CORBA::Long new_retention_id (void); + // Generate and return a new retention id + + CORBA::Long retention_id (void); + // Return the underlying the retention id + +private: + + TAO_Service_Callbacks *ft_service_callback_; + // hook to callback on to the service + + ACE_CString ft_object_id_; + // The object id that would be used if the ft service is loaded. + + CORBA::Long ft_object_retention_id_; + // This and the <ft_object_id_> act as unique identifiers for the + // request sent from the source Object. Modification of this value + // is done by the loaded FT + + ACE_Lock *ft_object_retention_id_lock_; + // Lock for the retention id + + // NOTE: At a glance this retention id can be easily mistaken for a + // request id in a GIOP request. But the purpose served are a lot + // more than what a RequestId does for GIOP. So, we have a unique + // generator with a lock to protect from different threads accessing + // this. +}; + + +#if defined (__ACE_INLINE__) +# include "tao/Fault_Tolerance_Service.i" +#endif /* __ACE_INLINE__ */ + +#endif /*TAO_FAULT_TOLERANCE_SERVICE_H*/ diff --git a/TAO/tao/Fault_Tolerance_Service.i b/TAO/tao/Fault_Tolerance_Service.i new file mode 100644 index 00000000000..9bb42aa1c93 --- /dev/null +++ b/TAO/tao/Fault_Tolerance_Service.i @@ -0,0 +1,46 @@ +//$Id$ +ACE_INLINE +TAO_Fault_Tolerance_Service::TAO_Fault_Tolerance_Service (void) + : ft_service_callback_ (0), + ft_object_id_ (), + ft_object_retention_id_ (-1), + ft_object_retention_id_lock_ (0) +{ +} + + + +ACE_INLINE TAO_Service_Callbacks * +TAO_Fault_Tolerance_Service::service_callback (void) +{ + return this->ft_service_callback_; +} + +ACE_INLINE const ACE_CString & +TAO_Fault_Tolerance_Service::client_id (void) +{ + return this->ft_object_id_; +} + +ACE_INLINE void +TAO_Fault_Tolerance_Service::client_id (const char *id) +{ + this->ft_object_id_ = id; +} + +ACE_INLINE CORBA::Long +TAO_Fault_Tolerance_Service::new_retention_id (void) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + guard, + *this->ft_object_retention_id_lock_, + 0)); + + return ++this->ft_object_retention_id_; +} + +ACE_INLINE CORBA::Long +TAO_Fault_Tolerance_Service::retention_id (void) +{ + return this->ft_object_retention_id_; +} diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index ba6fa223803..96bd944c99f 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -284,6 +284,12 @@ TAO_GIOP_Invocation::start (CORBA::Environment &ACE_TRY_ENV) #if (TAO_HAS_RT_CORBA == 1) + // @@ Marina: IMHO, the filling up of the service context list should + // be going in to the prepare_header () method. The prepare_header + // () should be calling the right messaging protocol loaded to set + // the IOP::ServiceContext. If you move it there, this place would + // be less crowded. - Bala + // // @@ RT CORBA Policies processing code. This is a temporary location // for this code until more of it is accumulated. It will likely be // factored into separate method(s)/split/moved to different @@ -440,9 +446,15 @@ TAO_GIOP_Invocation::prepare_header (CORBA::Octet response_flags, ACE_THROW_SPEC ((CORBA::SystemException)) { // Then fill in the rest of the RequestHeader - // - // The target specification mode + // Fill up the service context lists + // First lookup at the services to see whether they have anything to + // add to the service context lists + this->orb_core_->service_context_list (this->stub_, + this->service_info (), + ACE_TRY_ENV); + + // The target specification mode if (this->stub_->addressing_mode () == TAO_Target_Specification::Key_Addr) { @@ -471,7 +483,7 @@ TAO_GIOP_Invocation::prepare_header (CORBA::Octet response_flags, // Update the response flags this->op_details_.response_flags (response_flags); - //Send the request for the header + // Send the request for the header if (this->transport_->send_request_header (this->op_details_, this->target_spec_, this->out_stream_) == 0) @@ -1011,6 +1023,7 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV) 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, @@ -1261,7 +1274,7 @@ TAO_GIOP_Oneway_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) } 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, @@ -1459,6 +1472,8 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) // works? Or is that something that a higher level component // 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, @@ -1499,7 +1514,7 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) } 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); diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile index cfffc54550c..58f7a8d472d 100644 --- a/TAO/tao/Makefile +++ b/TAO/tao/Makefile @@ -238,7 +238,8 @@ ORB_CORE_FILES = \ IOR_Parser \ DLL_Parser \ FILE_Parser \ - Bind_Dispatcher_Guard + Bind_Dispatcher_Guard \ + Fault_Tolerance_Service DYNAMIC_ANY_FILES = diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index c5d3e48aecc..315c9f144a9 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1049,6 +1049,18 @@ void CORBA_ORB::_tao_unexpected_exception (void) #endif /* ACE_HAS_EXCEPTIONS */ } +ACE_INLINE const ACE_CString & +CORBA_ORB::_tao_ft_client_id (void) +{ + return this->orb_core ()->fault_tolerance_service ().client_id (); +} + +ACE_INLINE void +CORBA_ORB::_tao_ft_client_id (const char *id) +{ + this->orb_core ()->fault_tolerance_service ().client_id (id); +} + // **************************************************************** // ORB initialization, per OMG document 98-12-01. @@ -1425,8 +1437,12 @@ CORBA_ORB::create_policy (CORBA::PolicyType type, default: break; } - ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY), - CORBA::Policy::_nil ()); + + // Call up the loaded services through the ORB_Core to see whether + // they can create the Policy object for the type we have. + return this->orb_core_->service_create_policy (type, + val, + ACE_TRY_ENV); } #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index 94e6bdc35e5..9039b2da0f9 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -379,6 +379,13 @@ public: TAO_ORB_Core *orb_core (void) const; // Get the ORB core. + const ACE_CString &_tao_ft_client_id (void); + void _tao_ft_client_id (const char *id); + // TAO specific extension to get and set the client ID. The client + // id can be set by the application which would be used by the FT + // service. As there are no specific interfaces defined in the spec, + // we have this prorpietary extensions + #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA_ORB_ptr _ptr_type; typedef CORBA_ORB_var _var_type; diff --git a/TAO/tao/ORB.i b/TAO/tao/ORB.i index a09338eaeae..8c1fe427c48 100644 --- a/TAO/tao/ORB.i +++ b/TAO/tao/ORB.i @@ -110,6 +110,7 @@ CORBA_ORB::_get_server_interceptor (CORBA_Environment &) } #endif /* TAO_HAS_INTERCEPTORS */ + // ************************************************************ // These are in CORBA namespace // ************************************************************ diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 685aa6a5f33..e1401da89a6 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -38,6 +38,7 @@ #include "tao/Services_Activate.h" + #if defined(ACE_MVS) #include "ace/Codeset_IBM1047.h" #endif /* ACE_MVS */ @@ -85,7 +86,6 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) server_factory_from_service_config_ (0), // @@ This is not needed since the default server factory, fredk // is statically added to the service configurator. - ft_service_callbacks_ (0), opt_for_collocation_ (1), use_global_collocation_ (1), collocation_strategy_ (THRU_POA), @@ -1201,7 +1201,7 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) // Now that we have a complete list of available protocols and their // related factory objects, set default policies and initialize the - // registries! + // registries! // Set ORB-level policy defaults. if (this->set_default_policies () != 0) @@ -1254,9 +1254,6 @@ TAO_ORB_Core::fini (void) CORBA::release (this->ior_table_); - if (ft_service_callbacks_ != 0) - delete ft_service_callbacks_; - if (TAO_debug_level >= 3) { ACE_DEBUG ((LM_DEBUG, @@ -1370,23 +1367,13 @@ TAO_ORB_Core::services_callbacks_init (void) // We (should) know what are the services that would need // callbacks. So, what we do is go through the Service Configurator // list for looking at the services that we want to load. + this->ft_service_.init (this); - // @@ At this point of time, we have hard coded the names of services - // @@ callbacks that we are looking at. But this needs to change - // @@ once we have some more understanding of the other services - // @@ that have specs similar to FT. - if (this->ft_service_callbacks_ == 0) - { - TAO_Services_Activate *service = - ACE_Dynamic_Service <TAO_Services_Activate>::instance ("FT_Service_Activate"); - - // Activate the callback - if (service) - this->ft_service_callbacks_ = service->activate_services (this); - } // @@ Other service callbacks can be added here } + + TAO_Client_Strategy_Factory * TAO_ORB_Core::client_factory (void) { @@ -1466,6 +1453,8 @@ TAO_ORB_Core::server_factory (void) return this->server_factory_; } + + int TAO_ORB_Core::inherit_from_parent_thread ( TAO_ORB_Core_TSS_Resources *tss_resources) @@ -1913,8 +1902,8 @@ TAO_ORB_Core::set_default_policies (void) // Set RTCORBA::ServerProtocolPolicy and // RTCORBA::ClientProtocolPolicy defaults to include all protocols // that were loaded into this ORB. - // First, create a protocol list. + TAO_ProtocolFactorySet *pfs = this->protocol_factories (); RTCORBA::ProtocolList protocols; @@ -1987,7 +1976,7 @@ TAO_ORB_Core::set_default_policies (void) TAO_ClientProtocolPolicy (protocols), -1); this->default_policies_->client_protocol (client_protocol_policy); - + #endif /* TAO_HAS_RT_CORBA == 1 */ return 0; } diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index f7a920cdf77..2351f2d5e63 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -34,6 +34,7 @@ #include "tao/Adapter.h" #include "tao/Service_Callbacks.h" #include "tao/Parser_Registry.h" +#include "tao/Fault_Tolerance_Service.h" #include "ace/Hash_Map_Manager.h" @@ -222,7 +223,7 @@ public: COLLOCATION_STRATEGIES_NUM // This value should always be the // last value in the enumeration. It // provides the count for the number - // of collocation strategies. + // of collocation strategies. }; static TAO_Collocation_Strategies collocation_strategy (CORBA::Object_ptr object); @@ -562,6 +563,23 @@ public: // actually nill or not. This would be useful to accomodate new // enhanced definitions as defined by the service specification. + CORBA::Policy_ptr service_create_policy (CORBA::PolicyType policy, + const CORBA::Any &val, + CORBA::Environment &ACE_TRY_ENV); + // The create_policy () method that is delegated to the service + // layer. This method would call the loaded services to check + // whether they can create the policy object requested by the + // application. + + void service_context_list (TAO_Stub *&stub, + IOP::ServiceContextList &service_list, + 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. + + TAO_Fault_Tolerance_Service &fault_tolerance_service (void); + // Return a reference to the Fault Tolerant service object + protected: ~TAO_ORB_Core (void); @@ -702,12 +720,10 @@ protected: // is staticaly added to the service configurator. // Start of service level hooks - // Service level hooks follow. - // NOTE: You shouldn't be deleting these. The service layer that - // allocated them should be deleting them. - TAO_Service_Callbacks *ft_service_callbacks_; - // ORB level hook to callback on to the service + TAO_Fault_Tolerance_Service ft_service_; + // Fault Tolerant service hook. + // End of Service level hooks CORBA::Boolean opt_for_collocation_; diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 671a54487aa..ddedb674f7a 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -66,12 +66,11 @@ TAO_ORB_Core::service_profile_selection (TAO_MProfile &mprofile, // @@ If different services have the same feature we may want to // prioritise them here. We need to decide here whose selection of // profile is more important. - if (this->ft_service_callbacks_ != 0) + if (this->ft_service_.service_callback ()) { - cout << "ORB_Core.i "<<endl; retval = - this->ft_service_callbacks_->select_profile (&mprofile, - profile); + this->ft_service_.service_callback ()->select_profile (&mprofile, + profile); } return retval; } @@ -84,11 +83,11 @@ TAO_ORB_Core::service_profile_reselection (TAO_Stub *stub, // @@ If different services have the same feature we may want to // prioritise them here. We need to decide here whose selection of // profile is more important. - if (this->ft_service_callbacks_ != 0) + if (this->ft_service_.service_callback ()) { retval = - this->ft_service_callbacks_->reselect_profile (stub, - profile); + this->ft_service_.service_callback ()->reselect_profile (stub, + profile); } return retval; } @@ -100,9 +99,9 @@ TAO_ORB_Core::reset_service_profile_flags (void) // prioritise them here. We need to decide here whose selection of // profile is more important. - if (this->ft_service_callbacks_ != 0) + if (this->ft_service_.service_callback ()) { - this->ft_service_callbacks_->reset_profile_flags (); + this->ft_service_.service_callback ()->reset_profile_flags (); } return; } @@ -112,14 +111,65 @@ ACE_INLINE CORBA::Boolean TAO_ORB_Core::object_is_nil (CORBA::Object_ptr obj) { CORBA::Boolean retval = 0; - if (this->ft_service_callbacks_ != 0) + if (this->ft_service_.service_callback ()) { retval = - this->ft_service_callbacks_->object_is_nil (obj); + this->ft_service_.service_callback ()->object_is_nil (obj); } return retval; } +ACE_INLINE CORBA::Policy_ptr +TAO_ORB_Core::service_create_policy (CORBA::PolicyType policy, + const CORBA::Any& val, + CORBA::Environment &ACE_TRY_ENV) +{ + CORBA::Policy_ptr ret_policy = CORBA::Policy::_nil (); + + // @@ We look at the services if they are loaded. But if more + // services offer this feature we may want to keep expanding the + // 'if' conditions with a check for whether a service returned a + // valid Policy object. + if (this->ft_service_.service_callback ()) + { + ret_policy = + this->ft_service_.service_callback ()->service_create_policy (policy, + val, + ACE_TRY_ENV); + } + if (ret_policy) + return ret_policy; + + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY), + CORBA::Policy::_nil ()); +} + +ACE_INLINE void +TAO_ORB_Core::service_context_list ( + TAO_Stub *&stub, + IOP::ServiceContextList &service_list, + CORBA::Environment &ACE_TRY_ENV) +{ + // @@ We look at the services if they are loaded. But if more + // services offer this feature we may want to keep expanding the + // 'if' conditions with a check for whether a service returned a + // valid Policy object. + if (this->ft_service_.service_callback ()) + { + this->ft_service_.service_callback ()->service_context_list (stub, + service_list, + ACE_TRY_ENV); + ACE_CHECK; + } +} + +ACE_INLINE TAO_Fault_Tolerance_Service & +TAO_ORB_Core::fault_tolerance_service (void) +{ + return this->ft_service_; +} + + ACE_INLINE ACE_Thread_Manager * TAO_ORB_Core::thr_mgr (void) { diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp index 37c04bc7352..09600ca0502 100644 --- a/TAO/tao/Service_Callbacks.cpp +++ b/TAO/tao/Service_Callbacks.cpp @@ -1,5 +1,6 @@ //$Id$ #include "tao/Service_Callbacks.h" +#include "tao/PolicyC.h" #if !defined (__ACE_INLINE__) # include "tao/Service_Callbacks.i" @@ -8,6 +9,11 @@ ACE_RCSID(tao, Service_Callbacks, "$Id$") +TAO_Service_Callbacks::~TAO_Service_Callbacks (void) +{ +} + + CORBA::Boolean TAO_Service_Callbacks::select_profile (TAO_MProfile * /*mprofile*/, TAO_Profile *& /*pfile*/) @@ -36,3 +42,19 @@ TAO_Service_Callbacks::reset_profile_flags (void) { return; } + +CORBA::Policy_ptr +TAO_Service_Callbacks::service_create_policy (CORBA::PolicyType /*policy */, + const CORBA::Any & /*val*/, + CORBA::Environment & /*ACE_TRY_ENV*/) +{ + return CORBA::Policy::_nil (); +} + +void +TAO_Service_Callbacks::service_context_list (TAO_Stub *& /*stub*/ , + IOP::ServiceContextList & /*service_list*/, + CORBA::Environment & /*ACE_TRY_ENV*/) +{ + return; +} diff --git a/TAO/tao/Service_Callbacks.h b/TAO/tao/Service_Callbacks.h index df1222610eb..71556c4417a 100644 --- a/TAO/tao/Service_Callbacks.h +++ b/TAO/tao/Service_Callbacks.h @@ -10,7 +10,8 @@ // // = DESCRIPTION // This is a generic interface that would be used to override many -// of the default functionalities that the ORB provides. +// of the default functionalities that the ORB provides by the +// services if they have been loaded in to the ORB_Core // // = AUTHOR // Bala Natarajan <bala@cs.wustl.edu> @@ -19,15 +20,13 @@ #define TAO_SERVICE_CALLBACK_H #include "ace/pre.h" -#include "tao/corbafwd.h" +#include "tao/IOPC.h" + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// Need to figure a way to remove this.... -//#include "tao/IOPC.h" - class TAO_Profile; class TAO_MProfile; @@ -44,6 +43,9 @@ class TAO_Export TAO_Service_Callbacks public: + virtual ~TAO_Service_Callbacks (void); + // Dtor + virtual CORBA::Boolean select_profile (TAO_MProfile *mprofile, TAO_Profile *&pfile); // Select the profile from MProfile as the needs of the services @@ -59,6 +61,18 @@ public: virtual CORBA::Boolean object_is_nil (CORBA::Object_ptr obj); // Check whether <obj> is nil or not. + + virtual CORBA::Policy_ptr service_create_policy ( + CORBA::PolicyType policy, + const CORBA::Any &val, + CORBA::Environment &ACE_TRY_ENV); + // Create a CORBA::Policy object + + virtual void service_context_list (TAO_Stub *&stub, + IOP::ServiceContextList &service_list, + CORBA::Environment &ACE_TRY_ENV); + // Allow the services to add service specific service contexr + // information. }; diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp index e74d39d8fa8..e0e71f168c7 100644 --- a/TAO/tao/default_client.cpp +++ b/TAO/tao/default_client.cpp @@ -132,7 +132,7 @@ TAO_Default_Client_Strategy_Factory::parse_args (int argc, char ** argv) if (curarg < argc) { char *name = argv[curarg]; - + if (ACE_OS::strcasecmp (name, "thread") == 0) this->cached_connector_lock_type_ = TAO_THREAD_LOCK; @@ -202,12 +202,12 @@ TAO_Default_Client_Strategy_Factory::create_wait_strategy (TAO_Transport *transp else { // = Leader follower model. - + ACE_NEW_RETURN (ws, TAO_Wait_On_Leader_Follower (transport), 0); } - + return ws; } @@ -228,6 +228,23 @@ TAO_Default_Client_Strategy_Factory::create_cached_connector_lock (void) return the_lock; } +ACE_Lock * +TAO_Default_Client_Strategy_Factory::create_ft_service_retention_id_lock (void) +{ + ACE_Lock *the_lock = 0; + + if (this->cached_connector_lock_type_ == TAO_NULL_LOCK) + ACE_NEW_RETURN (the_lock, + ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>, + 0); + else + ACE_NEW_RETURN (the_lock, + ACE_Lock_Adapter<ACE_SYNCH_MUTEX>, + 0); + + return the_lock; +} + // **************************************************************** ACE_STATIC_SVC_DEFINE (TAO_Default_Client_Strategy_Factory, diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h index ccec2651f2a..8a59120c6c3 100644 --- a/TAO/tao/default_client.h +++ b/TAO/tao/default_client.h @@ -54,6 +54,7 @@ public: TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport); TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport); virtual ACE_Lock *create_cached_connector_lock (void); + virtual ACE_Lock *create_ft_service_retention_id_lock (void); private: enum Lock_Type |