Concurrent lock processing method and device

By introducing the concurrent lock processing method into the NGCRM system and using multi-level lock types and lock rule structure trees for verification, the problem of concurrent processing conflicts caused by insufficient verification between businesses in the existing system is solved, and the control of concurrent businesses is realized. Effective control and regular processing.

CN118819876APending Publication Date: 2024-10-22CHINA MOBILE GRP GUANGDONG CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410542835.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

The existing NGCRM system lacks a verification mechanism between businesses. As a result, two mutually exclusive or dependent businesses may be submitted successfully at the same time, violating business rules and creating the risk of concurrent processing conflicts.

Method used

Introduce a concurrent lock processing method, and verify whether there are conflicts in concurrent lock requests through multi-level lock types and lock rule structure trees to prevent multiple transactions of the same type from being submitted at the same time in a short period of time.

Benefits of technology

It effectively avoids business conflicts, ensures the order and regularity of business processing, and prevents violations in concurrent processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819876A_ABST
    Figure CN118819876A_ABST
Patent Text Reader

Abstract

The invention provides a concurrent lock processing method and device.The method comprises the steps that when the request type of a concurrent lock request is a locking request, lock type information in the locking request is compared with lock type information in a plurality of lock rule structure trees, and a first comparison result is obtained; comparing lock type information in lock record information of the user number with lock type information in a plurality of lock rule structure trees to obtain a second comparison result; and returning a concurrent lock processing result according to the first comparison result and the second comparison result. A service concurrency lock verification process is introduced between verification and submission of each service, so that control on the concurrency service is realized, and the problem of service conflict is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a concurrent lock processing method, device, electronic device and storage medium. Background Art

[0002] The existing NGCRM system adopts a multi-host cluster architecture. The business front desk, mobile APP, and first-level boss channels support concurrent business processing. Each business is processed independently, and the business processing does not affect each other. That is, the same user number can initiate business processing requests from the business front desk, mobile APP, first-level boss channels, etc. at the same time. After the business relationship verification is passed, the business can be submitted at the same time. Each business will only verify the business data stored in the database, and cannot verify another business being processed.

[0003] At present, the NGCRM system lacks a verification mechanism between businesses, so two mutually exclusive or dependent businesses may be submitted successfully. Therefore, the existing host cluster business concurrent processing solution has the risk of violating business rules by processing mutually exclusive businesses at the same time, or unsubscribing the dependent business while processing the dependent business. Summary of the invention

[0004] The present application aims to solve one of the technical problems in the related art at least to some extent.

[0005] The first embodiment of the present application proposes a concurrent lock processing method, including:

[0006] Obtaining a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtaining lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to multiple levels of lock types;

[0007] Determine whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure in the preset multiple lock rule structures;

[0008] In the case where the first lock identifier exists, obtaining first target lock identifiers corresponding to all nodes of a first subtree with the first lock identifier as a root node in a lock rule structure tree where the first lock identifier is located; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between lock identifiers corresponding to multi-level lock types, the lock rule structure tree includes at least one layer of the multi-level lock types, and the lock rule structure tree includes at least one layer of the multi-level lock types;

[0009] Obtain lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier that is identical to the lock identifier in the lock record information in the multiple lock rule structure trees; and if the second lock identifier exists, obtain second target lock identifiers corresponding to all nodes of a second subtree with the second lock identifier as a root node in the lock rule structure tree where the second lock identifier is located;

[0010] Based on the comparison result of the first target lock identifier and the second target lock identifier, a concurrent lock processing result is returned.

[0011] In some implementations, the determining whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree includes:

[0012] Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type;

[0013] Based on the lock identifier of the current level lock type, the multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

[0014] In some implementations, the determining whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees includes:

[0015] For each lock identifier in the lock record information, the multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

[0016] In some implementations, the first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; and based on a comparison result of the first target lock identifier and the second target lock identifier, returning a concurrent lock processing result includes:

[0017] Determine whether the first array and the second array have the same lock identifier;

[0018] When the same lock identifier exists in the first array and the second array, a processing result indicating that the concurrent lock check fails is returned.

[0019] In some implementations, the method further includes:

[0020] When it is determined that there is no first lock identifier identical to the lock identifier of any level in the multi-level lock type structure tree in the multiple lock rule structures, a processing result indicating that locking is not required is returned.

[0021] In some implementations, the method further includes:

[0022] When it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check is passed is returned.

[0023] In some implementations, the method further includes:

[0024] When the request type of the concurrent lock request is a lock release request, obtaining a random code in the lock release request; wherein the random code is generated based on the lock request;

[0025] The lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs is cleared.

[0026] In some implementations, the method further includes:

[0027] At different stages of processing the locking request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the locking request.

[0028] The second aspect of the present application provides a concurrent lock processing device, including:

[0029] A request access module, used to obtain a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtain the lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to each of the multiple levels of lock types;

[0030] A lock identifier traversal module, used to determine whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type in the preset multiple lock rule structure trees; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between the lock identifiers corresponding to the multi-level lock types, the lock rule structure tree includes at least one level in the multi-level lock type, and the lock rule structure tree includes at least one level in the multi-level lock type;

[0031] The lock identifier traversal module is further configured to, when the first lock identifier exists, obtain first target lock identifiers corresponding to all nodes of a first subtree with the first lock identifier as a root node in a lock rule structure tree where the first lock identifier is located;

[0032] a lock record traversal module, configured to obtain lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; and if the second lock identifier exists, obtain the second target lock identifiers corresponding to all nodes of the second subtree with the second lock identifier as the root node in the lock rule structure tree where the second lock identifier is located;

[0033] The conflict judgment module is used to return a concurrent lock processing result based on a comparison result of the first target lock identifier and the second target lock identifier.

[0034] In some implementations, when the lock identifier traversal module determines whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures, it is specifically configured to:

