Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_GIOP_Twoway_Invocation Class Reference

Encapsulate a two-way invocation. More...

#include <Invocation.h>

Inheritance diagram for TAO_GIOP_Twoway_Invocation:

Inheritance graph
[legend]
Collaboration diagram for TAO_GIOP_Twoway_Invocation:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_GIOP_Twoway_Invocation (TAO_Stub *stub, const char *operation, CORBA::ULong opname_len, CORBA::Boolean argument_flag, TAO_ORB_Core *orb_core, int byte_order=TAO_ENCAP_BYTE_ORDER)
 Constructor. More...

virtual ~TAO_GIOP_Twoway_Invocation (void)
 Destructor. More...

void start (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Establishes a connection to the remote server, initializes the GIOP headers in the output CDR. More...

int invoke (TAO_Exception_Data *excepts, CORBA::ULong except_count ACE_ENV_ARG_DECL) throw (CORBA::Exception)
void reset_states (void)

Detailed Description

Encapsulate a two-way invocation.

Sends a two-way request, and expects the reply. This class connects (or lookups a connection from the cache) to the remote server, builds the CDR stream for the Request, send the CDR stream and expects the response and interprets the incoming CDR stream.

Definition at line 396 of file Invocation.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_GIOP_Twoway_Invocation::TAO_GIOP_Twoway_Invocation TAO_Stub   stub,
const char *    operation,
CORBA::ULong    opname_len,
CORBA::Boolean    argument_flag,
TAO_ORB_Core   orb_core,
int    byte_order = TAO_ENCAP_BYTE_ORDER
 

Constructor.

Definition at line 168 of file Invocation.i.

00176   : TAO_GIOP_Synch_Invocation (stub,
00177                                operation,
00178                                opname_len,
00179                                argument_flag,
00180                                orb_core,
00181                                byte_order)
00182 {
00183 }

ACE_INLINE TAO_GIOP_Twoway_Invocation::~TAO_GIOP_Twoway_Invocation void    [virtual]
 

Destructor.

Definition at line 186 of file Invocation.i.

00187 {
00188 }


Member Function Documentation

int TAO_GIOP_Twoway_Invocation::invoke TAO_Exception_Data   excepts,
CORBA::ULong except_count    ACE_ENV_ARG_DECL
throw (CORBA::Exception)
 

Special purpose invoke method used by the generated stubs. This accomplishes the same task as the normal invoke except that Exceptions are allocated and decoded here. This reduces the footprint of the generated stubs.

Definition at line 900 of file Invocation.cpp.

References ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_TEXT, ACE_THROW_RETURN, ACE_TRY_ENV, LM_DEBUG, ACE_OS_String::strcmp, TAO_DEFAULT_MINOR_CODE, TAO_FUNCTION_PP_TIMEPROBE, and TAO_INVOKE_EXCEPTION.

Referenced by TAO_Remote_Object_Proxy_Impl::_get_component, TAO_Remote_Object_Proxy_Impl::_is_a, TAO_Remote_Object_Proxy_Impl::_non_existent, CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy, CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy, CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager, TAO_CORBANAME_Parser::parse_string_dynamic_request_helper, and CORBA::_TAO_Policy_Remote_Proxy_Impl::policy_type.

00904 {
00905   TAO_FUNCTION_PP_TIMEPROBE (TAO_GIOP_INVOCATION_INVOKE_START);
00906 
00907   int retval = this->invoke_i (0
00908                                ACE_ENV_ARG_PARAMETER);
00909   ACE_CHECK_RETURN (retval);
00910 
00911   // A TAO_INVOKE_EXCEPTION status, but no exception raised means that
00912   // we have a user exception.
00913   // @@ This is a bit brittle, think about a better implementation.
00914   if (retval == TAO_INVOKE_EXCEPTION)
00915     {
00916       // Pull the exception from the stream.
00917       CORBA::String_var buf;
00918 
00919       if ((this->inp_stream () >> buf.inout ()) == 0)
00920         {
00921           // Could not demarshal the exception id, raise an local
00922           // CORBA::MARSHAL
00923           ACE_THROW_RETURN (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
00924                                             CORBA::COMPLETED_MAYBE),
00925                             TAO_INVOKE_EXCEPTION);
00926         }
00927 
00928       // Match the exception interface repository id with the
00929       // exception in the exception list.
00930       // This is important to decode the exception.
00931 
00932       for (CORBA::ULong i = 0; i < except_count; ++i)
00933         {
00934           if (ACE_OS::strcmp (buf.in (), excepts[i].id) != 0)
00935             {
00936               continue;
00937             }
00938 
00939           // match
00940           CORBA::Exception *exception = excepts[i].alloc ();
00941 
00942           if (exception == 0)
00943             {
00944               ACE_THROW_RETURN (CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
00945                                                   CORBA::COMPLETED_YES),
00946                                 TAO_INVOKE_EXCEPTION);
00947             }
00948 
00949           exception->_tao_decode (this->inp_stream ()
00950                                   ACE_ENV_ARG_PARAMETER);
00951           ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
00952 
00953           if (TAO_debug_level > 5)
00954             {
00955               ACE_DEBUG ((LM_DEBUG,
00956                           ACE_TEXT ("TAO: (%P|%t) Raising exception %s\n"),
00957                           buf.in ()));
00958             }
00959 
00960           // @@ Think about a better way to raise the exception here,
00961           //    maybe we need some more macros?
00962 #if defined (TAO_HAS_EXCEPTIONS)
00963           // If we have native exceptions, we must manage the memory allocated
00964           // by the call above to alloc(). Otherwise the Environment class
00965           // manages the memory.
00966           auto_ptr<CORBA::Exception> safety (exception);
00967 
00968           // Direct throw because we don't have the ACE_TRY_ENV.
00969           exception->_raise ();
00970 #else
00971           // We can not use ACE_THROW here.
00972           ACE_TRY_ENV.exception (exception);
00973 #endif
00974           return TAO_INVOKE_EXCEPTION;
00975         }
00976 
00977       // If we couldn't find the right exception, report it as
00978       // CORBA::UNKNOWN.
00979 
00980       ACE_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE,
00981                                         CORBA::COMPLETED_YES),
00982                         TAO_INVOKE_EXCEPTION);
00983     }
00984 
00985   return retval;
00986 }

