ESF_Proxy_Admin.cpp

Go to the documentation of this file.
00001 // ESF_Proxy_Admin.cpp,v 1.13 2006/03/14 06:14:25 jtc Exp
00002 
00003 #ifndef TAO_ESF_PROXY_ADMIN_CPP
00004 #define TAO_ESF_PROXY_ADMIN_CPP
00005 
00006 #if ! defined (__ACE_INLINE__)
00007 #include "orbsvcs/ESF/ESF_Proxy_Admin.i"
00008 #endif /* __ACE_INLINE__ */
00009 
00010 #include "orbsvcs/ESF/ESF_Shutdown_Proxy.h"
00011 
00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00013 
00014 template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
00015 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00016     TAO_ESF_Proxy_Admin (EVENT_CHANNEL *ec)
00017   : event_channel_ (ec)
00018 {
00019   this->event_channel_->create_proxy_collection (this->collection_);
00020 }
00021 
00022 template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
00023 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00024     ~TAO_ESF_Proxy_Admin (void)
00025 {
00026   this->event_channel_->destroy_proxy_collection (this->collection_);
00027 }
00028 
00029 template<class EVENT_CHANNEL, class PROXY, class INTERFACE> INTERFACE*
00030 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00031     obtain (ACE_ENV_SINGLE_ARG_DECL)
00032   ACE_THROW_SPEC ((CORBA::SystemException))
00033 {
00034   PROXY* proxy;
00035   this->event_channel_->create_proxy (proxy);
00036 
00037   TAO_ESF_RefCountedRef<PROXY> holder (proxy);
00038 
00039   ACE_TYPENAME PROXY::_ptr_type r;
00040   proxy->activate (r ACE_ENV_ARG_PARAMETER);
00041   ACE_CHECK_RETURN (INTERFACE::_nil ());
00042 
00043   ACE_TYPENAME PROXY::_var_type result = r;
00044 
00045   this->collection_->connected (proxy ACE_ENV_ARG_PARAMETER);
00046   ACE_CHECK_RETURN (INTERFACE::_nil ());
00047 
00048   return result._retn ();
00049 }
00050 
00051 template<class EVENT_CHANNEL, class PROXY, class INTERFACE> void
00052 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00053     shutdown (ACE_ENV_SINGLE_ARG_DECL)
00054   ACE_THROW_SPEC ((CORBA::SystemException))
00055 {
00056   TAO_ESF_Shutdown_Proxy<PROXY> worker;
00057 
00058   this->collection_->for_each (&worker ACE_ENV_ARG_PARAMETER);
00059   ACE_CHECK; // Cannot happen, just following the discipline.
00060 
00061   this->collection_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00062 }
00063 
00064 template<class EVENT_CHANNEL, class PROXY, class INTERFACE> void
00065 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00066     connected (PROXY *
00067                ACE_ENV_ARG_DECL_NOT_USED)
00068   ACE_THROW_SPEC ((CORBA::SystemException))
00069 {
00070 }
00071 
00072 template<class EVENT_CHANNEL, class PROXY, class INTERFACE> void
00073 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00074     reconnected (PROXY *proxy
00075                  ACE_ENV_ARG_DECL)
00076   ACE_THROW_SPEC ((CORBA::SystemException))
00077 {
00078   this->collection_->reconnected (proxy ACE_ENV_ARG_PARAMETER);
00079 }
00080 
00081 template<class EVENT_CHANNEL, class PROXY, class INTERFACE> void
00082 TAO_ESF_Proxy_Admin<EVENT_CHANNEL,PROXY,INTERFACE>::
00083     disconnected (PROXY *proxy
00084                   ACE_ENV_ARG_DECL)
00085   ACE_THROW_SPEC ((CORBA::SystemException))
00086 {
00087   proxy->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
00088   ACE_CHECK; // Cannot happen, just following the discipline.
00089 
00090   ACE_TRY
00091     {
00092       this->collection_->disconnected (proxy ACE_ENV_ARG_PARAMETER);
00093       ACE_TRY_CHECK;
00094     }
00095   ACE_CATCHANY
00096     {
00097       // @@ In the future the collections may raise exceptions to
00098       // report errors (such as out of memory or things like that).
00099       // We must decide how is that info going to be used, and how
00100       // would we propagate the exception to the application.
00101       // For example: the CosEC has no exceptions for "out of
00102       // resources" or something similar, and i've never seen a spec
00103       // that has an exception for "could not acquire a mutex".
00104     }
00105   ACE_ENDTRY;
00106 }
00107 
00108 TAO_END_VERSIONED_NAMESPACE_DECL
00109 
00110 #endif /* TAO_ESF_PROXY_ADMIN_CPP */

Generated on Thu Nov 9 13:08:13 2006 for TAO_ESF by doxygen 1.3.6