[0035] Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type;

[0036] Based on the lock identifier of the current level lock type, the multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

[0037] In some implementations, when determining whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees, the lock record traversal module is specifically configured to:

[0038] For each lock identifier in the lock record information, the multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

[0039] In some implementations, the first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; when the conflict judgment module returns the concurrent lock processing result based on the comparison result of the first target lock identifier and the second target lock identifier, it is specifically used to:

[0040] Determine whether the first array and the second array have the same lock identifier;

[0041] When the same lock identifier exists in the first array and the second array, a processing result indicating that the concurrent lock check fails is returned.

[0042] In some implementations, the conflict determination module is further configured to:

[0043] When it is determined that there is no first lock identifier identical to the lock identifier of any level in the multi-level lock type structure tree in the multiple lock rule structures, a processing result indicating that locking is not required is returned.

[0044] In some implementations, the conflict determination module is further configured to:

[0045] When it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check is passed is returned.

[0046] In some implementations, the device further includes a lock release module, configured to:

[0047] When the request type of the concurrent lock request is a lock release request, obtaining a random code in the lock release request; wherein the random code is generated based on the lock request;

[0048] The lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs is cleared.

[0049] In some implementations, the apparatus further includes an identification processing module, configured to:

[0050] At different stages of processing the locking request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the locking request.

[0051] The third aspect of the present application provides a concurrent lock processing device, including:

[0052] An access management module is used to receive a concurrent lock request, and when the request type of the concurrent lock request is a lock request, generate a random code for uniquely identifying the lock request; store the relevant information of the concurrent lock request in a data cache management module; transmit the concurrent lock request to a concurrent lock-in queue; and obtain the processing result of the concurrent lock request from a concurrent lock-out queue;

[0053] A concurrent lock control module, configured to execute the method according to any one of claims 1 to 7;

[0054] An abnormal timeout management module, used to monitor the processing process of the concurrent lock request, and when it is determined that an abnormality exists, return the corresponding abnormal monitoring result to the access management module;

[0055] The data cache management module provides a target data storage space for the access management module, the concurrent lock control module and the abnormal timeout management module, and manages the data in the target data storage space.

[0056] The fourth aspect of the present application proposes an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect.

[0057] A fifth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the method described in the first aspect when executed by a processor.

[0058] The sixth aspect of the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0059] The concurrent lock processing method, device, electronic device and storage medium provided by the present application flexibly manage concurrent lock rule information through multiple lock rule structure trees, compare the lock type in the business concurrent lock request information with the lock type in multiple lock rule structure trees through the concurrent lock verification process, and obtain a judgment conclusion on whether there is a business conflict, that is, whether to allow concurrent lock operations, so as to intercept and process business applications with business conflicts through concurrent locks, and prevent multiple businesses of the same type from being successfully submitted after the business verification is passed in a short period of time, thereby introducing business concurrent locks between the verification and submission of each business, thereby achieving control of concurrent businesses and avoiding business conflict problems.

[0060] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0062] Figure 1 This is an application scenario diagram of the concurrent lock processing method applicable to the embodiment of the present application;

[0063] Figure 2 A flowchart of a concurrent lock processing method provided in an embodiment of the present application;

[0064] Figure 3 An example diagram of a lock rule structure tree provided in an embodiment of the present application;

[0065] Figure 4 A flowchart of a concurrent lock processing method provided in another embodiment of the present application.

[0066] Figure 5 An example diagram of a lock rule structure tree provided by another embodiment of the present application;

[0067] Figure 6 A block diagram of a concurrent lock processing device provided in an embodiment of the present application;

[0068] Figure 7 A schematic diagram of the locking process flow of the concurrent lock control module provided in an embodiment of the present application;

[0069] Figure 8 A schematic diagram of a lock release process of a concurrent lock control module provided in an embodiment of the present application;

[0070] Fig. 9 A block diagram of a concurrent lock processing device provided by another embodiment of the present application;

[0071] Fig.10 A block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0073] As new demands continue to come online, the mobile business system carries more and more services, and the relationship between each service becomes more and more complex. There are often business rules between services, such as order of processing, mutual exclusion, and dependency. Currently, due to the lack of a verification mechanism between services, two mutually exclusive or dependent services may be submitted successfully. Therefore, the existing host cluster service concurrent processing solution has the risk of violating business rules by processing mutually exclusive services at the same time, or unsubscribing the dependent service while processing the dependent service.

[0074] In order to solve the above problems, combined with the existing business processing logic, a business concurrency lock is introduced between the verification and submission of each business. The business concurrency lock can be used to add a concurrent lock for a certain function block, interface or access channel for a certain user number after a certain business verification is passed. The lock will not be released until the business is processed. During the locking period, the user number is not allowed to submit another business of the same function block, interface or access channel, to prevent multiple businesses of the same type from being successfully submitted after the business verification is passed in a short period of time.

[0075] Figure 1 FIG. 1 is an application scenario diagram of the concurrent lock processing method applicable to the embodiment of the present application. Figure 1As shown, a new business control module (i.e., concurrent lock processing device) is added to the system business processing flow. After the business verification is passed, the business system (i.e., the business processing side) sends a lock request to lock the business. After the business is successfully submitted, the subsequent business system sends a lock release request to release the lock. For example, for a certain user number, after the business verification is passed, the business concurrent lock is locked for the business. Subsequent business processing requests for the same function block, interface or access channel initiated by the same user number will be intercepted until the locked business is successfully submitted and the business concurrent lock is released. Only then will the subsequent business processing of the same function block, interface or access channel of the same user number be released.

[0076] The following describes the concurrent lock processing method, device and equipment of the embodiments of the present application with reference to the accompanying drawings.

