[omniORB] Is this transient exception handler OK?
Alex Tingle
alex.tingle at bronermetals.com
Thu Mar 18 14:22:50 GMT 2004
Hello,
Is it safe to raise a system exception in an omniORB transient
exception handler? I'm maintaining a piece of code that contains this
transient handler:
CORBA::Boolean transient_handler(
void* cookie, CORBA::ULong retries, const CORBA::TRANSIENT& ex)
{
if(retries > MAX_RETRIES)
{
throw CORBA::COMM_FAILURE(ex.minor(), ex.completed());
}
omni_thread::sleep(retries,0);
return 1;
}
Clearly the author just wants to retry a couple of times and then give
up with a COMM_FAILURE. However, the system exhibits instability when
the transient exception is triggered. Could the throw be the cause of
that instability?
I would probably write the handler like this:
CORBA::Boolean transient_handler(
void* cookie, CORBA::ULong retries, const CORBA::TRANSIENT& ex)
{
if(retries > MAX_RETRIES)
return 0;
omni_thread::sleep(retries,0);
return 1;
}
...although that forces the application code to catch TRANSIENT
explicitly, instead of just COMM_FAILURE. Is this a better alternative?
-Alex Tingle
--
Dammit Jim, I'm a programmer... not a mind reader!
More information about the omniORB-list
mailing list