Wrox Programmer Forums
|
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 30th, 2003, 09:04 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compensating Resource Manager

We created a transactional file system object using some sample code from "Professional Windows DNA". We have an oracle DB, MSMQ, and files all participating in a distributed transaction. This works very well almost all of the time. Occasionally we get an error:
Error Number: -2147168239
Automation error

The error seems to occur on startup or after long idle periods. The Objectis in a server package with CRM enabled.

If we rerun one of these failed transactions it goes through fine.

Here is the code - It fails in the potentially infinite Do loop.

Private Sub RegisterCompensator()

    Dim sProgId As String
    Dim sDesc As String

    If gbDebug Then Dbg.Print "CFileSystemTrx.RegisterCompensator"

    'If we have already registered the compensator then exit the subroutine:
    If mbIsCompensatorRegistered = True Then Exit Sub

    sProgId = "FNFSO.CFileSystemCompensator"
    sDesc = "The compensator for CFileSystemTrx."

    'Register the componensator with the DTC. There is the possibility that
the
    'Compensator is in the process of recovering from a previous shutdown,
    'hence the error checking loop. We are only registering the compensator
    'for the commit and abort phases:
    On Error Resume Next
    Do
        moCrmLogControl.RegisterCompensator sProgId, sDesc, _
                                CRMREGFLAG_COMMITPHASE Or
CRMREGFLAG_ABORTPHASE
        DoEvents
    Loop Until Err.Number <> XACT_E_RECOVERYINPROGRESS

    'Was there an error registering the compensator?
    If Err.Number <> 0 Then GoTo ErrorHandler

    'Indicate that the compensator has been registered, so
    'subsequent calls to register the compensator abort:
    mbIsCompensatorRegistered = True

    Exit Sub
ErrorHandler:
    With Err
        Dim lNum As Long
        Dim lLNum As Long
        Dim sErr As String
        lNum = .Number
        sErr = .Description
        On Error GoTo 0
        RaiseCustomError "RegisterCompensator failed with the following " &
_
                "information: Error Number: " & lNum & _
                " Error Description: " & sErr
    End With

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource For Controls Muhammad Zeeshan ASP.NET 2.0 Professional 0 July 27th, 2007 04:45 AM
Calendar as a resource?? kabucek BOOK: Access 2003 VBA Programmer's Reference 0 August 8th, 2006 07:27 AM
resource not available: servlets ejmelious Apache Tomcat 0 May 19th, 2005 11:52 AM
Resource files dotnetprogrammer VS.NET 2002/2003 0 December 20th, 2004 08:08 AM
The resource cannot be found. ltdanp21 Dreamweaver (all versions) 2 July 21st, 2004 02:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.