00001 #include "tao/LocateRequest_Invocation_Adapter.h"
00002 #include "tao/Profile_Transport_Resolver.h"
00003 #include "tao/operation_details.h"
00004 #include "tao/LocateRequest_Invocation.h"
00005 #include "tao/Transport.h"
00006 #include "tao/Transport_Mux_Strategy.h"
00007 #include "tao/ORB_Core.h"
00008
00009 ACE_RCSID (tao,
00010 LocateRequest_Invocation_Adapter,
00011 "LocateRequest_Invocation_Adapter.cpp,v 1.9 2006/06/01 10:20:40 jwillemsen Exp")
00012
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015 namespace TAO
00016 {
00017 LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter (
00018 CORBA::Object *target)
00019 : target_ (target)
00020 , list_ (0)
00021 {
00022 }
00023
00024 void
00025 LocateRequest_Invocation_Adapter::invoke (ACE_ENV_SINGLE_ARG_DECL)
00026 {
00027 CORBA::Object * const effective_target = this->target_;
00028
00029 TAO_Stub * const stub =
00030 this->target_->_stubobj ();
00031
00032 if (stub == 0)
00033 ACE_THROW (CORBA::INTERNAL (
00034 CORBA::SystemException::_tao_minor_code (
00035 0,
00036 EINVAL),
00037 CORBA::COMPLETED_NO));
00038
00039 ACE_Time_Value tmp_wait_time;
00040 ACE_Time_Value *max_wait_time = 0;
00041
00042 bool const is_timeout =
00043 this->get_timeout (tmp_wait_time);
00044
00045 if (is_timeout)
00046 max_wait_time = &tmp_wait_time;
00047
00048 Invocation_Status s = TAO_INVOKE_START;
00049
00050 while (s == TAO_INVOKE_START ||
00051 s == TAO_INVOKE_RESTART)
00052 {
00053 Profile_Transport_Resolver resolver (effective_target,
00054 stub,
00055 true);
00056
00057 ACE_TRY
00058 {
00059 resolver.init_inconsistent_policies (
00060 ACE_ENV_SINGLE_ARG_PARAMETER);
00061 ACE_TRY_CHECK;
00062
00063 resolver.resolve (max_wait_time
00064 ACE_ENV_ARG_PARAMETER);
00065 ACE_TRY_CHECK;
00066
00067
00068
00069 TAO_Operation_Details op (0,
00070 0,
00071 false);
00072
00073 op.request_id (resolver.transport ()->tms ()->request_id ());
00074 TAO::LocateRequest_Invocation synch (this->target_,
00075 resolver,
00076 op);
00077
00078 s = synch.invoke (max_wait_time
00079 ACE_ENV_ARG_PARAMETER);
00080 ACE_TRY_CHECK;
00081 }
00082 ACE_CATCH (CORBA::INV_POLICY, ex)
00083 {
00084 this->list_ =
00085 resolver.steal_inconsistent_policies ();
00086 ACE_RE_THROW;
00087 }
00088 ACE_CATCHANY
00089 {
00090 ACE_RE_THROW;
00091 }
00092 ACE_ENDTRY;
00093 ACE_CHECK;
00094 }
00095
00096 return;
00097 }
00098
00099 CORBA::PolicyList *
00100 LocateRequest_Invocation_Adapter::get_inconsistent_policies (void)
00101 {
00102 return this->list_._retn ();
00103 }
00104
00105 bool
00106 LocateRequest_Invocation_Adapter::get_timeout (ACE_Time_Value &timeout)
00107 {
00108 bool has_timeout = false;
00109 this->target_->orb_core ()->call_timeout_hook (this->target_->_stubobj (),
00110 has_timeout,
00111 timeout);
00112
00113 return has_timeout;
00114 }
00115 }
00116
00117 TAO_END_VERSIONED_NAMESPACE_DECL