Page 1 of 1

TOraAlerter Blocking Register Call Question

Posted: Thu 26 Feb 2009 14:10
by aebibueb
hi there

i have question regarding how to handle the following scenario with oracle alerts. suppose there are two clients each interested in the same alert-type, both using the oraalerter component. client A has started a transaction in which a message of the alert-type has been signaled. however, before committing its transaction client a has encountered an unhandled error of some sort, hence no commit or rollback will be issued.

in this case, when client B tries to register the signaled alert-type, it is blocked until client A will finally commit or rollback. however, who knows when that will ever happen (well, except for windows patch day ;) ).

my question is, what is the suggested way of handling that situation. i would like the application to continue, but without using alerting (maybe notifying the user in some way). my first was thought was to start the alerter in a thread using a WaitForSingleObject on the thread-handle, but since the alerter itself is nonblocking i wondered if this will cause more trouble than it solves...

what is the best strategy here?

Posted: Fri 27 Feb 2009 10:15
by Plash
This is an Oracle limitation that DBMS_ALERT.REGISTER procedure hangs until the transaction is commited or rolled back.

I think you can start the alerter from a thread. There should not be problems with this.

Posted: Fri 02 Oct 2009 07:07
by aebibueb
I did some more playing around. Starting in a thread works fine now.
Of course that does not solve the problem, it only "moves" it to the
end of the programs lifecycle. Now once the user closes the app, its
main window disappears, however, the process remains open because
the alerter cannot clean itself up.

As for now, I simply kill the process using the windows api methods
and that works out fine. Is there a more elegant way though? As I understand
from
http://www.devart.com/forums/viewtopic.php?t=14049
quitting a procedure from code is not supported. Then how would
I handle such a situation where the "register"-call simply does not return?

Posted: Fri 02 Oct 2009 08:41
by Plash
There is no other way to stop the thread. You need to kill it.

Posted: Mon 05 Oct 2009 06:13
by aebibueb
Ok thanks. Have a good start into the new week :)