[0077] Figure 2 The flowchart of a concurrent lock processing method provided by the embodiment of the present application is shown in FIG. It should be noted that the execution subject of the concurrent lock processing method of the embodiment of the present application is the concurrent lock processing device of the embodiment of the present application, and the concurrent lock processing device can be configured in an electronic device so that the electronic device can perform the concurrent lock processing function. Figure 2 As shown, the concurrent lock processing method includes the following steps:

[0078] Step 101, obtaining a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtaining lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to multiple levels of lock types.

[0079] First of all, it should be noted that this solution supports two types of concurrent lock requests, namely lock request and lock release request. For lock request, the lock operation is performed; for lock release request, the lock release operation is performed.

[0080] In some embodiments, the multi-level lock type (lock_type) includes but is not limited to: access channel type (access_type), interface identifier (interface_flag) and module function code (opcode), etc. Among them, the access channel type is the channel for accessing the business system (such as the mobile NGCRM system), such as the CRM front page, customer service channel, website, short hall, mobile APP, etc. The interface identifier is the interface that can be called by the peripheral system, such as the order submission interface, the secondary confirmation interface, the password modification interface, etc. The module function code is the functional module or function of the business system to process a certain business.

[0081] It should be noted that the order of impact range from large to small is: access channel type, interface identifier, module function code, that is, access channel type is the highest level, interface identifier is the next level, and module function code is the lowest level. The same access channel type can call multiple interface identifiers, and an interface identifier can contain multiple module function codes. Module function codes, interface identifiers, and access channel types can also be configured separately. Different access channel types can contain the same interface identifier, and different interface identifiers can also contain the same module function code.

[0082] For the lock request, the upload parameters include: concurrent lock request type (request_type), user number (servnumber), module function code, interface identifier, access channel type and other information.

[0083] For the lock release request, the uploaded parameters include: concurrent lock request type, user number, random code (random_code) and other information. Among them, the random code is generated in the concurrent lock locking process and returned to the business system after generation. After the business system successfully submits the business, it sends a lock release request carrying the random code to release the concurrent lock corresponding to the random code.

[0084] Step 102, determine whether there is a first lock identifier that is the same as the lock identifier of any level in the multi-level lock type in the preset multiple lock rule structure trees; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between the lock identifiers corresponding to the multi-level lock types, the lock rule structure tree includes at least one layer of the multi-level lock type, and the lock rule structure tree includes at least one layer of the multi-level lock type.

[0085] As an implementation manner, the implementation manner of determining whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures includes:

[0086] Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type;

[0087] Based on the lock identifier of the current level lock type, multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

[0088] It should be noted that the lock rule information is managed through the lock rule structure tree, the lock rule configuration information is grouped by group number (lock_groupid), and the lock rule structure tree is constructed according to the relationship between the lock flag (lock_flag) and the parent node lock flag (upperlock_flag).

[0089] By introducing the group number, it is possible to distinguish which interface identifier the module function code belongs to and which access channel type the interface identifier belongs to. According to the relationship between the group number, lock identifier and parent node lock identifier, multiple tree-like data structures of lock rule structure trees can be constructed to manage lock rule information.

[0090] For example, Figure 3 As shown, different group numbers correspond to different lock rule structure trees (group "1", group "2", group "3", group "4"). The same lock identifier ccmkpassword can be configured in the lock rule structure trees corresponding to group "2" and group "3" at the same time. The lock identifier groupchkorderinfo in group "4" can also be configured as an independent node.

[0091] Exemplarily, the traversal starts from the access channel type, the lock identifier whose lock type is the access channel type is obtained from the locking request information, and then all the lock rule structure trees are traversed using any depth-first algorithm. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then the subtree with this node as the root node in the lock rule structure tree is obtained, and the lock identifiers of all nodes of the subtree are saved in the first array; if all the lock rule structure trees are traversed and processed, the first array is empty, the lock identifier whose lock type is the interface identifier is obtained from the locking request information, and then all the lock rule structure trees are traversed using any depth-first algorithm. If If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then the subtree with this node as the root node in the lock rule structure tree is taken out, and the lock identifiers of all nodes of the subtree are saved in the first array; if all lock rule structure trees are traversed and processed, the first array is empty, and the lock identifier with the lock type of the module function code is taken out from the locking request information, and then all lock rule structure trees are traversed using any depth-first algorithm. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then the subtree with this node as the root node in the lock rule structure tree is taken out, and the lock identifiers of all nodes of the subtree are saved in the first array. According to whether the first array is empty, it is determined whether there is a first lock identifier in multiple lock rule structure trees that is the same as the lock identifier of any level in the multi-level lock type.

[0092] In some embodiments, when it is determined that there is no first lock identifier in the multiple lock rule structure trees that is the same as the lock identifier of any level in the multiple levels of lock types, a processing result indicating that locking is not required is returned.

[0093] That is to say, when it is determined that there is no lock identifier in the multiple lock rule structure trees that is the same as the lock identifier of any level in the multi-level lock type, there is no need to execute the following steps, and the processing result that no locking is required is directly returned, that is, the concurrent lock check passes.

[0094] Step 103: if the first lock identifier exists, obtain first target lock identifiers corresponding to all nodes of a first subtree with the first lock identifier as a root node in the lock rule structure tree where the first lock identifier is located.

[0095] In some embodiments, the first target lock identifier is saved to a first array.

[0096] According to the above steps, during the traversal process, if the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier corresponding to a certain level of lock type, then the subtree with this node as the root node in the lock rule structure tree is obtained, and the lock identifiers of all nodes of the subtree are saved in the first array.

[0097] Step 104, obtain the lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in multiple lock rule structure trees; and if the second lock identifier exists, obtain the second target lock identifier corresponding to all nodes of the second subtree with the second lock identifier as the root node in the lock rule structure tree where the second lock identifier is located.

[0098] As an implementation manner, for each lock identifier in the lock record information, multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