void TAO_GIOP_Twoway_Invocation::reset_states void   
 

Special purpose method. This is used by services that restart invocation on a different target because of a failure of the first target like the FT_service. This method is used to clear off any state that are associated with the previous invocation

Definition at line 883 of file Invocation.cpp.

References TAO_GIOP_Invocation::endpoint, TAO_LF_Event::LFS_IDLE, TAO_GIOP_Invocation::profile, TAO_GIOP_Synch_Invocation::rd_, TAO_GIOP_Invocation::received_location_forward_, TAO_LF_Event::reset_state, and TAO_GIOP_Invocation::restart_flag_.

00884 {
00885   // Reset all the states. This is called by the FT service.
00886   this->rd_.reset_state (TAO_LF_Event::LFS_IDLE);
00887 
00888   this->profile (0);
00889   this->endpoint (0);
00890   this->restart_flag_ = 0;
00891   this->received_location_forward_ = 0;
00892 
00893   // Anything else that needs resetting??
00894 }

void TAO_GIOP_Twoway_Invocation::start ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Establishes a connection to the remote server, initializes the GIOP headers in the output CDR.

Reimplemented from TAO_GIOP_Invocation.

Definition at line 872 of file Invocation.cpp.

References ACE_CHECK, ACE_ENV_SINGLE_ARG_DECL, ACE_ENV_SINGLE_ARG_PARAMETER, TAO_LF_Event::LFS_ACTIVE, and TAO_GIOP_Invocation::start.

Referenced by TAO_Remote_Object_Proxy_Impl::_get_component, TAO_Remote_Object_Proxy_Impl::_is_a, TAO_Remote_Object_Proxy_Impl::_non_existent, CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy, CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy, CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager, TAO_CORBANAME_Parser::parse_string_dynamic_request_helper, and CORBA::_TAO_Policy_Remote_Proxy_Impl::policy_type.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:17:59 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002