Hi Ricardo,

I think you are right and that client should redo invocation
transparently in case of forward request although it's thrown just from
its own interceptor. However I would like to be sure that you preserve
main semantics of PIs and that all other interceptors on the stack are
invoked with receive_other and appropriate properties set and just after
this you can reissue the invocation (so all PIs' send_request or
send_poll method is called.). E.g. you do have P1...P4 on the stack. P1
is the first and P4 is the last. P1 receives system exception, P2
receive system exception, but throws location forward, then P3 receive
other and P4 receive other and after it you reissue the invocation. Also
could you be so kind while being at this hacking to have a look and fix
test/pi/location-forward so it also tests your case?

Thanks a lot!
Karel

On 07/20/10 03:13, Ricardo Cosme wrote:
> Hi,
> 
> When I raise a ForwardRequest exception in a receive_exception point, which 
> receives
> a COMM_FAILURE exception, the orb doesn't retry the request. This 
> ForwardRequest 
> exception reaches my main(). But, when I make this test on the server-side, 
> Mico retry 
> the request.
> 
> I believe that Mico should retry the request on the client-side. Am I right ?
> 
> However, I wrote a patch for Mico 2.3.13:
> 
> --- static.cc    2010-07-19 16:54:10.000000000 -0300
> +++ static.cc.JUL2010    2010-07-19 16:52:59.000000000 -0300
> @@ -2252,6 +2252,7 @@
>         break;
> 
>     case CORBA::InvokeSysEx:
> +        try {
>         // receive_exception (system exception)
>         PInterceptor::PI::_receive_exception_ip
>         (_cri, PortableInterceptor::SYSTEM_EXCEPTION,
> @@ -2292,6 +2293,22 @@
>                      break;
>         }
>         }
> +        } catch(PortableInterceptor::ForwardRequest_catch& exc) {
> +            _obj->_forward(exc->forward);
> +            env()->clear();
> +            CORBA::release(_cri);
> +            if (_id != NULL)
> +            delete _id;
> +            _id = orb->new_orbid();
> +            _cri = PInterceptor::PI::_create_cri(_obj, _opname);
> +            PInterceptor::PI::_send_request_ip
> +            (_cri, CORBA::ORB::get_msgid(_id), _args, this->ctx_list(),
> +             this->ctx(), this->context());
> +            _id = orb->invoke_async (_obj, this, Principal::_nil(),
> +                 TRUE, 0, _id);  
> +              done = TRUE;
> +             break;          
> +        }
>         done = TRUE;
>         break;
> 
> @@ -2489,6 +2506,7 @@
>         break;
> 
>     case CORBA::InvokeSysEx:
> +        try{
>         PInterceptor::PI::_receive_exception_ip
>         (_cri, PortableInterceptor::SYSTEM_EXCEPTION,
>          this->exception(), this->ctx_list(),
> @@ -2532,6 +2550,20 @@
>                      break;
>         }
>         }
> +        } catch(PortableInterceptor::ForwardRequest_catch& exc) {
> +            _obj->_forward(exc->forward);
> +            env()->clear();
> +            CORBA::release(_cri);
> +            if (_id != NULL)
> +            delete _id;
> +            _id = orb->new_orbid();
> +            _cri = PInterceptor::PI::_create_cri(_obj, _opname);
> +            PInterceptor::PI::_send_request_ip
> +            (_cri, CORBA::ORB::get_msgid(_id), _args, this->ctx_list(),
> +             this->ctx(), this->context());
> +            _id = orb->invoke_async (_obj, this, Principal::_nil(),
> +                 TRUE, 0, _id);            
> +        }
>         done = TRUE;
>         break;
> 
> 
> 
> 
> 
> 
> 
> --- pi_impl.cc    2010-07-19 16:54:58.000000000 -0300
> +++ pi_impl.cc.JUL2010    2010-07-19 16:52:49.000000000 -0300
> @@ -2137,15 +2137,15 @@
>     PInterceptor::PI::_exec_receive_exception(ri);
>     throw;
>      } catch (PortableInterceptor::ForwardRequest_catch& ex) {
> -    ClientRequestInfo_impl* ri_impl
> -        = dynamic_cast<ClientRequestInfo_impl*>(ri);
> -    assert(!CORBA::is_nil(ri_impl));
> -    ri_impl->exception(ex->_clone());
> -    ri_impl->effective_target(ex->forward);
> -    ri_impl->reply_status(PortableInterceptor::LOCATION_FORWARD);
> -    ri_impl->icept_oper(PInterceptor::RECEIVE_OTHER);
> -    PInterceptor::PI::_exec_receive_other(ri);
> -    throw;
> +    ClientRequestInfo_impl* ri_impl
> +        = dynamic_cast<ClientRequestInfo_impl*>(ri);
> +    assert(!CORBA::is_nil(ri_impl));
> +    ri_impl->exception(ex->_clone());
> +    ri_impl->effective_target(ex->forward);
> +    ri_impl->reply_status(PortableInterceptor::LOCATION_FORWARD);
> +    ri_impl->icept_oper(PInterceptor::RECEIVE_OTHER);
> +    PInterceptor::PI::_exec_receive_other(ri);
> +    throw;
>      } catch (CORBA::UserException& ex) {
>     PInterceptor::ClientRequestInfo_impl* ri_impl
>         = dynamic_cast<PInterceptor::ClientRequestInfo_impl*>(ri);
> @@ -2255,7 +2255,12 @@
>     cri->icept_oper(PInterceptor::RECEIVE_EXCEPTION);
>     cri->exception(exception->_clone());
>     cri->set_reply_service_context_list(reply_scl);
> +    try {
>     PInterceptor::PI::_exec_receive_exception(cri); // end point
> +    } catch (PortableInterceptor::ForwardRequest_catch& ex) {
> +        std::cout << "receive_exception_ip: catch ForwardException" << endl;
> +        throw;
> +    }
>      }
> }
> 
> @@ -2276,7 +2281,11 @@
>     cri->contexts(contexts);
>     cri->operation_context(operation_context);
>     cri->set_reply_service_context_list(reply_scl);
> +    try {
>     PInterceptor::PI::_exec_receive_exception(cri); // end point
> +    } catch (PortableInterceptor::ForwardRequest_catch& ex) {
> +        throw;
> +    }
>      }
> }
> 
> 
> Ricardo Cosme
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Mico-devel mailing list
> Mico-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mico-devel
> 


-- 
Karel Gardas                  kgar...@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Mico-devel mailing list
Mico-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mico-devel

Reply via email to