A method, system, device and storage medium for implementing a distributed business lock
By providing shared and exclusive locks on top of Redisson distributed locks, and supporting multiple levels of scope and duration, the problem of resource concurrency control in distributed systems is solved, and resource consistency and business logic consistency are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR GENERSOFT CO LTD
- Filing Date
- 2022-10-31
- Publication Date
- 2026-07-03
AI Technical Summary
In distributed systems, existing technologies struggle to effectively address business concurrency issues, especially in scenarios such as financial auditing. Concurrency control of multiple users accessing documents simultaneously makes it difficult to guarantee resource consistency, and the granularity of database locking mechanisms is insufficient to meet business requirements.
Building upon Redisson's distributed locks, it provides shared and exclusive locks, supporting application-level, session-level, and business context-level scopes and lock durations. Locking operations are determined by querying lock data and judging lock validity.
It enables effective control of resources in a distributed system, ensures resource consistency at any given time, supports read and write operations by multiple threads, and improves the consistency of business logic.
Smart Images

Figure CN115640140B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed systems, and more specifically, to a method, system, device, and storage medium for implementing distributed business locks. Background Technology
[0002] In distributed systems, high concurrency issues are common. For example, with financial audit documents, multiple auditors with the same permissions can see the same document, but only one auditor can audit it at a time. To ensure business logic consistency, the document must be locked when the auditor opens it, and auditing is only allowed after successful locking. Many similar scenarios with potential concurrency issues require locking to control resources and ensure consistency. Furthermore, while database locking mechanisms effectively address data inconsistency under concurrency, their locking granularity is relatively small, such as row-level locks. Business concurrency control typically requires locks with a larger granularity than data rows; for example, a lock on a view button might be applied to a financial audit document. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a method, system, computer device, and computer-readable storage medium for implementing distributed business locks. Based on the Redisson distributed lock, this invention provides shared locks and exclusive locks to realize the functions of distributed shared locks and distributed exclusive locks. It also supports setting the scope of shared locks and exclusive locks at the application level, session level, and business context level, as well as supporting setting the duration of the lock. The effective scope of the lock is determined according to the scope and duration of the lock.
[0004] To achieve the above objectives, one aspect of the present invention provides a method for implementing a distributed business lock, comprising the following steps: in response to receiving a request to call a locking interface to add a distributed exclusive lock or a distributed shared lock to a resource, using Redisson to add a distributed lock to the resource; in response to the successful addition of the Redisson distributed lock, querying whether other lock data exists; in response to the absence of other lock data, directly adding a distributed exclusive lock or a distributed shared lock to the resource; and in response to the presence of other lock data, determining whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data.
[0005] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data includes: determining whether the lock has expired based on the lock's duration; in response to the lock having expired, deleting the lock data from the storage table and applying a distributed exclusive lock or a distributed shared lock to the resource; and in response to the lock not having expired, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope.
[0006] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: not applying a distributed exclusive lock if the scope is application-level; determining whether to apply a distributed exclusive lock to the resource based on the session requesting the lock and the session with the existing lock if the scope is session-level; and determining whether to apply a distributed exclusive lock to the resource based on the business context of the lock request and the business context of the existing lock if the scope is business context-level.
[0007] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: responding to an application-level scope by determining whether to apply a distributed shared lock to the resource based on the type of existing lock; responding to a session-level scope by determining whether to apply a distributed shared lock to the resource based on the session of the lock request and the session of the existing lock; and responding to a business context-level scope by determining whether to apply a distributed shared lock to the resource based on the business context of the lock request and the business context of the existing lock.
[0008] In another aspect, this invention provides a system for implementing distributed business locks, comprising: a pre-locking module configured to, in response to receiving a request to call a locking interface to add a distributed exclusive lock or a distributed shared lock to a resource, use Redisson to add a distributed lock to the resource; a querying module configured to, in response to a successful Redisson distributed lock addition, query whether other lock data exists; a locking module configured to, in response to the absence of other lock data, directly add a distributed exclusive lock or a distributed shared lock to the resource; and an execution module configured to, in response to the presence of other lock data, determine whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data.
[0009] In some implementations, the execution module is configured to: determine whether the lock has expired based on the lock's duration; in response to the lock having expired, delete the lock data from the storage table and perform a distributed exclusive lock or distributed shared lock operation on the resource; and in response to the lock not having expired, determine whether to perform a distributed exclusive lock or distributed shared lock operation on the resource based on the lock's scope.
[0010] In some implementations, the execution module is configured to: not perform the operation of acquiring a distributed exclusive lock in response to an application-level scope; determine whether to perform the operation of acquiring a distributed exclusive lock on the resource based on the session of the lock request and the session of the existing lock in response to a session-level scope; and determine whether to perform the operation of acquiring a distributed exclusive lock on the resource based on the business context of the lock request and the business context of the existing lock in response to a business context.
[0011] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: responding to an application-level scope by determining whether to apply a distributed shared lock to the resource based on the type of existing lock; responding to a session-level scope by determining whether to apply a distributed shared lock to the resource based on the session of the lock request and the session of the existing lock; and responding to a business context-level scope by determining whether to apply a distributed shared lock to the resource based on the business context of the lock request and the business context of the existing lock.
[0012] In another aspect of the present invention, a computer device is provided, comprising: at least one processor; and a memory storing computer instructions executable on the processor, the instructions, when executed by the processor, implementing the steps of the method described above.
[0013] In another aspect, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method steps.
[0014] This invention has the following beneficial technical effects: it provides shared locks and exclusive locks on the basis of Redisson distributed locks, thereby realizing the functions of distributed shared locks and distributed exclusive locks. It also supports setting the scope of shared locks and exclusive locks at the application level, session level, and business context level, and supports setting the duration of locks. The effective scope of the lock is determined according to the scope and duration of the lock. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.
[0016] Figure 1 A schematic diagram illustrating an embodiment of the method for implementing a distributed business lock provided by the present invention;
[0017] Figure 2 A schematic diagram of an embodiment of the system for implementing distributed business locks provided by the present invention;
[0018] Figure 3 A schematic diagram of the hardware structure of an embodiment of a computer device for implementing a distributed business lock provided by the present invention;
[0019] Figure 4 This is a schematic diagram of an embodiment of a computer storage medium for implementing a distributed business lock provided by the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.
[0021] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.
[0022] In a first aspect, an embodiment of a method for implementing a distributed business lock is proposed. Figure 1 The diagram shown is a schematic representation of an embodiment of the method for implementing distributed business locks provided by the present invention. Figure 1 As shown, the embodiments of the present invention include the following steps:
[0023] S1. In response to receiving a request to call the locking interface to add a distributed exclusive lock or a distributed shared lock to the resource, use Redisson to add a distributed lock to the resource;
[0024] S2. In response to the successful acquisition of the Redisson distributed lock, query whether there is any other lock data;
[0025] S3. In response to the absence of other lock data, directly add a distributed exclusive lock or a distributed shared lock to the resource; and
[0026] S4. In response to the existence of other lock data, determine whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock on the resource based on the duration and scope of the other lock data.
[0027] Configure the scope of each lock, including application level, session level, and business context level. When calling the locking interface to lock a resource, you can pass the lock's scope, which includes the following types:
[0028]
[0029] Upon receiving a request to add a distributed exclusive lock or a distributed shared lock to a resource via the locking interface, a distributed lock is added to the resource using Redisson. If the Redisson distributed lock is successfully added, a query is performed to check if any other lock data exists. If no other lock data exists, a distributed exclusive lock or a distributed shared lock is directly added to the resource.
[0030] When using the locking interface to acquire a distributed exclusive lock on a resource, the distributed exclusive lock first uses Redisson to acquire the distributed lock on the resource. If the Redisson distributed lock acquires the lock successfully, it then checks the storage lock table (denoted as gsplock) to see if there are any other valid locks for the resource. The logic for checking valid locks is: does the gsplock table contain lock data for the resource? If no data is found, it indicates that no locks exist for the resource, and it can be locked directly. Similarly, when using the locking interface to acquire a distributed shared lock on a resource, the distributed shared lock first uses Redisson to acquire the distributed lock on the resource. If the Redisson distributed lock acquires the lock successfully, it then checks the storage lock table (denoted as gsplock) to see if there are any other valid locks for the resource. The logic for checking valid locks is: does the gsplock table contain lock data for the resource? If no data is found, it indicates that no locks exist for the resource, and it can be locked directly.
[0031] In response to the existence of other lock data, determine whether to perform a distributed exclusive lock or a distributed shared lock operation on the resource based on the duration and scope of the other lock data.
[0032] This invention supports distributed exclusive locks to ensure that only one thread is allowed to write to a resource at a time. This invention also supports distributed shared locks to ensure that multiple threads are allowed to read from a resource at the same time.
[0033] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data includes: determining whether the lock has expired based on its duration; in response to the lock having expired, deleting the lock data from the storage table and applying a distributed exclusive lock or a distributed shared lock to the resource; and in response to the lock not having expired, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope. If lock data exists, further determining whether the lock has expired based on its duration; if expired, the lock data can be deleted from the gsplock table, and then the resource can be re-locked; if the existing lock has not expired and is still valid, then determining based on the lock's scope.
[0034] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: not applying a distributed exclusive lock if the scope is application-level; determining whether to apply a distributed exclusive lock to the resource based on the session requesting the lock and the session with the existing lock if the scope is session-level; and determining whether to apply a distributed exclusive lock to the resource based on the business context of the lock request and the business context of the existing lock if the scope is business context-level.
[0035] If the scope is at the application level, regardless of whether the existing lock is an exclusive lock or a shared lock, the resource cannot be locked again. If the scope is at the session level, it is determined whether the session requesting the lock is consistent with the session of the existing lock and whether the session of the existing lock has expired. If the session requesting the lock is inconsistent with the session of the existing lock (i.e., they are not the same session) and the session of the existing lock has expired, the resource can be re-locked; otherwise, it cannot be locked. If the scope level is at the business context level, it is determined whether the business context of the lock request is consistent with the business context of the existing lock and whether the business context of the existing lock has expired. If the business context of the lock request is inconsistent with the business context of the existing lock (i.e., they are not the same business context) and the business context of the existing lock has expired, the resource can be re-locked; otherwise, it cannot be locked.
[0036] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: responding to an application-level scope by determining whether to apply a distributed shared lock to the resource based on the type of existing lock; responding to a session-level scope by determining whether to apply a distributed shared lock to the resource based on the session of the lock request and the session of the existing lock; and responding to a business context-level scope by determining whether to apply a distributed shared lock to the resource based on the business context of the lock request and the business context of the existing lock.
[0037] If the scope is application-level, determine the lock type. If it's an exclusive lock, the resource cannot be locked further; if it's a shared lock, the resource can be locked. If the scope is session-level, check if the session requesting the lock matches the existing lock's session and if the existing lock's session has expired. If the requesting session and the existing lock's session are different (not the same session) and the existing lock's session has expired, the resource can be locked. If the requesting session matches the existing lock's session or the existing lock's session hasn't expired, determine if the lock is exclusive or shared. If it's exclusive, the resource cannot be locked; if it's shared... A lock can be used to lock resources. If the scope is at the business context level, it checks whether the business context of the lock request is consistent with the business context of the existing lock and whether the business context of the existing lock has expired. If the business context of the lock request is inconsistent with the business context of the existing lock (i.e., they are not the same business context) and the business context of the existing lock has expired, then the resource can be locked. If the business context of the lock request is consistent with the business context of the existing lock or the business context of the existing lock has not expired, it checks whether the existing lock is an exclusive lock or a shared lock. If it is an exclusive lock, the resource cannot be locked; if it is a shared lock, the resource can be locked.
[0038] It should be noted that the steps in each embodiment of the above-described method for implementing distributed business locks can be interleaved, substituted, added, or deleted. Therefore, these reasonable permutations and combinations of the method for implementing distributed business locks should also fall within the protection scope of this invention, and the protection scope of this invention should not be limited to the embodiments.
[0039] Based on the above objectives, a second aspect of this invention proposes a system for implementing distributed business locks. For example... Figure 2As shown, system 200 includes the following modules: a pre-locking module, configured to, in response to a request to call the locking interface to add a distributed exclusive lock or a distributed shared lock to a resource, use Redisson to add a distributed lock to the resource; a query module, configured to, in response to a successful Redisson distributed lock addition, query whether there is other lock data; a locking module, configured to, in response to the absence of other lock data, directly add a distributed exclusive lock or a distributed shared lock to the resource; and an execution module, configured to, in response to the presence of other lock data, determine whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data.
[0040] In some implementations, the execution module is configured to: determine whether the lock has expired based on the lock's duration; in response to the lock having expired, delete the lock data from the storage table and perform a distributed exclusive lock or distributed shared lock operation on the resource; and in response to the lock not having expired, determine whether to perform a distributed exclusive lock or distributed shared lock operation on the resource based on the lock's scope.
[0041] In some implementations, the execution module is configured to: not perform the operation of acquiring a distributed exclusive lock in response to an application-level scope; determine whether to perform the operation of acquiring a distributed exclusive lock on the resource based on the session of the lock request and the session of the existing lock in response to a session-level scope; and determine whether to perform the operation of acquiring a distributed exclusive lock on the resource based on the business context of the lock request and the business context of the existing lock in response to a business context.
[0042] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: responding to an application-level scope by determining whether to apply a distributed shared lock to the resource based on the type of existing lock; responding to a session-level scope by determining whether to apply a distributed shared lock to the resource based on the session of the lock request and the session of the existing lock; and responding to a business context-level scope by determining whether to apply a distributed shared lock to the resource based on the business context of the lock request and the business context of the existing lock.
[0043] Based on the above objectives, a third aspect of the present invention provides a computer device, comprising: at least one processor; and a memory storing computer instructions executable by the processor to perform the following steps: S1, in response to receiving a request to call a locking interface to add a distributed exclusive lock or a distributed shared lock to a resource, using Redisson to add a distributed lock to the resource; S2, in response to the successful addition of the Redisson distributed lock, querying whether other lock data exists; S3, in response to the absence of other lock data, directly adding a distributed exclusive lock or a distributed shared lock to the resource; and S4, in response to the presence of other lock data, determining whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data.
[0044] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data includes: determining whether the lock has expired based on the lock's duration; in response to the lock having expired, deleting the lock data from the storage table and applying a distributed exclusive lock or a distributed shared lock to the resource; and in response to the lock not having expired, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope.
[0045] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: not applying a distributed exclusive lock if the scope is application-level; determining whether to apply a distributed exclusive lock to the resource based on the session requesting the lock and the session with the existing lock if the scope is session-level; and determining whether to apply a distributed exclusive lock to the resource based on the business context of the lock request and the business context of the existing lock if the scope is business context-level.
[0046] In some implementations, determining whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope includes: responding to an application-level scope by determining whether to apply a distributed shared lock to the resource based on the type of existing lock; responding to a session-level scope by determining whether to apply a distributed shared lock to the resource based on the session of the lock request and the session of the existing lock; and responding to a business context-level scope by determining whether to apply a distributed shared lock to the resource based on the business context of the lock request and the business context of the existing lock.
[0047] like Figure 3 The diagram shown is a hardware structure schematic of an embodiment of the computer device for implementing distributed business locks provided by the present invention.
[0048] For example Figure 3 Taking the device shown as an example, the device includes a processor 301 and a memory 302.
[0049] Processor 301 and memory 302 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0050] The memory 302, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the method for implementing a distributed service lock in the embodiments of this application. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 302, thereby implementing the method for implementing a distributed service lock.
[0051] Memory 302 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the method for implementing distributed business locks, etc. Furthermore, memory 302 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 302 may optionally include memory remotely located relative to processor 301, and these remote memories can be connected to the local module via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0052] One or more methods for implementing distributed business locks are stored in memory 302. When executed by processor 301, the method for implementing distributed business locks in any of the above method embodiments is executed.
[0053] Any embodiment of the computer device that performs the above-described method for implementing distributed business locks can achieve the same or similar effects as any of the aforementioned method embodiments.
[0054] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a method for implementing a distributed business lock.
[0055] like Figure 4 The diagram shown is a schematic representation of an embodiment of the computer storage medium for implementing distributed service locks provided by the present invention. Figure 4Taking the computer storage medium shown as an example, the computer-readable storage medium 401 stores a computer program 402 that, when executed by a processor, performs the above method.
[0056] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program for implementing the distributed service lock method can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium for the program can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. The above computer program embodiments can achieve the same or similar effects as any of the corresponding foregoing method embodiments.
[0057] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.
[0058] It should be understood that, as used herein, the singular form “a” is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, “and / or” refers to any and all possible combinations of one or more of the associated listed items.
[0059] The embodiment numbers disclosed in the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0060] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0061] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.
Claims
1. A method of implementing a distributed business lock, characterized by, Includes the following steps: In response to a request to add a distributed exclusive lock or a distributed shared lock to a resource by calling the locking interface, Redisson is used to add a distributed lock to the resource. In response to the successful acquisition of the Redisson distributed lock, check if there are other lock data. In response to the absence of other lock data, a distributed exclusive lock or a distributed shared lock is directly applied to the resource; as well as In response to the existence of other lock data, determine whether to perform the operation of acquiring a distributed exclusive lock or a distributed shared lock on the resource based on the duration and scope of the other lock data; The step of determining whether to acquire a distributed exclusive lock or a distributed shared lock on the resource based on the duration and scope of the other lock data includes: Determine whether the lock has expired based on its duration; In response to the lock becoming invalid, the lock data is deleted from the storage table, and a distributed exclusive lock or a distributed shared lock is acquired on the resource. In response to the lock not being invalid, determine whether to perform the operation of adding a distributed exclusive lock or a distributed shared lock on the resource based on the scope of the lock; The step of determining whether to acquire a distributed exclusive lock or a distributed shared lock based on the scope of the lock includes: In response to an application-level scope, the operation of acquiring a distributed exclusive lock is not performed; In response to a session-level scope, determine whether to perform a distributed exclusive lock operation on the resource based on the session requesting the lock and the sessions with existing locks; and In response to a scope at the business context level, determine whether to perform a distributed exclusive lock operation on the resource based on the business context of the lock request and the business context of the existing lock; The step of determining whether to acquire a distributed exclusive lock or a distributed shared lock based on the scope of the lock includes: In response to the application-level scope, the system determines whether to perform a distributed shared lock operation on the resource based on the type of lock that exists. In response to a session-level scope, determine whether to perform a distributed shared lock operation on the resource based on the session requesting the lock and the sessions with existing locks; and In response to a scope at the business context level, the system determines whether to perform a distributed shared lock operation on the resource based on the business context of the lock request and the business context of the existing lock.
2. A system for implementing distributed business locks, characterized in that, include: The pre-locking module is configured to, in response to a request to call the locking interface to add a distributed exclusive lock or a distributed shared lock to a resource, use Redisson to add a distributed lock to the resource. The query module is configured to query whether other lock data exists in response to a successful acquisition of a Redisson distributed lock. The locking module is configured to directly add a distributed exclusive lock or a distributed shared lock to the resource in response to the absence of other lock data. as well as An execution module is configured to, in response to the existence of other lock data, determine whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the duration and scope of the other lock data; the execution module is configured to: determine whether the lock has expired based on the lock's duration; in response to the lock having expired, delete the lock data from the storage table and apply a distributed exclusive lock or a distributed shared lock to the resource; in response to the lock not having expired, determine whether to apply a distributed exclusive lock or a distributed shared lock to the resource based on the lock's scope; the execution module is configured to: not apply a distributed exclusive lock in response to an application-level scope; and determine whether to apply a distributed exclusive lock to the resource in response to a session-level scope based on the session requesting the lock and the session with the existing lock. Furthermore, in response to a scope at the business context level, the execution module determines whether to perform a distributed exclusive lock operation on the resource based on the business context of the lock request and the business context of the existing lock; the execution module is configured to: in response to a scope at the application level, determine whether to perform a distributed shared lock operation on the resource based on the type of the existing lock; and in response to a scope at the session level, determine whether to perform a distributed shared lock operation on the resource based on the session of the lock request and the session of the existing lock. In addition, in response to a scope at the business context level, it determines whether to perform a distributed shared lock operation on the resource based on the business context of the lock request and the business context of the existing lock.
3. A computer device, characterized in that, include: At least one processor; as well as A memory storing computer instructions executable on the processor, which, when executed by the processor, implement the steps of the method of claim 1.
4. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 1.