[0099] Similar to the implementation method of step 102, the lock identifiers are obtained one by one from the lock record information of the user number to which the concurrent lock request belongs. For each lock identifier, all lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in multiple lock rule structure trees.

[0100] In some embodiments, the second target lock identifier is saved to a second array.

[0101] In some embodiments, when it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check has passed is returned.

[0102] That is, when it is determined that there is no lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees, there is no need to execute the following steps, and the processing result that the concurrent lock check passed is directly returned.

[0103] Step 105: Return the concurrent lock processing result based on the comparison result between the first target lock identifier and the second target lock identifier.

[0104] As an implementation method, it is determined whether there is a lock identifier in the first target lock identifier that is the same as the lock identifier in the second target lock identifier. If so, a processing result indicating that the concurrent lock check fails is returned; if not, a processing result indicating that the concurrent lock check passes is returned.

[0105] In some embodiments, the first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; based on the comparison result of the first target lock identifier and the second target lock identifier, an implementation method of returning the concurrent lock processing result includes: determining whether the same lock identifier exists in the first array and the second array; if the same lock identifier exists in the first array and the second array, returning the processing result of concurrent lock check failure.

[0106] It should also be noted that, in some embodiments, when the request type of the concurrent lock request is a lock release request, a random code in the lock release request is obtained; wherein the random code is generated based on the lock request; and the lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs is cleared.

[0107] In some embodiments, at different stages of processing the lock request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the lock request.

[0108] For example, after obtaining the lock request, the processing flag (deal_flag) is 0 for pending processing; when the lock is being processed, the processing flag is 1 for lock processing; when the lock is completed, the processing flag is 2; when the lock is abnormal, the processing flag is 3; when the lock times out, the processing flag is 4; when the lock is not required, the processing flag is 5; when the lock fails, the processing flag is 6.

[0109] It can be understood that the returned concurrent lock request processing results are different depending on the type of concurrent lock request input. When the business system initiates a lock request, the lock request processing result is returned. If the business system initiates a lock release request, the lock release request processing result is returned.

[0110] Exemplarily, for a lock request, the return parameters include: user number, random code, lock result and other information. The lock result may include, but is not limited to: lock completed, lock failed, lock abnormal, no need to lock, lock timeout, etc. If the lock is returned to be completed, the business system can continue to submit the business; lock failure means that the user number currently has a concurrent lock; when the lock failure is returned, the business system prohibits business submission, and can wait for a specified time to send a lock request again, or return to the front end. Lock abnormality means that the concurrent lock processing device has timed out or an abnormality occurs during processing; when the lock abnormality is returned, the business system prohibits business submission, and can wait for a specified time to send a lock request again, or return to the front end; no need to lock means that no relevant lock rules are matched in the concurrent lock rule configuration, and no lock processing is required. For a lock release request, the result of releasing the concurrent lock processing is returned.

[0111] The concurrent lock processing method of the embodiment of the present application flexibly manages concurrent lock rule information through multiple lock rule structure trees, and compares the lock type in the business concurrent lock request information with the lock type in multiple lock rule structure trees through the concurrent lock verification process to obtain a judgment conclusion on whether there is a business conflict, that is, to judge whether the concurrent lock operation is allowed, so as to intercept and process the business application with business conflicts through concurrent locks, and prevent multiple businesses of the same type from being successfully submitted after the business verification is passed in a short period of time, thereby introducing a business concurrent lock between the verification and submission of each business, thereby realizing the control of concurrent business and avoiding business conflict problems.

[0112] In order to clearly explain the above embodiment, a specific example is now used to illustrate. That is, to clearly explain how the concurrent lock verification process is implemented in this application. This embodiment provides another concurrent lock processing method, Figure 4 This is a flowchart of another concurrent lock processing method provided by an embodiment of the present application. Figure 4 As shown, the concurrent lock processing method may include the following steps:

[0113] Step 1, construct multiple lock rule structure trees: group the lock rule configuration information by group number lock_groupid, and construct a lock rule structure tree according to the relationship between the lock identifier lock_flag and the parent node lock identifier upperlock_flag, and define array A1 and array A2.

[0114] Step 2, whether the lock identifier of the access channel type exists in the lock rule structure tree, and the result is stored in array A1: obtain the lock identifier of the access channel type from the lock request information, and then use any depth-first algorithm to traverse all lock rule structure trees. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then obtain the subtree with this node as the root node in the lock rule structure tree, and save the lock identifiers of all nodes of the subtree into array A1. After all lock rule structure trees are traversed and processed, if the length of array A1 is not 0, that is, the lock identifier of the access channel type has a successful matching record in the lock rule structure tree, jump to step 5, and the length of array A1 is 0 to continue to execute step 3.

[0115] Step 3, whether the lock identifier of the interface identifier type exists in the lock rule structure tree, the result is stored in array A1: obtain the lock identifier of the interface identifier from the lock request information, and then use any depth-first algorithm to traverse all lock rule structure trees. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then take out the subtree with this node as the root node in the lock rule structure tree, and save the lock identifiers of all nodes of the subtree into array A1. After all lock rule structure trees are traversed and processed, if the length of array A1 is not 0, that is, the lock identifier of the interface identifier has a successful match record in the lock rule structure tree, jump to step 5, and if the length of array A1 is 0, continue to execute step 4.

[0116] Step 4, whether the lock identifier of the module function code type exists in the lock rule structure tree, the result is stored in array A1: take out the lock identifier of the module function code type from the lock request information, and then use any depth-first algorithm to traverse all lock rule structure trees. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, then take out the subtree with this node as the root node in the lock rule structure tree, and save the lock identifiers of all nodes of the subtree into array A1. After all lock rule structure trees are traversed and processed, if the length of array A1 is not 0, that is, the lock identifier of the module function code type has a successful match record in the lock rule structure tree, continue to execute step 5, and if the length of array A1 is 0, jump to step 7.

