WO2004079524A2 - Protection against interleaving transactions using a transaction manager - Google Patents

Protection against interleaving transactions using a transaction manager Download PDF

Info

Publication number
WO2004079524A2
WO2004079524A2 PCT/US2004/006073 US2004006073W WO2004079524A2 WO 2004079524 A2 WO2004079524 A2 WO 2004079524A2 US 2004006073 W US2004006073 W US 2004006073W WO 2004079524 A2 WO2004079524 A2 WO 2004079524A2
Authority
WO
WIPO (PCT)
Prior art keywords
resource
enlistment
request
thread
enlistment request
Prior art date
Application number
PCT/US2004/006073
Other languages
French (fr)
Other versions
WO2004079524A3 (en
Inventor
Alexander J. Somogyi
Original Assignee
Bea Systems Inc.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US10/789,010 external-priority patent/US7353495B2/en
Application filed by Bea Systems Inc. filed Critical Bea Systems Inc.
Publication of WO2004079524A2 publication Critical patent/WO2004079524A2/en
Publication of WO2004079524A3 publication Critical patent/WO2004079524A3/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Definitions

  • the current invention relates generally to global transaction management in application servers, and more particularly to global transaction management between multiple applications in application server systems.
  • Transaction managers in enterprise systems may be used to monitor and manage transactions between resources and applications in application server systems.
  • the transaction manager monitors global transactions and provides servers and resources within an application server system with status and availability information regarding other servers and resources.
  • the transaction manager may be provided by the application sever provided.
  • One such provider of application servers is BEA Systems, of San Jose, California, who provide the Web Logic Server application server system.
  • the WebLogic Server (WLS) Transaction Manager (TM) implements the J2EE JTA specification. This specification is based on the OpenGroup Distributed Transaction Processing Model (DTPM).
  • DTPM OpenGroup Distributed Transaction Processing Model
  • Distributed Transaction Processing Model 100 includes application (App) 110, resource manager (RM) 120, and transaction manager (TM) 130.
  • the TM coordinates two-phase commit (2PC) transactions that involve multiple resources. Resources developed by third parties may be utilized in WLS applications because they adhere to the J2EE standards.
  • the App communicates with the RM using an API such as JDBC (for relational databases) and JMS (for queuing systems).
  • the App controls transaction demarcation using the JTA API.
  • the TM communicates with the RM during 2PC processing using the XA interface, specifically the XAResource interface as defined in the J2EE JTA specification.
  • This interface provides methods for enlisting and delisting a resource in a global transaction, preparing the resource (first phase of 2PC), and committing or rolling back the resource (second phase of 2PC). There are also methods for use in failure recovery (recover), resource comparison (isSameRM) and error processing (forget). [0011]
  • Application components access an RM using the various APIs. These APIs typically utilize a logical connection to the resource. A logical resource connection is often associated with a XAResource instance. Enlistment of a resource in a global transaction entails having the TM associate the unique transaction identifier (Xid) with work that is performed in the resource, and is performed by invoicing the XAResource.startO method on the resource.
  • FIG. 2 illustrates a typical resource enlistment process 200.
  • the App 110 first begins a global transaction at step 210.
  • the App accesses the resource and invokes an update operation on the resource at step 220 using an API specific to the resource. For instance, the App may perform a JDBC update operation.
  • the update operation is invoked on the resource, the resource first makes a call into the TM at step 230 using the Transaction.enlistResource method.
  • the resource passes the TM the XAResource object that the TM needs to utilize in order to perform the transaction enlistment and 2PC processing when the transaction is later committed or rolled back.
  • the TM will invoke XAResource.start on the resource at step 240.
  • the application update is then performed in the resource at step 250 and is associated with the transaction that was specified during the enlistment start method.
  • the resource may invoke the delistResource method on the TM at step 260 to disassociate future operations from the transaction.
  • the TM responds by calling XAResource.end on the resource at step 270.
  • the process 200 of resource enlistment is then complete.
  • a second application may attempt to establish a logical connection with the same resource or attempt a concurrent update to the resource. In such a case, the second connection attempt would fail and result in an exception because to have different transactions simultaneously enlisted with a single logical connection is an XA protocol violation.
  • What is needed is a transaction manager that can manage multiple transaction requests from a resource object, thereby improving the efficiency of global transaction processing.
  • a transaction manager maintains an enlistment data structure used for managing resource object enlistment in global transactions.
  • a transaction manager receives an enlistment request initiated from a resource object. Upon receiving the request, the transaction manager determines if the resource object is already enlisted within the data structure. If the resource object is enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager. After receiving the delistment request from the resource object, the transaction manager is delisted from the enlistment data structure.
  • FIGURE 1 is an illustration of a J2EE Distributed Transaction Processing Model in accordance with the prior art.
  • FIGURE 2 is an illustration of a method for implementing resource enlistment in accordance with the prior art.
  • FIGURE 3 is an illustration of a method for implementing interleaving resource enlistment in accordance with one embodiment of the present invention.
  • FIGURE 4 is an illustration of interleaving resource enlistment synchronization in accordance with one embodiment of the present invention.
  • a transaction manager maintains an enlistment data structure used for managing resource object enlistment.
  • a transaction manager may receive an enlistment request initiated from a resource object. Upon receiving . the request, the transaction manager will determine if the resource object is already enlisted. If the resource object is already enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager.
  • FIG. 3 illustrates a system 300 for implementing interleaving resource enlistment in accordance with one embodiment of the present invention.
  • System 300 includes thread Tl 320, App 321, TM 322, thread T2 330, App 331, resource connection object 340, and XAResource 341.
  • system 300 may be implemented on an application server system.
  • the application server system may be on a single machine or several machines.
  • Apps 321 and 331 may request a service from a resource during a connection involving different types of APIs.
  • the system and methods of the present invention may be implemented using the different types of APIs and their related connection formats, including connections for JDBC and sessions for JMS.
  • Elements 301 through 312 represent communications that comprise the interleaving enlistment process.
  • App 321 makes a call to update a resource at 301.
  • the call is received by resource connection object 340.
  • the request may include a call to a method in the resource object, and may include the passing of parameters to the resource object.
  • the resource connection object 340 places a call to the TM at 302.
  • the call from the resource to the transaction manager may be over an XA protocol interface.
  • the call may include resource object information and may be to a method that enlists resources, such as enlistResource, thus informing the transaction manager that current work performed by the resource is to be associated with the current transaction.
  • the transaction manager enlists the resource in the transaction.
  • the TM will then signal at 304 to the resource to begin processing the call to the resource.
  • an App 331 may make a call 303 to the resource connection object 340.
  • an App may make a call to the resource connection object 340 at some point before or after the call 303 by App 331 as illustrated in FIG. 3.
  • the TM of the interleaving enlistment system 300 will handle the call by the subsequent App call in serial as long as App 321 is already enlisted.
  • the resource connection object places another call to the TM at 302.
  • the enlistment request by thread T2 330 is blocked until the in-progress enlistment of thread Tl completes.
  • the blocked enlistment of thread T2 prevents different transactions enlisted with a logical connection to the same resource at the same time.
  • the resource 341 performs the task requested by App 321 in thread Tl 320.
  • the task involves performing operations of a resource object method called by the application.
  • the resource object initiates delistment.
  • the resource object calls a delist resource method in the transaction manager at 306.
  • Calling the delist resource method on the TM delists the resource from the current transaction.
  • the call to delist the resource includes the transaction ID (XID) as a parameter.
  • the TM makes a call 307 to the resource to end the logical connection associated with the current transaction.
  • the TM calls a XA resource end method on the resource object and provides the XID as a parameter.
  • the resource object may perform a self update such that resource object actions are no longer associated with the XID. Additionally, the resource may provide a result to the application at 309 that requested the resource services.
  • the result may be provided before, after, or during the resource delistment depending upon the particular resource design and implementation of the transaction manager, resource object, and client application.
  • the TM places a call 307 to the XAResource ending the resource's association with the current transaction, the TM makes another call to the XAResource at 308 to initiate the resource to perform work associated with the second thread 330 and corresponding transaction ID.
  • the XAResource then performs work associated with the second thread 330, and delists the resource with the transaction ID in a call 310 to the TM.
  • the TM responds to the delist call 310 by calling the XAResource to indicate that the resource should stop associating work performed with the transaction JO provided at step 308.
  • the XAResource may then provide results at 312 to the application 331 as discussed above with respect to App 321 in step 309.
  • FIG. 4 An illustration of the interleaving resource enlistment synchronization system 400 is illustrated in FIG. 4.
  • the synchronization system 400 includes thread Tl 420, TM 422, thread T2 430, activeXAResource 440, and XAResource 442.
  • each XAResource instance in a server node (only one illustrated in FIG. 4) is wrapped in an object that the TM will use to synchronize concurrent enlistment requests.
  • the TM maintains a collection of these wrapper objects which are checked for each resource enlistment.
  • the TM will first check to see if there is a lock being held on the resource by another thread of control.
  • the lock is granted to the accessor and held until the owner Xid delists the resource.
  • the waiting threads if any, will be signaled once the lock is free. Once free, one of the waiting threads will be granted the lock and will be allowed to proceed with its enlistment. In one embodiment, the waiting thread that requested the resource first will be granted the lock. In another embodiment, some other priority method may be used to determine which thread will be granted the lock, such as threads handling a specific type of application.
  • the collection of wrapped XAResource objects may be periodically processed to remove objects that are no unused or no longer active. In one embodiment, the wrapped XAResource objects is periodically garbage collected to clear state and unused entries.
  • step 401 the TM 422 of the first thread 420 enlists the XAResource 440.
  • the enlistment request is received by ActiveXAResource wrapper 440.
  • thread 420 obtains a lock on the XAResource.
  • the ActiveXAResource wrapper than initiates the start of work by the XAResource 442 at step 403.
  • the TM delists the XAResource.
  • the delist call 404 is received by ActiveXAResource wrapper 440.
  • the wrapper 440 than sends an end call to XAResource 405, thus ending work performed by the XAResource from being associated with thread 420 and releasing the lock on the XAResource.
  • the synchronization of the second thread 430 tasks with the tasks of first thread 420 is illustrated in FIG. 4.
  • the TM 422 enlists the XAResource and obtains the lock to the resource at step 401, any attempted enlist from the second thread 430 is blocked.
  • the enlist attempt at step 402 from thread 430 is blocked as it occurs later in time than the enlist step 401 of thread 420.
  • the lock may be implemented using Java monitor or some similar method. The lock is held until the thread has completed performing operations on the resource.
  • the second thread 430 may obtain the lock at step 406. At this point, the XAResource may begin performing work for the second thread. After the resource is delisted from the transaction ID at step 407, the XAResource work for the second thread ends at step 408 and the lock on the XAResource is released.
  • the transaction manager may maintain an enlistment data structure (EDS) to help manage resource enlistments.
  • EDS enlistment data structure
  • the EDS maintains a mapping of resources and transaction identification information currently in use, including XA resource objects.
  • the transaction manager searches the EDS to determine if the resource is already listed. If the resource is not listed in the EDS, the transaction manager lists the resource in the EDS.
  • a thread associated with an application may call a method on a resource already enlisted in the EDS. h this case, the transaction manager will block the enlistment of the resource. The resource then waits until the enlistment of the resource win the EDS is removed.
  • the transaction manager contains identification information regarding the resource within the EDS at least until the transaction manager receives a signal indicating the resource has generated a result or otherwise completed the service invoked by the initiating application.
  • enlistments of resources are removed at predetermined time intervals. At each time interval, each enlistment is checked to determine if it has not been accessed for at certain period of time. If an enlistment has not been accessed for the certain period of time, it is delisted from the EDS automatically. In another embodiment, the delistment occurs as soon as the resource has been idle (not accessed) for the certain period of time, hi this case, the transaction manager does not wait for the time interval to expire before determining if any resource objects have not been accessed.
  • a transaction manager maintains an enlistment data structure used for managing resource object enlistment.
  • a transaction manager may receive an enlistment request initiated from a resource object. Upon receiving the request, the transaction manager will determine if the resource object is already enlisted. If the resource object is already enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource.
  • the resource object Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager. After receiving the delistment request from the resource object, the transaction manager is delisted from the enlistment data structure.
  • the present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure, as will be apparent to those skilled in the computer art.
  • Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.
  • the invention may also be implemented by the preparation of application specific integrated circuits or by interconnecting an appropriate network of conventional component circuits, as will be readily apparent to those skilled in the art.
  • the present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention.
  • the storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.
  • the present invention includes software for controlling both the hardware of the general purpose/specialized computer or microprocessor, and for enabling the computer or microprocessor to interact with a human user or other mechanism utilizing the results of the present invention.
  • software may include, but is not limited to, device drivers, operating systems, and user applications.
  • Included in the programming (software) of the general/specialized computer or microprocessor are software modules for implementing the teachings of the present invention, including, but not limited to, maintaining an enlistment data structure, managing thread execution calls, and implementing a transaction manager that protects against interleaving transactions.

Abstract

A transaction manager (322) maintains an enlistment data structure used for managing resource object (341) enlistment. A transaction manager may receive an enlistment request (302) initiated from a resource object. Upon receiving the request, the transaction manager will determine if the resource object is already enlisted. If the resource object is already enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service. After the requested task or service is complete, the resource initiates a delistment request (306) to the transaction manager. After receiving the delistment request from the resource, object, the transaction manager is delisted from the enlistment data structure.

Description

PROTECTION AGAINST INTERLEAVING TRANSACTIONS USING A TRANSACTION MANAGER
Claim to Priority
[0001] The present application claims the benefit of priority to the following patent applications which are incorporated herein: [0002] U.S. Provisional Patent Application entitled "TRANSACTION MANAGER FOR PROTECTION AGAINST INTERLEAVING TRANSACTIONS", Application No. 60/451,334, filed on February 28, 2003;
[0003] U.S. Provisional Patent Application entitled "A METHOD FOR PROTECTING AGAINST INTERLEAVING TRANSACTIONS USING A TRANSACTION MANAGER", Application No. 60/451 ,354, filed on February 28, 2003;
[0004] U.S. Patent Application entitled "PROTECTION AGAINST INTERLEAVING TRANSACTIONS USING A TRANSACTION MANAGER," Application No. XX/XXX,XXX, attorney reference number BEAS1338US2, filed on February 27, 2004; and
[0005] U.S. Patent Application entitled "METHOD FOR PROTECTION AGAINST INTERLEAVING TRANSACTIONS USING A TRANSACTION MANAGER", Application No. XX/XXX,XXX, attorney reference number BEAS1338US3, filed on February 27, 2004. Copyright Notice [0006] A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in [0007] the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
Field of the Invention
[0008] The current invention relates generally to global transaction management in application servers, and more particularly to global transaction management between multiple applications in application server systems.
Background of the Invention [0009] Transaction managers in enterprise systems may be used to monitor and manage transactions between resources and applications in application server systems. In particular, the transaction manager monitors global transactions and provides servers and resources within an application server system with status and availability information regarding other servers and resources. [0010] The transaction manager may be provided by the application sever provided. One such provider of application servers is BEA Systems, of San Jose, California, who provide the Web Logic Server application server system. The WebLogic Server (WLS) Transaction Manager (TM) implements the J2EE JTA specification. This specification is based on the OpenGroup Distributed Transaction Processing Model (DTPM). A typical J2EE distributed transaction processing model 100 is depicted in Figure 1. Distributed Transaction Processing Model 100 includes application (App) 110, resource manager (RM) 120, and transaction manager (TM) 130. The TM coordinates two-phase commit (2PC) transactions that involve multiple resources. Resources developed by third parties may be utilized in WLS applications because they adhere to the J2EE standards. The App communicates with the RM using an API such as JDBC (for relational databases) and JMS (for queuing systems). The App controls transaction demarcation using the JTA API. The TM communicates with the RM during 2PC processing using the XA interface, specifically the XAResource interface as defined in the J2EE JTA specification. This interface provides methods for enlisting and delisting a resource in a global transaction, preparing the resource (first phase of 2PC), and committing or rolling back the resource (second phase of 2PC). There are also methods for use in failure recovery (recover), resource comparison (isSameRM) and error processing (forget). [0011] Application components access an RM using the various APIs. These APIs typically utilize a logical connection to the resource. A logical resource connection is often associated with a XAResource instance. Enlistment of a resource in a global transaction entails having the TM associate the unique transaction identifier (Xid) with work that is performed in the resource, and is performed by invoicing the XAResource.startO method on the resource. Subsequent application updates to the resource will be associated with the global transaction. Resource delistment entails having the TM invoke XAResource.end on the resource, which disassociates future application updates on the resource over the logical connection from the previously enlisted Xid. [0012] Figure 2 illustrates a typical resource enlistment process 200. In process 200, the App 110 first begins a global transaction at step 210. The App then accesses the resource and invokes an update operation on the resource at step 220 using an API specific to the resource. For instance, the App may perform a JDBC update operation. When the update operation is invoked on the resource, the resource first makes a call into the TM at step 230 using the Transaction.enlistResource method. The resource passes the TM the XAResource object that the TM needs to utilize in order to perform the transaction enlistment and 2PC processing when the transaction is later committed or rolled back. In response to the enlistResource call, the TM will invoke XAResource.start on the resource at step 240. The application update is then performed in the resource at step 250 and is associated with the transaction that was specified during the enlistment start method. After the application request has been processed, the resource may invoke the delistResource method on the TM at step 260 to disassociate future operations from the transaction. The TM responds by calling XAResource.end on the resource at step 270. The process 200 of resource enlistment is then complete.
[0013] While a first application has a logical connection with a resource, a second application may attempt to establish a logical connection with the same resource or attempt a concurrent update to the resource. In such a case, the second connection attempt would fail and result in an exception because to have different transactions simultaneously enlisted with a single logical connection is an XA protocol violation. [0014] What is needed is a transaction manager that can manage multiple transaction requests from a resource object, thereby improving the efficiency of global transaction processing.
Summary of the Invention
[0015] In one embodiment of the present invention, a transaction manager maintains an enlistment data structure used for managing resource object enlistment in global transactions. A transaction manager receives an enlistment request initiated from a resource object. Upon receiving the request, the transaction manager determines if the resource object is already enlisted within the data structure. If the resource object is enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager. After receiving the delistment request from the resource object, the transaction manager is delisted from the enlistment data structure.
Brief Description of the Drawings [0016] FIGURE 1 is an illustration of a J2EE Distributed Transaction Processing Model in accordance with the prior art.
[0017] FIGURE 2 is an illustration of a method for implementing resource enlistment in accordance with the prior art.
[0018] FIGURE 3 is an illustration of a method for implementing interleaving resource enlistment in accordance with one embodiment of the present invention.
[0019] FIGURE 4 is an illustration of interleaving resource enlistment synchronization in accordance with one embodiment of the present invention.
Detailed Description
[0020] In one embodiment of the present invention, a transaction manager maintains an enlistment data structure used for managing resource object enlistment. A transaction manager may receive an enlistment request initiated from a resource object. Upon receiving . the request, the transaction manager will determine if the resource object is already enlisted. If the resource object is already enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager. After receiving the delistment request from the resource object, the transaction manager is delisted from the enlistment data structure. [0021] FIG. 3 illustrates a system 300 for implementing interleaving resource enlistment in accordance with one embodiment of the present invention. System 300 includes thread Tl 320, App 321, TM 322, thread T2 330, App 331, resource connection object 340, and XAResource 341. In one embodiment, system 300 may be implemented on an application server system. The application server system may be on a single machine or several machines. Apps 321 and 331 may request a service from a resource during a connection involving different types of APIs. The system and methods of the present invention may be implemented using the different types of APIs and their related connection formats, including connections for JDBC and sessions for JMS.
[0022] Elements 301 through 312 represent communications that comprise the interleaving enlistment process. First in the process, App 321 makes a call to update a resource at 301. The call is received by resource connection object 340. The request may include a call to a method in the resource object, and may include the passing of parameters to the resource object. Next, the resource connection object 340 places a call to the TM at 302. In one embodiment, the call from the resource to the transaction manager may be over an XA protocol interface. The call may include resource object information and may be to a method that enlists resources, such as enlistResource, thus informing the transaction manager that current work performed by the resource is to be associated with the current transaction. After receiving the call, the transaction manager enlists the resource in the transaction. Next, the TM will then signal at 304 to the resource to begin processing the call to the resource.
[0023] At some point in the operation of system 300, an App 331 may make a call 303 to the resource connection object 340. In another embodiment, an App may make a call to the resource connection object 340 at some point before or after the call 303 by App 331 as illustrated in FIG. 3. The TM of the interleaving enlistment system 300 will handle the call by the subsequent App call in serial as long as App 321 is already enlisted.
[0024] At 305, the resource connection object places another call to the TM at 302. The enlistment request by thread T2 330 is blocked until the in-progress enlistment of thread Tl completes. The blocked enlistment of thread T2 prevents different transactions enlisted with a logical connection to the same resource at the same time. [0025] Once the resource receives a start signal from the TM at 304, the resource 341 performs the task requested by App 321 in thread Tl 320. In one embodiment, the task involves performing operations of a resource object method called by the application. After a result is obtained for the requested task, the resource object initiates delistment. In one embodiment, the resource object calls a delist resource method in the transaction manager at 306. Calling the delist resource method on the TM delists the resource from the current transaction. In one embodiment, the call to delist the resource includes the transaction ID (XID) as a parameter. In response to the delist resource method call to the TM, the TM makes a call 307 to the resource to end the logical connection associated with the current transaction. In one embodiment, the TM calls a XA resource end method on the resource object and provides the XID as a parameter. After receiving an end call 307 from the TM, the resource object may perform a self update such that resource object actions are no longer associated with the XID. Additionally, the resource may provide a result to the application at 309 that requested the resource services. In another embodiment, the result may be provided before, after, or during the resource delistment depending upon the particular resource design and implementation of the transaction manager, resource object, and client application. [0026] After the TM places a call 307 to the XAResource ending the resource's association with the current transaction, the TM makes another call to the XAResource at 308 to initiate the resource to perform work associated with the second thread 330 and corresponding transaction ID. The XAResource then performs work associated with the second thread 330, and delists the resource with the transaction ID in a call 310 to the TM. The TM responds to the delist call 310 by calling the XAResource to indicate that the resource should stop associating work performed with the transaction JO provided at step 308. The XAResource may then provide results at 312 to the application 331 as discussed above with respect to App 321 in step 309.
[0027] An illustration of the interleaving resource enlistment synchronization system 400 is illustrated in FIG. 4. The synchronization system 400 includes thread Tl 420, TM 422, thread T2 430, activeXAResource 440, and XAResource 442. In one embodiment, each XAResource instance in a server node (only one illustrated in FIG. 4) is wrapped in an object that the TM will use to synchronize concurrent enlistment requests. The TM maintains a collection of these wrapper objects which are checked for each resource enlistment. In one embodiment, for each request to enlist the resource, the TM will first check to see if there is a lock being held on the resource by another thread of control. If not, the lock is granted to the accessor and held until the owner Xid delists the resource. The waiting threads, if any, will be signaled once the lock is free. Once free, one of the waiting threads will be granted the lock and will be allowed to proceed with its enlistment. In one embodiment, the waiting thread that requested the resource first will be granted the lock. In another embodiment, some other priority method may be used to determine which thread will be granted the lock, such as threads handling a specific type of application. The collection of wrapped XAResource objects may be periodically processed to remove objects that are no unused or no longer active. In one embodiment, the wrapped XAResource objects is periodically garbage collected to clear state and unused entries. [0028] The synchronization process of system 400 is illustrated by steps 401 through 408. In step 401, the TM 422 of the first thread 420 enlists the XAResource 440. The enlistment request is received by ActiveXAResource wrapper 440. By enlisting the XAResource via the wrapper, thread 420 obtains a lock on the XAResource. The ActiveXAResource wrapper than initiates the start of work by the XAResource 442 at step 403. Once the XAResource has completed the work performed for thread 420, the TM delists the XAResource. The delist call 404 is received by ActiveXAResource wrapper 440. The wrapper 440 than sends an end call to XAResource 405, thus ending work performed by the XAResource from being associated with thread 420 and releasing the lock on the XAResource. [0029] The synchronization of the second thread 430 tasks with the tasks of first thread 420 is illustrated in FIG. 4. Once the TM 422 enlists the XAResource and obtains the lock to the resource at step 401, any attempted enlist from the second thread 430 is blocked. Thus, the enlist attempt at step 402 from thread 430 is blocked as it occurs later in time than the enlist step 401 of thread 420. In one embodiment, the lock may be implemented using Java monitor or some similar method. The lock is held until the thread has completed performing operations on the resource. After the lock on XAResource 442 is released at step 405, the second thread 430 may obtain the lock at step 406. At this point, the XAResource may begin performing work for the second thread. After the resource is delisted from the transaction ID at step 407, the XAResource work for the second thread ends at step 408 and the lock on the XAResource is released.
[0030] In one embodiment, the transaction manager may maintain an enlistment data structure (EDS) to help manage resource enlistments. The EDS maintains a mapping of resources and transaction identification information currently in use, including XA resource objects. When a resource calls the transaction manager to be enlisted, the transaction manager searches the EDS to determine if the resource is already listed. If the resource is not listed in the EDS, the transaction manager lists the resource in the EDS. In some cases, a thread associated with an application may call a method on a resource already enlisted in the EDS. h this case, the transaction manager will block the enlistment of the resource. The resource then waits until the enlistment of the resource win the EDS is removed.
[0031] The transaction manager contains identification information regarding the resource within the EDS at least until the transaction manager receives a signal indicating the resource has generated a result or otherwise completed the service invoked by the initiating application. In one embodiment, enlistments of resources are removed at predetermined time intervals. At each time interval, each enlistment is checked to determine if it has not been accessed for at certain period of time. If an enlistment has not been accessed for the certain period of time, it is delisted from the EDS automatically. In another embodiment, the delistment occurs as soon as the resource has been idle (not accessed) for the certain period of time, hi this case, the transaction manager does not wait for the time interval to expire before determining if any resource objects have not been accessed. These methods of delistment reduce the number of add an remove operations associated with the EDS and make the transaction monitor more efficient. The idle period and time check interval may be chosen based on the design and operation of the specific application server system as will be understood by those skilled in the art of application server programming. [0032] In one embodiment of the present invention, a transaction manager maintains an enlistment data structure used for managing resource object enlistment. A transaction manager may receive an enlistment request initiated from a resource object. Upon receiving the request, the transaction manager will determine if the resource object is already enlisted. If the resource object is already enlisted, the transaction manager will block the enlistment request. If the resource object is not enlisted, the transaction manger will enlist the resource. Upon enlistment, the resource object will perform a requested task or service and the resource is considered locked. After the requested task or service is complete, the resource initiates a delistment request to the transaction manager. After receiving the delistment request from the resource object, the transaction manager is delisted from the enlistment data structure.
[0033] Other features, aspects and objects of the invention can be obtained from a review of the figures and the claims. It is to be understood that other embodiments of the invention can be developed and fall within the spirit and scope of the invention and claims. [0034] The foregoing description of preferred embodiments of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Obviously, many modifications and variations will be apparent to the practitioner skilled in the art. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others sl lled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence. [0035] In addition to an embodiment consisting of specifically designed integrated circuits or other electronics, the present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure, as will be apparent to those skilled in the computer art. [0036] Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art. The invention may also be implemented by the preparation of application specific integrated circuits or by interconnecting an appropriate network of conventional component circuits, as will be readily apparent to those skilled in the art. [0037] The present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data. [0038] Stored on any one of the computer readable medium (media), the present invention includes software for controlling both the hardware of the general purpose/specialized computer or microprocessor, and for enabling the computer or microprocessor to interact with a human user or other mechanism utilizing the results of the present invention. Such software may include, but is not limited to, device drivers, operating systems, and user applications. [0039] Included in the programming (software) of the general/specialized computer or microprocessor are software modules for implementing the teachings of the present invention, including, but not limited to, maintaining an enlistment data structure, managing thread execution calls, and implementing a transaction manager that protects against interleaving transactions.

Claims

In the Claims:
1. A system for protecting against interleaving transactions, comprising: means for receiving a first resource enlistment request from a resource in a first thread; means for receiving a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and means for performing a block on the second resource enlistment request.
2. A computer-readable medium, comprising: means for receiving a first resource enlistment request from a resource in a first thread; means for receiving a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and means for performing a block on the second resource enlistment request.
3. A computer system comprising: a processor; object code executed by said processor, said object code configured to: receive a first resource enlistment request from a resource in a first thread; receive a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and perform a block on the second resource enlistment request.
4. A computer data signal embodied in a transmission medium, comprising: a code segment including instructions to receive a first resource enlistment request from a resource in a first thread; a code segment including instructions to receive a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and a code segment including instructions to perform a block on the second resource enlistment request.
5. A computer program product for execution by a server computer for protecting against interleaving transactions, comprising: computer code for receiving a first resource enlistment request from a resource in a first thread; computer code for receiving a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and computer code for performing a block on the second resource enlistment request.
6. The computer program product of claim 5, further comprising: computer code for initiating an end method on the first resource in the first thread; and computer code for removing the block on the second resource enlistment request in the second thread.
7. The computer program product of claim 6, further comprising: computer code for initiating a start method on the first resource; computer code for receiving a first resource delistment request from the first resource; computer code for initiating an end method on the first resource.
8. The computer program product of claim 5 wherein computer code for receiving a first resource enlistment request from a resource in a first thread includes: computer code for receiving a first resource enlistment request from a resource in a first thread over an XA protocol interface.
9. The computer program product of claim 5 wherein the first resource enlistment request includes a first transaction identification.
10. The computer program product of claim 7 wherein the first resource delistment request includes a first transaction identification.
11. The computer program product of claim 5 wherein computer code for performing a block on the second resource enlistment request includes: computer code for using Java monitor to block enlistment requests to the resource.
12. A method for processing resource enlistment requests, comprising: receiving a first resource enlistment request from a resource in a first thread; receiving a second resource enlistment request from the resource in a second thread, the second enlistment request received after the first enlistment request is received; and performing a block on the second resource enlistment request.
13. The method of claim 12, further comprising: initiating an end method on the first resource in the first thread; and removing the block on the second resource enlistment request in the second thread.
14. The method of claim 13, further comprising: initiating a start method on the first resource; receiving a first resource delistment request from the first resource; initiating an end method on the first resource.
15. The method of claim 12 wherein receiving a first resource enlistment request from a resource in a first thread includes: receiving a first resource enlistment request from a resource in a first thread over an XA protocol interface.
16. The method of claim 12 wherein the first resource enlistment request includes a first transaction identification.
17. The method of claim 14 wherein the first resource delistment request includes a first transaction identification.
18. The method of claim 12 wherein performing a block on the second resource enlistment request includes: using Java monitor to block enlistment requests to the resource.
PCT/US2004/006073 2003-02-28 2004-03-01 Protection against interleaving transactions using a transaction manager WO2004079524A2 (en)

Applications Claiming Priority (8)

Application Number Priority Date Filing Date Title
US45135403P 2003-02-28 2003-02-28
US45133403P 2003-02-28 2003-02-28
US60/451,354 2003-02-28
US60/451,334 2003-02-28
US10/788,802 2004-02-27
US10/789,010 US7353495B2 (en) 2003-02-28 2004-02-27 Method for protection against interleaving transactions using a transaction manager
US10/788,802 US7849464B2 (en) 2003-02-28 2004-02-27 Protection against interleaving transactions using a transaction manager
US10/789,010 2004-02-27

Publications (2)

Publication Number Publication Date
WO2004079524A2 true WO2004079524A2 (en) 2004-09-16
WO2004079524A3 WO2004079524A3 (en) 2005-01-13

Family

ID=33162151

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2004/006073 WO2004079524A2 (en) 2003-02-28 2004-03-01 Protection against interleaving transactions using a transaction manager

Country Status (2)

Country Link
US (2) US7849464B2 (en)
WO (1) WO2004079524A2 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8074220B2 (en) * 2004-05-21 2011-12-06 Computer Associates Think, Inc. System and method for interfacing an application to a distributed transaction coordinator
US8819215B2 (en) * 2007-01-29 2014-08-26 Nokia Corporation System, methods, apparatuses and computer program products for providing step-ahead computing
US9588810B2 (en) * 2007-08-08 2017-03-07 Microsoft Technology Licensing, Llc Parallelism-aware memory request scheduling in shared memory controllers
US8849780B2 (en) * 2009-11-02 2014-09-30 Sap Ag System and method for automation of consistent lock management
US20120278294A1 (en) * 2011-04-29 2012-11-01 Siemens Product Lifecycle Management Software Inc. Selective locking of object data elements
US8539490B2 (en) * 2011-07-21 2013-09-17 Oracle International Corporation System and method for providing dynamic transaction optimizations
US9396227B2 (en) * 2012-03-29 2016-07-19 Hewlett Packard Enterprise Development Lp Controlled lock violation for data transactions
US8738878B2 (en) 2012-04-02 2014-05-27 Apple Inc. Lock-free object recycling
US9442971B2 (en) 2013-04-17 2016-09-13 International Business Machines Corporation Weighted transaction priority based dynamically upon phase of transaction completion
US9990239B2 (en) 2014-09-16 2018-06-05 Oracle International Corporation System and method for supporting cooperative notification offloading in a distributed data grid
US9940269B2 (en) * 2016-01-22 2018-04-10 International Business Machines Corporation Conditionally releasing locks in response to requests
US10331500B2 (en) * 2017-04-05 2019-06-25 Cavium, Llc Managing fairness for lock and unlock operations using operation prioritization
US11455644B2 (en) 2017-11-03 2022-09-27 Microsoft Technology Licensing, Llc Dynamic governance of exposing inquiries and notifications at client devices
US11347712B2 (en) 2017-11-07 2022-05-31 International Business Machines Corporation Preventing long running transactions from holding record locks
US10997013B2 (en) 2018-12-10 2021-05-04 Microsoft Technology Licensing, Llc Systems and methods of analyzing user responses to inquiries to diagnose and mitigate reported performance issues on a client device
US10929186B2 (en) * 2018-12-12 2021-02-23 Servicenow, Inc. Control token and hierarchical dynamic control

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6052731A (en) * 1997-07-08 2000-04-18 International Business Macines Corp. Apparatus, method and computer program for providing arbitrary locking requesters for controlling concurrent access to server resources
US6157927A (en) * 1998-04-22 2000-12-05 Unisys Corporation Methods and apparatus for enabling a component in a first transaction processing environment to access a resource in another environment that is under the control of an Xatmi complaint transaction manager
US6275863B1 (en) * 1999-01-25 2001-08-14 International Business Machines Corp. System and method for programming and executing long running transactions
US20020087366A1 (en) * 2000-12-30 2002-07-04 Collier Timothy R. Tentative-hold-based protocol for distributed transaction processing
US20020194244A1 (en) * 2001-06-01 2002-12-19 Joan Raventos System and method for enabling transaction-based service utilizing non-transactional resources

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5095421A (en) * 1989-08-17 1992-03-10 International Business Machines Corporation Transaction processing facility within an operating system environment
US5465363A (en) * 1993-12-30 1995-11-07 Orton; Debra L. Wrapper system for enabling a non-multitasking application to access shared resources in a multitasking environment
JP3497886B2 (en) * 1994-05-10 2004-02-16 富士通株式会社 Server data linking device
US7076784B1 (en) * 1997-10-28 2006-07-11 Microsoft Corporation Software component execution management using context objects for tracking externally-defined intrinsic properties of executing software components within an execution environment
US6105057A (en) * 1998-01-28 2000-08-15 Ericsson Inc. Method and apparatus for manipulating mutexes on network assets
US6360243B1 (en) * 1998-03-10 2002-03-19 Motorola, Inc. Method, device and article of manufacture for implementing a real-time task scheduling accelerator
US6272675B1 (en) * 1998-10-01 2001-08-07 Unisys Corporation Development system for automatically enabling a server application to execute with an XATMI-compliant transaction manager managing transactions within multiple environments
US6470342B1 (en) * 1999-03-12 2002-10-22 Compaq Computer Corporation Process of maintaining a distributed map of transaction identifiers and using hashing to access these maps
US6754696B1 (en) * 1999-03-25 2004-06-22 Micosoft Corporation Extended file system
US7206805B1 (en) * 1999-09-09 2007-04-17 Oracle International Corporation Asynchronous transcription object management system
US6865549B1 (en) * 1999-11-15 2005-03-08 Sun Microsystems, Inc. Method and apparatus for concurrency control in a policy-based management system
US6856993B1 (en) * 2000-03-30 2005-02-15 Microsoft Corporation Transactional file system
US20010049726A1 (en) * 2000-06-02 2001-12-06 Guillaume Comeau Data path engine
US6883172B1 (en) * 2001-03-29 2005-04-19 Microsoft Corporation System and method for bridging managed and unmanaged object systems by utilizing an interface wrapper to facilitate transparent communications
US7831974B2 (en) * 2002-11-12 2010-11-09 Intel Corporation Method and apparatus for serialized mutual exclusion
US20040153349A1 (en) * 2003-01-31 2004-08-05 K. Venugopal Rao Delayed creation of global transactions
US7383336B2 (en) * 2003-04-24 2008-06-03 International Business Machines Corporation Distributed shared resource management
US7640545B2 (en) * 2003-07-14 2009-12-29 Sun Microsytems, Inc. Transaction manager freezing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6052731A (en) * 1997-07-08 2000-04-18 International Business Macines Corp. Apparatus, method and computer program for providing arbitrary locking requesters for controlling concurrent access to server resources
US6157927A (en) * 1998-04-22 2000-12-05 Unisys Corporation Methods and apparatus for enabling a component in a first transaction processing environment to access a resource in another environment that is under the control of an Xatmi complaint transaction manager
US6275863B1 (en) * 1999-01-25 2001-08-14 International Business Machines Corp. System and method for programming and executing long running transactions
US20020087366A1 (en) * 2000-12-30 2002-07-04 Collier Timothy R. Tentative-hold-based protocol for distributed transaction processing
US20020194244A1 (en) * 2001-06-01 2002-12-19 Joan Raventos System and method for enabling transaction-based service utilizing non-transactional resources

Also Published As

Publication number Publication date
US20040210899A1 (en) 2004-10-21
US7849464B2 (en) 2010-12-07
WO2004079524A3 (en) 2005-01-13
US20110078687A1 (en) 2011-03-31
US8327375B2 (en) 2012-12-04

Similar Documents

Publication Publication Date Title
US8327375B2 (en) System and method for supporting resource enlistment synchronization
US20080134182A1 (en) Computer readable storage medium for protection against interleaving transactions using a transaction manager
US6988099B2 (en) Systems and methods for maintaining transactional persistence
US8375359B2 (en) Parallel transaction execution with a thread pool
US7529818B2 (en) System and method for performing validation of a configuration
US7660824B2 (en) System and method for performing batch configuration changes
US8984170B2 (en) Idempotence for database transactions
US6832238B1 (en) Local transaction management
US5095421A (en) Transaction processing facility within an operating system environment
US6728958B1 (en) Volatile resource manager with pre-prepare notification
US6266698B1 (en) Logging of transaction branch information for implementing presumed nothing and other protocols
US20040158549A1 (en) Method and apparatus for online transaction processing
JP2002324047A (en) Method and system for automated session resources cleanup in distributed client/server environment
JPH08272725A (en) System and method for judgment and operation of constituent conformation of server in distributed object environment
JP2010157202A (en) Distributed transaction recovery system and method
US7702957B2 (en) Systems and methods for timer service
WO1996039659A1 (en) Synchronisation procedure in a routing node
US6807547B2 (en) Method and apparatus for implementing timers for enterprise javabean components
US20040045008A1 (en) J2ee connector architecture
JP2001056767A (en) Method for cleaning up internal state by using transaction service synchronous interface
US9984096B2 (en) System and method for reducing communications overhead in a distributed transactions environment by modifying implementation of the transaction start function
CN112685142A (en) Distributed data processing system
JP2001306380A (en) Two-phase commitment evading system and its program recording medium
JP3760749B2 (en) Connection management method, computer system, and computer-readable recording medium recording a program for realizing the method
WO2004068294A2 (en) Transaction processing with parallel execution

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BW BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE EG ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NA NI NO NZ OM PG PH PL PT RO RU SC SD SE SG SK SL SY TJ TM TN TR TT TZ UA UG US UZ VC VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): BW GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IT LU MC NL PL PT RO SE SI SK TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
122 Ep: pct application non-entry in european phase