00001 #include "tao/Fault_Tolerance_Service.h" 00002 #include "tao/Services_Activate.h" 00003 #include "tao/ORB_Core.h" 00004 #include "tao/Client_Strategy_Factory.h" 00005 00006 #include "ace/Dynamic_Service.h" 00007 00008 #if !defined (__ACE_INLINE__) 00009 # include "tao/Fault_Tolerance_Service.i" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 ACE_RCSID (tao, 00013 Fault_Tolerance_Service, 00014 "Fault_Tolerance_Service.cpp,v 1.6 2005/11/02 07:13:02 ossama Exp") 00015 00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 TAO_Fault_Tolerance_Service::~TAO_Fault_Tolerance_Service (void) 00019 { 00020 delete this->ft_service_callback_; 00021 delete this->ft_object_retention_id_lock_; 00022 } 00023 00024 void 00025 TAO_Fault_Tolerance_Service::init (TAO_ORB_Core *orb_core) 00026 { 00027 // Look in to the svc conf stuff to get an instance of the 00028 // FT_Service. 00029 if (this->ft_service_callback_ == 0) 00030 { 00031 TAO_Services_Activate *service = 00032 ACE_Dynamic_Service <TAO_Services_Activate>::instance ("FT_ClientService_Activate"); 00033 00034 // Activate the callback 00035 if (service) 00036 this->ft_service_callback_ = service->activate_services (orb_core); 00037 } 00038 00039 // If we have a valid service then we instantiate our lock and the 00040 // client id 00041 if (this->ft_service_callback_) 00042 { 00043 // Initialize the lock 00044 this->ft_object_retention_id_lock_ = 00045 orb_core->client_factory () 00046 ->create_ft_service_retention_id_lock (); 00047 00048 // Initialize the client id 00049 this->ft_object_id_ = "TAO_Client"; 00050 } 00051 00052 return; 00053 } 00054 00055 CORBA::Long 00056 TAO_Fault_Tolerance_Service::retention_id (void) 00057 { 00058 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00059 guard, 00060 *this->ft_object_retention_id_lock_, 00061 0)); 00062 00063 return ++this->ft_object_retention_id_; 00064 } 00065 00066 TAO_END_VERSIONED_NAMESPACE_DECL