ukb
10/13/2005 10:31:00 AM
Hi Michal
Thank you very much for your quick response!
There is a little problem with your proposed solution, though. The first
time getNumInternal is run, it completes without problems and does ttscommit
on the userConnection.
The second time, when the select statement is reached, the system is
blocked. No deadlock or other exception is thrown, Axapta just freezes at the
select statement. I guess your solution only works if an exception is thrown.
Also, how can I modify the xApplication class? As a kernel class I can only
find it in the System Documentation node in the AOT, where there is no access
to the code?
Thanks
Ulrik
"Michal Kupczyk >" wrote:
> I do not have 2.5, but IMHO you can try to modify Application class, adding
> support for registering / deregistering your connections to be aborted when
> exception is thrown and control is going beyond ttsabort;
>
> xApplication
> classDeclaration
> {
> ....
> set connToBeAborted;
> }
> void registerConn(UserConnection _userConn)
> {
> if(!connToBeAborted.Exist(_userConn))
> connToBeAborted.Add(_userConn)
> }
>
> void deregisterconn(_userconn)
> {
> connToBeAborted.Delete(_userConn)
> }
>
> void ttsNotifyAbort()
> {
> [original stuff here]
> get all your still registered connections
> {
> setElement.Delete(); //destroy connection object, not
> automaticly destroyed because reference was stored here.
> eachUserConn.Abort();
> }
> map = NULL; // just for sure, to destroy all contained connections, that
> were not destroyed because reference was stored HERE.
> }
>
>
> and in
> NumberSeq.getNumInternal(...)
> {
> ....
> userConnection = new UserConnection();
> appl.registerConn(userConnection);
>
>
> if (!ok)
> {
> appl.deregisterConn(userConnection);
> userConnection.ttsabort();
> throw error("@SYS25038");
> }
> }
>
>
> ttsNotifyAbort is called only for primary connection.
> As a effect, all transactions in connections that you''ve lost control will
> be at least aborted and maybe destroyed.
>
> Michal
>
>
>
>