TOraAlerter Blocking Register Call Question

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
aebibueb
Posts: 13
Joined: Thu 24 Jul 2008 13:46

TOraAlerter Blocking Register Call Question

Post by aebibueb » Thu 26 Feb 2009 14:10

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?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 27 Feb 2009 10:15

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.

aebibueb
Posts: 13
Joined: Thu 24 Jul 2008 13:46

Post by aebibueb » Fri 02 Oct 2009 07:07

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?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 02 Oct 2009 08:41

There is no other way to stop the thread. You need to kill it.

aebibueb
Posts: 13
Joined: Thu 24 Jul 2008 13:46

Post by aebibueb » Mon 05 Oct 2009 06:13

Ok thanks. Have a good start into the new week :)

Post Reply