none
Transactions, Custom Resource Manager, and Multiple Threads (Transaction Not Completing) RRS feed

  • Question

  • A little background:

    We have a legacy COM component that we use in C# code via interop that updates configuration settings for our software. We needed to have multiple calls to this component to update several different settings be transactional so we can roll them back as needed. To this end, we have classes that provide an implementation of IEnlistmentNotification.  These same classes also enlist in the ambient transaction via Transaction.EnlistVolatile.

    I have some simple implementations of a connection, transaction, and command that basically just work together so that when a command is executed, an undo operation is created and cached and the original command is queued.  The transaction class will actually run the commands upon commit or execute the applicable undo upon rollback.

    The problem:

    It appears that the thread that is calling in to the IEnlistmentNotification implementation is one that I've not created. By the time this call happens, though, the original worker thread where the objects that implement it "live" has gone away.  I think this is causing my transaction to not commit fully (and no errors anywhere!).

    Any thoughts, suggestions, pointers?

    Thanks!


    Kelly Hilliard

    Thursday, May 8, 2014 4:46 PM

Answers

  • Hello,

    It seems this blog discusses the same issue, and from the comment of Marc Selis, the solution is to to either do a Thread.Sleep for a certain time, or to build in the loop below to check if some worker threads are still busy.

    If this does not work for you, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 9, 2014 2:43 AM
    Moderator

All replies

  • Hello,

    It seems this blog discusses the same issue, and from the comment of Marc Selis, the solution is to to either do a Thread.Sleep for a certain time, or to build in the loop below to check if some worker threads are still busy.

    If this does not work for you, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 9, 2014 2:43 AM
    Moderator
  • Thanks for your prompt reply! Adding a Thread.Sleep to delay my process exiting did trick! Thanks,

    Kelly Hilliard

    Friday, May 9, 2014 10:56 PM