Michael Kilburn
2010-01-07 07:52:19 UTC
Hi,
I wonder if it is possible to do these two things in CORBA server that uses
omniORB:
1. wrap every incoming call with smth like:
try {
... // process call
} catch(std::exception const& x) {
throw MyCorbaException(x.what());
}
the idea is to replace CORBA_Unknown exceptions generated by escaped C++
exception with something more useful... Obviously this code should be
executed in context of a thread that actually processes the request.
I have checked interceptors in the documentation but it is very brief and
does not give any guarantees on thread context given interceptor will be
called in.
2. this one is very similar to (1) but not required to happen on request
processing thread -- essentially I need to set a flag before processing a
request and reset it when it returns. This is going to be used in
conjunction with MAIN_THREAD_MODEL and it is important that flag for given
request is not set before previous request finish processing... and once
flag is set next request to be processed should be "ours". Ideally I would
like this to work like in (1), but alternatively I can use global mutex:
- in receive request interceptor -- lock mutex, set flag, proceed
- in reply interceptor (assuming that it is guaranteed to be called, even if
"proceed" step fails before actually reaching user code) -- reset flag,
unlock mutex
But I am not sure if it is ok to lock mutexes in interceptors (and if it is
ok with MAIN_THREAD_MODEL).
That's it... I am looking for a solution that will work regardless of
current threading model and other configuration options and would be nice to
have this at the POA granularity level (i.e. to be able to do it for
requests server by specific POA -- but it is optional).
If someone could point me into proper direction -- it would be great. Thank
you.
I wonder if it is possible to do these two things in CORBA server that uses
omniORB:
1. wrap every incoming call with smth like:
try {
... // process call
} catch(std::exception const& x) {
throw MyCorbaException(x.what());
}
the idea is to replace CORBA_Unknown exceptions generated by escaped C++
exception with something more useful... Obviously this code should be
executed in context of a thread that actually processes the request.
I have checked interceptors in the documentation but it is very brief and
does not give any guarantees on thread context given interceptor will be
called in.
2. this one is very similar to (1) but not required to happen on request
processing thread -- essentially I need to set a flag before processing a
request and reset it when it returns. This is going to be used in
conjunction with MAIN_THREAD_MODEL and it is important that flag for given
request is not set before previous request finish processing... and once
flag is set next request to be processed should be "ours". Ideally I would
like this to work like in (1), but alternatively I can use global mutex:
- in receive request interceptor -- lock mutex, set flag, proceed
- in reply interceptor (assuming that it is guaranteed to be called, even if
"proceed" step fails before actually reaching user code) -- reset flag,
unlock mutex
But I am not sure if it is ok to lock mutexes in interceptors (and if it is
ok with MAIN_THREAD_MODEL).
That's it... I am looking for a solution that will work regardless of
current threading model and other configuration options and would be nice to
have this at the POA granularity level (i.e. to be able to do it for
requests server by specific POA -- but it is optional).
If someone could point me into proper direction -- it would be great. Thank
you.
--
Sincerely yours,
Michael.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20100106/9c36bf41/attachment.htm
Sincerely yours,
Michael.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20100106/9c36bf41/attachment.htm