[0117] Step 5, whether the lock identifier in the lock record of the same user number exists in the lock rule structure tree, the result is stored in array A2: get the lock records of all lock requests of the current number from the concurrent lock information cache in the data cache management module M4, and use any depth-first algorithm to traverse all lock rule structure trees after taking out the lock identifier of each lock record. If the lock identifier of a node in a lock rule structure tree is consistent with the lock identifier, take out the subtree with this node as the root node in the lock rule structure tree, and save the lock identifiers of all nodes of the subtree into array A2. After the lock identifiers of all lock records have been traversed and matched in the lock rule structure tree, if the length of array A2 is not 0, continue to execute step 6, otherwise jump to step 8.

[0118] Step 6, compare the elements in array A1 and array A2 to obtain the verification result: compare the elements in array A1 and array A2. If the same elements exist in array A1 and array A2, it means that the concurrent lock requested this time conflicts with the existing concurrent lock, and the same type of business is currently being processed. The lock verification fails, and the lock verification fails is returned, and the verification process ends; if there are no identical elements in array A1 and array A2, the lock verification passes, and the lock verification passes is returned, and the verification process ends.

[0119] Step 7, no locking required, verification passed: the length of array A1 is 0, the lock identifier is not configured in the lock rule configuration information, this concurrent lock request does not require a locking operation, the lock verification passes, and it is returned that no locking is required, and the verification process ends.

[0120] Step 8: There is no concurrent lock for the same type of business at present, and the verification is passed: the length of array A2 is 0, and there is no concurrent lock for the same type of business at present. The concurrent lock request allows the locking operation, and the locking verification is passed. The lock verification is passed, and the verification process ends.

[0121] by Figure 5 Taking the lock rule structure tree shown in the figure as an example, the parameters of the business system lock request are access channel type: bsacNBBSAPP, interface identifier: CRM_IM_002, and module function code: odqryorderfee.

[0122] According to the concurrent lock verification process, the matched subtree nodes are T1.3, T1.6, T1.7 and another subtree node T2.5, and the elements saved in array A1 are T1.3, T1.6, T1.7, and T2.5.

[0123] If the current number has a lock identifier of CRM_IM_004 in the concurrent lock information cache of the data cache management module M4, according to the concurrent lock verification process "Step 5", the subtree nodes matched are T2.3, T2.6, T2.7, and T2.8, and the elements saved in array A2 are T2.3, T2.6, T2.7, and T2.8. There are no identical elements in array A1 and array A2, and there is no business conflict, and the lock verification passes.

[0124] If the current number has a lock identifier of CRM_IM_003 in the concurrent lock information cache of the data cache management module M4, according to the concurrent lock verification process "Step 5", the subtree nodes matched are T2.2, T2.4, and T2.5, and the elements saved in array A2 are T2.2, T2.4, and T2.5. Array A1 and array A2 have the same element T2.5, there is a business conflict, and the lock verification fails.

[0125] By implementing this embodiment, a concurrent lock verification process is realized, and concurrent lock rule information is flexibly managed through multiple lock rule structure trees. Based on the lock type in the business concurrent lock request information, the lock types in the multiple lock rule structure trees are traversed, and the traversal results are stored in the first array; and based on the lock record information of the user number, the lock types in the multiple lock rule structure trees are traversed, and the traversal results are stored in the second array, so as to determine whether the concurrent lock operation is allowed and the corresponding specific circumstances based on the data status in the first array and the second array. The whole process is reasonably designed and the processing speed is fast.

[0126] Based on the above embodiments, Figure 6 A block diagram of a concurrent lock processing device provided in an embodiment of the present application. Figure 6 As shown, the concurrent lock processing device of the present application is mainly composed of three functional processing modules and one data management module, wherein the three functional processing modules are an access management module M1, a concurrent lock control module M2, and an abnormal timeout management module M3, and the data management module is a data cache management module M4.

[0127] Among them, the access management module is used to receive concurrent lock requests, and when the request type of the concurrent lock request is a lock request, generate a random code for uniquely identifying the lock request; store the relevant information of the concurrent lock request in the data cache management module; transmit the concurrent lock request to the concurrent lock-in queue; and obtain the processing result of the concurrent lock request from the concurrent lock-out queue;

[0128] A concurrent lock control module, used to execute the above-mentioned concurrent lock processing method;

[0129] The abnormal timeout management module is used to monitor the processing process of concurrent lock requests and return the corresponding abnormal monitoring results to the access management module when it is determined that an abnormality exists;

[0130] The data cache management module provides target data storage space for the access management module, concurrent lock control module and abnormal timeout management module, and manages the data in the target data storage space.

[0131] The functions and processing flow of each module are further described in detail below.

[0132] Among them, the data cache management module M4 provides data storage and management for the access management module M1, the concurrent lock control module M2, and the abnormal timeout management module M3, including random code cache, concurrent lock information cache, and concurrent lock rule configuration information cache.

[0133] The parameter model of the random code cache includes: concurrent lock request type, user number, random code, lock request time, and processing identifier.

[0134] The parameter model of concurrent lock information cache includes key information such as random code, user number, lock type, lock identifier, and lock request time.

[0135] The parameter model of the concurrent lock rule configuration information cache includes key information such as group number, lock type, lock ID, parent node lock ID, timeout threshold, and lock time limit.

[0136] Among them, the access management module M1 is responsible for connecting with the business end to realize the transparent transmission and forwarding of concurrent lock requests. The access management module M1 and the concurrent lock control module M2 and the abnormal timeout management module M3 use queues for data transmission. Transmitting data by queue can realize non-blocking concurrent lock processing.

[0137] Processing flow of access management module M1:

[0138] Receive the concurrent lock request sent by the business system. If the concurrent lock request type is a lock request, generate a unique identification random code according to the user number, current time, and random code function, and register the concurrent lock request type, user number, random code, lock request time, and processing identifier in the random code cache of the data cache management module M4, and forward the concurrent lock request information to the concurrent lock queue. If the concurrent lock request type is a release lock request, directly forward the concurrent lock request information to the concurrent lock queue.

[0139] From the concurrent lock out queue, obtain the returned concurrent lock request processing result. If the concurrent lock request type is a lock request and the processing identifier is 2 lock completed, the lock processing result is directly returned to the business system; otherwise, clear the corresponding record in the random code cache in the data cache management module M4 according to the random code, and return the lock or release lock processing result to the business system.

[0140] Among them, the concurrent lock control module M2 is mainly responsible for concurrent lock locking operation verification, locking processing and lock release processing.

[0141] like Figure 7 As shown, the locking process of the concurrent lock control module M2 is as follows:

[0142] Get concurrent lock requests from the concurrent lock queue;

[0143] If the request type is a lock request, the processing identifier of the corresponding record in the random code cache in the update data cache management module M4 is 1 lock processing; the abnormal timeout management module M3 reads the record and performs timeout monitoring on the lock processing process.

[0144] Subsequently, the lock record of the user number is obtained from the concurrent lock information cache of the data cache management module M4, including the user number, lock type, lock identifier, and lock request time. At the same time, the concurrent lock rule information such as the group number, lock type, lock identifier, and parent node lock identifier is read from the concurrent lock rule configuration information cache in the data cache management module M4;

[0145] After the concurrent lock verification process of the data cache management module M4 is processed, the verification result is returned. If the processing mark of the corresponding record in the random code cache of the data cache management module M4 is still 1, the lock is being processed, then the following three sub-processes a, b, and c are entered according to the different returned verification results. If the processing mark is 4, the lock is timed out, then the current locking operation is exited.

[0146] a. If the concurrent lock verification process is processed and the lock verification is passed, the processing identifier of the corresponding record in the random code cache in the data cache management module M4 is updated to 2 lock completion, and the user number, lock type, lock identifier, and lock request time are added to the concurrent lock information cache in the data cache management module M4, and the lock is returned successfully to the concurrent lock out queue.

[0147] b. If the concurrent lock verification process returns that no locking is required after processing, the processing identifier of the corresponding record in the random code cache in the data cache management module M4 is updated to 5, which means no locking is required, and the locking result is pushed to the concurrent lock out queue.

[0148] c. If the concurrent lock verification process returns that the lock verification fails, the random code information in the data cache management module M4 is updated to the corresponding record in the cache. The processing identifier is 6 and the lock fails, and the lock result is pushed to the concurrent lock out queue.

[0149] In the above process flow, if any link fails to execute or handles abnormally, the processing mark of the corresponding record in the random code cache in the update data cache management module M4 is 3 locked abnormally, and the abnormal timeout management module M3 performs the abnormal handling. Among them, the abnormal capture method includes but is not limited to throwing an exception to capture after the code block executes abnormally, if condition judgment, etc.

[0150] like Figure 8 As shown, the lock release process of the concurrent lock control module M2 is as follows:

[0151] A concurrent lock request is obtained from the concurrent lock-in queue. If the request type is a lock release request, the lock record in the concurrent lock information cache in the data cache management module M4 is cleared according to the random code, and then the processing result is returned to the concurrent lock-out queue.

[0152] Among them, the abnormal timeout management module M3 is responsible for monitoring the processing of each locking request, and processing the timeout and abnormal situations of the lock control module M2, so as to realize the timeout and abnormal situation processing, and ensure that when the concurrent lock control module M2 has an abnormality, the locking abnormality can be fed back to the front end in time.

[0153] 1. Lock timeout processing flow of abnormal timeout management module M3:

[0154] a. Lock timeout processing flow: If the concurrent lock control module M2 is hung or the processing is slow, the processing mark will always be 0 pending or 1 locked in processing. At this time, the abnormal timeout management module M3 needs to intervene and process. Obtain the records with processing marks of 0 pending and 1 locked in processing from the random code cache in the data cache management module M4, and obtain the timeout threshold corresponding to the current lock request from the lock rule configuration, and determine whether the current time has exceeded the timeout threshold at the specified time interval. If the current time minus the lock request time is greater than the timeout threshold, it is judged as a processing timeout, and the processing mark is updated to 4 lock timeout. After deleting the lock record in the concurrent lock information cache in the data cache management module M4, the lock processing timeout result is pushed to the concurrent lock out queue.

[0155] b. Clean up historical lock records: Get lock records that exceed the lock time limit configured by the lock rule from the random code cache and concurrent lock information cache in the data cache management module M4, and clean them up to avoid residual historical dirty data in the cache, which will affect the next lock of the same user.

[0156] 2. The abnormal timeout management module M3 handles abnormal situations:

[0157] The exception here refers to the database execution error exception or the code execution error exception when the concurrent lock control module M2 processes. This exception is an exception that the concurrent lock control module M2 can capture by itself. The exception capture method includes but is not limited to exception capture through code, if condition judgment, etc.

[0158] The processing flow is: obtain the record of the locking exception with processing identification 3 from the random code cache in the data cache management module M4, delete the lock record in the concurrent lock information cache in the data cache management module M4, and then push the locking processing exception result to the concurrent lock out queue.

[0159] By implementing this embodiment, a concurrent lock processing device is realized.

[0160] In order to implement the above embodiment, the present application also proposes another concurrent lock processing device. Fig. 9 A schematic diagram of the structure of a concurrent lock processing device provided in an embodiment of the present application. Fig. 9 As shown, the concurrent lock processing device may include: a request access module 901 , a lock identification traversal module 902 , a lock record traversal module 903 and a conflict determination module 904 .

[0161] The request access module 901 is used to obtain a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtain the lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to each of the multiple levels of lock types;

[0162] The lock identifier traversal module 902 is used to determine whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures;

[0163] The lock identifier traversal module 902 is further used to, when there is a first lock identifier, obtain the first target lock identifier corresponding to all nodes of the first subtree with the first lock identifier as the root node in the lock rule structure tree where the first lock identifier is located; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between lock identifiers corresponding to the multi-level lock types, the lock rule structure tree includes at least one layer of the multi-level lock types, and the lock rule structure tree includes at least one layer of the multi-level lock types;

[0164] The lock record traversal module 903 is used to obtain the lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in multiple lock rule structure trees; and if there is a second lock identifier, obtain the second target lock identifier corresponding to all nodes of the second subtree with the second lock identifier as the root node in the lock rule structure tree where the second lock identifier is located;

[0165] The conflict determination module 904 is used to return a concurrent lock processing result based on the comparison result between the first target lock identifier and the second target lock identifier.

[0166] In some implementations, when the lock identifier traversal module 902 determines whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures, it is specifically configured to:

[0167] Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type;

[0168] Based on the lock identifier of the current level lock type, multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

[0169] In some implementations, when determining whether there is a second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees, the lock record traversal module 903 is specifically configured to:

[0170] For each lock identifier in the lock record information, multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

[0171] In some implementations, the first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; when the conflict determination module 904 returns the concurrent lock processing result based on the comparison result of the first target lock identifier and the second target lock identifier, it is specifically used to:

[0172] Determine whether the same lock identifier exists in the first array and the second array;

[0173] When the same lock identifier exists in the first array and the second array, a processing result indicating that the concurrent lock check fails is returned.

[0174] In some implementations, the conflict determination module 904 is further configured to:

[0175] When it is determined that there is no first lock identifier identical to a lock identifier of any level in the multi-level lock type structure tree in the multiple lock rule structures, a processing result indicating that locking is not required is returned.

[0176] In some implementations, the conflict determination module 904 is further configured to:

[0177] When it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check has passed is returned.

[0178] In some implementations, the device further includes a lock release module, configured to:

[0179] When the request type of the concurrent lock request is a lock release request, a random code in the lock release request is obtained; wherein the random code is generated based on the lock request;

[0180] Clear the lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs.

[0181] In some implementations, the apparatus further includes an identification processing module, configured to:

[0182] At different stages of processing the lock request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the lock request.

[0183] It should be noted that the aforementioned explanation and advantages of the concurrent lock processing method embodiment are also applicable to the concurrent lock processing device of this embodiment, and will not be repeated here.

[0184] In order to implement the above embodiment, the present application also proposes another concurrent lock processing device. Fig. 9 A schematic diagram of the structure of a concurrent lock processing device provided in an embodiment of the present application. Fig. 9 As shown, the concurrent lock processing device may include: a request access module 901 , a lock identification traversal module 902 , a lock record traversal module 903 and a conflict determination module 904 .

[0185] The request access module 901 is used to obtain a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtain the lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to each of the multiple levels of lock types;

[0186] The lock identifier traversal module 902 is used to determine whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures;

[0187] The lock identifier traversal module 902 is further used to, when there is a first lock identifier, obtain the first target lock identifier corresponding to all nodes of the first subtree with the first lock identifier as the root node in the lock rule structure tree where the first lock identifier is located; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between lock identifiers corresponding to the multi-level lock types, the lock rule structure tree includes at least one layer of the multi-level lock types, and the lock rule structure tree includes at least one layer of the multi-level lock types;

[0188] The lock record traversal module 903 is used to obtain the lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in multiple lock rule structure trees; and if there is a second lock identifier, obtain the second target lock identifier corresponding to all nodes of the second subtree with the second lock identifier as the root node in the lock rule structure tree where the second lock identifier is located;

[0189] The conflict determination module 904 is used to return a concurrent lock processing result based on the comparison result between the first target lock identifier and the second target lock identifier.

[0190] In some implementations, when the lock identifier traversal module 902 determines whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure tree in the preset multiple lock rule structures, it is specifically configured to:

[0191] Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type;

[0192] Based on the lock identifier of the current level lock type, multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

[0193] In some implementations, when determining whether there is a second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees, the lock record traversal module 903 is specifically configured to:

[0194] For each lock identifier in the lock record information, multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

[0195] In some implementations, the first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; when the conflict determination module 904 returns the concurrent lock processing result based on the comparison result of the first target lock identifier and the second target lock identifier, it is specifically used to:

[0196] Determine whether the same lock identifier exists in the first array and the second array;

[0197] When the same lock identifier exists in the first array and the second array, a processing result indicating that the concurrent lock check fails is returned.

[0198] In some implementations, the conflict determination module 904 is further configured to:

[0199] When it is determined that there is no first lock identifier identical to a lock identifier of any level in the multi-level lock type structure tree in the multiple lock rule structures, a processing result indicating that locking is not required is returned.

[0200] In some implementations, the conflict determination module 904 is further configured to:

[0201] When it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check has passed is returned.

[0202] In some implementations, the device further includes a lock release module, configured to:

[0203] When the request type of the concurrent lock request is a lock release request, a random code in the lock release request is obtained; wherein the random code is generated based on the lock request;

[0204] Clear the lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs.

[0205] In some implementations, the apparatus further includes an identification processing module, configured to:

[0206] At different stages of processing the lock request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the lock request.

[0207] It should be noted that the above explanation of the concurrent lock processing method embodiment is also applicable to the concurrent lock processing device of this embodiment, and will not be repeated here.

[0208] The concurrent lock processing device of the embodiment of the present application flexibly manages concurrent lock rule information through multiple lock rule structure trees, and compares the lock type in the business concurrent lock request information with the lock type in multiple lock rule structure trees through the concurrent lock verification process to obtain a judgment conclusion on whether there is a business conflict, that is, to judge whether the concurrent lock operation is allowed, so as to intercept and process the business application with business conflicts through concurrent locks, and prevent multiple businesses of the same type from being successfully submitted after the business verification is passed in a short period of time, thereby introducing a business concurrent lock between the verification and submission of each business, thereby realizing the control of concurrent business and avoiding business conflict problems.

[0209] In order to implement the above embodiment, the present application also proposes an electronic device. Fig.10 , Fig.10 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Fig.10As shown, the electronic device 1000 includes: a processor 1001, and a memory 1002 communicatively connected to the processor 1001; the memory 1002 stores computer-executable instructions; the processor 1001 executes the computer-executable instructions stored in the memory to implement the method provided in the aforementioned embodiment.

[0210] In order to implement the above embodiments, the present application also proposes a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the methods provided by the above embodiments.

[0211] In order to implement the above embodiments, the present application also proposes a computer program product, including a computer program, which implements the methods provided by the above embodiments when executed by a processor.

[0212] The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in this application are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0213] It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection / sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign the agreement / authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.

[0214] The present application is expected to provide an implementation scheme for users to selectively block the use or access of personal information data. That is, the present disclosure is expected to provide hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, the risk can be minimized by limiting data collection and deleting the data. In addition, when applicable, such personal information is de-identified to protect the privacy of the user.

[0215] In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0216] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0217] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0218] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0219] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0220] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0221] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0222] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A concurrent lock processing method, characterized in that: The following steps are involved: Obtaining a concurrent lock request, and when the request type of the concurrent lock request is a lock request, obtaining lock type information in the concurrent lock request; wherein the lock type information includes lock identifiers corresponding to multiple levels of lock types; Determine whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type in the preset multiple lock rule structure trees; wherein the lock rule structure tree is a tree data structure constructed according to the belonging relationship between the lock identifiers corresponding to the multi-level lock types, and the lock rule structure tree includes at least one level in the multi-level lock type; If the first lock identifier exists, obtaining first target lock identifiers corresponding to all nodes of a first subtree with the first lock identifier as a root node in a lock rule structure tree where the first lock identifier is located; Obtain lock record information of the user number to which the concurrent lock request belongs, and determine whether there is a second lock identifier that is identical to the lock identifier in the lock record information in the multiple lock rule structure trees; and if the second lock identifier exists, obtain second target lock identifiers corresponding to all nodes of a second subtree with the second lock identifier as a root node in the lock rule structure tree where the second lock identifier is located; Based on the comparison result of the first target lock identifier and the second target lock identifier, a concurrent lock processing result is returned.

2. The method according to claim 1, characterized in that The determining whether there is a first lock identifier that is the same as a lock identifier of any level in the multi-level lock type structure in the preset multiple lock rule structures includes: Obtain the lock identifier of the current level lock type from the lock type information in descending order of levels, and perform the following judgment steps; until it is determined that the first lock identifier exists or the judgment step is performed on the lock identifier of the lowest level lock type; Based on the lock identifier of the current level lock type, the multiple lock rule structure trees are traversed to determine whether there is a first lock identifier that is the same as the lock identifier of the current level lock type in the multiple lock rule structure trees.

3. The method according to claim 1, characterized in that The determining whether there is a second lock identifier in the plurality of lock rule structure trees that is the same as the lock identifier in the lock record information includes: For each lock identifier in the lock record information, the multiple lock rule structure trees are traversed to determine whether there is a second lock identifier that is the same as the lock identifier in the lock record information in the multiple lock rule structure trees.

4. The method according to claim 1, characterized in that: The first target lock identifier is stored in a first array, and the second target lock identifier is stored in a second array; Based on the comparison result of the first target lock identifier and the second target lock identifier, a concurrent lock processing result is returned, including: Determine whether the first array and the second array have the same lock identifier; When the same lock identifier exists in the first array and the second array, a processing result indicating that the concurrent lock check fails is returned.

5. The method according to claim 1, characterized in that: The method further comprises: When it is determined that there is no first lock identifier identical to the lock identifier of any level in the multi-level lock type structure tree in the multiple lock rule structures, a processing result indicating that locking is not required is returned.

6. The method according to claim 1, characterized in that The method further comprises: When it is determined that there is no second lock identifier identical to the lock identifier in the lock record information in the multiple lock rule structure trees; a processing result indicating that the concurrent lock check is passed is returned.

7. The method according to claim 1, characterized in that The method further comprises: When the request type of the concurrent lock request is a lock release request, obtaining a random code in the lock release request; wherein the random code is generated based on the lock request; The lock record information corresponding to the random code in the lock record information of the user number to which the lock release request belongs is cleared.

8. The method according to claim 1, characterized in that The method further comprises: At different stages of processing the locking request, the current value of the processing identifier is updated; the processing identifier includes multiple values, and the multiple values ​​of the processing identifier are respectively used to identify various processing states of the locking request.

9. A concurrent lock processing device, characterized in that: include: An access management module, configured to receive a concurrent lock request, and when the request type of the concurrent lock request is a lock request, generate a random code for uniquely identifying the lock request; Storing the corresponding information of the concurrent lock request in a data cache management module; Transmitting the concurrent lock request to a concurrent lock queue; and for obtaining the processing result of the concurrent lock request from the concurrent lock out queue; A concurrent lock control module, configured to execute the method according to any one of claims 1 to 8; An abnormal timeout management module is used to monitor the processing process of the concurrent lock request and return the corresponding abnormal monitoring result to the access management module when it is determined that an abnormality exists; The data cache management module provides a target data storage space for the access management module, the concurrent lock control module and the abnormal timeout management module, and manages the data in the target data storage space.

10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.