Financial distributed system-oriented distributed lock engine and control method

The distributed lock engine and control method provide a unified interface for switching locking modes in financial systems by configuring distributed locks, addressing the lack of a unified engine in existing technologies and reducing code modifications.

CN119065866APending Publication Date: 2024-12-03CHINA EVERBRIGHT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411109153.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Financial distributed systems lack a unified engine to combine multiple distributed locks, requiring invasive source code modifications when switching locking modes, which is inconvenient for businesses.

Method used

A distributed lock engine and control method that abstracts a unified lock interface, allowing users to switch locking modes by modifying configuration files only, without altering source code, by implementing multiple locking modes through an implementation engine, configuration engine, and management engine.

Benefits of technology

Enables convenient and fast switching between locking modes by configuring distributed locks, improving flexibility and reducing code intrusion, thus simplifying the use of multiple distributed locks in financial systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065866A_ABST
    Figure CN119065866A_ABST
Patent Text Reader

Abstract

The invention relates to a financial distributed system oriented distributed lock engine and a control method. By means of an engine defining mode, a plurality of distributed locks of different versions are provided for implementation, a user can determine a locking mode and conduct locking and unlocking operation through combination of the engine and configuration, when the locking mode is switched, switching of the locking mode can be achieved only by modifying configuration information of the distributed locks, convenience and rapidness are achieved, and user experience is improved. The use difficulty is simplified, the flexibility is improved, and code intrusion is avoided. The problems that in the prior art, no unified engine is used for combining various distributed locks, when a locking mode is replaced, source codes need to be modified, use is inconvenient during business party switching, and code invasion is large are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of distributed lock technology, and in particular, to a distributed lock engine and control method for a financial distributed system. Background Art

[0002] In financial distributed systems, distributed systems are becoming increasingly complex, especially in enterprise-level application scenarios. Mutually exclusive access to shared resources has become a requirement that many businesses must face. In this scenario, distributed locks are usually introduced to solve the problem. Currently, popular locking methods include database locking, Redis locking, Rheakv locking, etc. Each locking method has its advantages and disadvantages, and also has applicable scenarios.

[0003] In financial distributed systems, there are many application scenarios and businesses with different locking requirements. There is no unified engine to combine multiple distributed locks. When changing the locking mode, the source code needs to be modified, which is inconvenient for the business party to switch and the code is highly invasive. Summary of the invention

[0004] In order to solve the problem that there is no unified engine in the prior art to combine multiple distributed locks, the source code needs to be modified when changing the locking mode, which is inconvenient for the business party to use when switching and the code is highly invasive, the embodiment of this specification provides a distributed lock engine and control method for financial distributed systems. By abstracting a unified lock interface and defining an engine, multiple locking modes are implemented separately. Users can determine the locking mode and perform locking and unlocking operations through the engine combined with the configuration. When switching the locking mode, only the configuration file needs to be modified to achieve the switch without code intrusion.

[0005] The specific technical solutions of the embodiments of this specification are as follows:

[0006] On the one hand, the embodiments of this specification provide a distributed lock engine for a financial distributed system, wherein the distributed lock engine is applied to a financial distributed system and includes: an implementation engine, a configuration engine, and a management engine;

[0007] The implementation engine includes lock implementations corresponding to multiple different versions of distributed locks, and the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system;

[0008] The configuration engine is used to determine a target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establish a communication connection between the financial distributed system and the server of the target distributed lock;

[0009] The management engine is used to call the lock implementation corresponding to the target distributed lock in the implementation engine when a node in the financial distributed system accesses the target shared resource of the financial distributed system, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

[0010] Furthermore, the implementation engine also includes:

[0011] The lock waiting time configuration interface is used to receive the lock waiting time determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock waiting time as the calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. When the server corresponding to the target distributed lock performs a locking operation on the target shared resource, it determines whether the lock is successfully locked within the lock waiting time and returns the locking result to the lock implementation.

[0012] Furthermore, the implementation engine also includes:

[0013] The lock release timeout configuration interface is used to receive the lock release timeout determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock release timeout as the calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. After the server corresponding to the target distributed lock successfully performs the locking operation on the target shared resource, it determines whether the lock of the target shared resource is released within the lock release timeout, and if not, releases the lock of the target shared resource.

[0014] Furthermore, the configuration engine is also used to determine a target data source for the target distributed lock operation according to the distributed lock configuration information.

[0015] Furthermore, the management engine is further used to call the lock implementation corresponding to the target distributed lock in the implementation engine when a node in the financial distributed system accesses the shared resources in the target data source, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the shared resources in the target data source.

[0016] Based on the same inventive concept, the embodiment of this specification also provides a control method of a distributed lock engine for a financial distributed system, which is applied to the above-mentioned distributed lock engine for a financial distributed system. The control method includes:

[0017] The control implementation engine creates lock implementations corresponding to the distributed locks of different versions, and the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system;

[0018] After receiving the distributed lock configuration information, the control configuration engine determines the target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establishes a communication connection between the financial distributed system and the server of the target distributed lock;

[0019] When a node in the financial distributed system accesses a target shared resource of the financial distributed system, the control management engine calls the lock implementation corresponding to the target distributed lock in the implementation engine, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

[0020] Furthermore, the control method further includes:

[0021] Receiving the lock waiting time determined by the financial distributed system according to the business scenario through the lock waiting time configuration interface in the implementation engine;

[0022] When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock waiting time as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that when the server corresponding to the target distributed lock performs a lock operation on the target shared resource, it is determined whether the lock is successfully locked within the lock waiting time, and the lock result is returned to the lock implementation.

[0023] Furthermore, the control method further includes:

[0024] Receiving a lock release timeout determined by the financial distributed system according to a business scenario through a lock release timeout configuration interface in the implementation engine;

[0025] When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock release timeout as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that the server corresponding to the target distributed lock can determine whether the lock of the target shared resource is released within the lock release timeout after successfully performing the locking operation on the target shared resource. If not, the lock of the target shared resource is released.

[0026] Furthermore, the control method further includes:

[0027] The configuration engine is controlled to determine a target data source for the target distributed lock operation according to the distributed lock configuration information.

[0028] Furthermore, the control method further includes:

[0029] When a node in the financial distributed system accesses the shared resources in the target data source, the management engine is controlled to call the lock implementation corresponding to the target distributed lock in the implementation engine, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the shared resources in the target data source.

[0030] On the other hand, an embodiment of the present specification further provides a computer device, including a memory, a processor, and a computer program stored in the memory, and the processor implements the above control method when executing the computer program.

[0031] On the other hand, an embodiment of the present specification further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned control method is implemented.

[0032] Finally, the embodiments of this specification also provide a computer program product, which includes a computer program, and the computer program implements the above control method when executed by a processor.

[0033] By using the embodiments of this specification, multiple different versions of distributed locks are implemented by defining an engine. Users can determine the locking mode and perform locking and unlocking operations through the engine combined with the configuration. When switching the locking mode, only the distributed lock configuration information needs to be modified to switch the locking mode. This is convenient and fast, simplifies the difficulty of use, improves flexibility, and has no code intrusion. This solves the problem that there is no unified engine in the prior art to combine multiple distributed locks, and when changing the locking mode, the source code needs to be modified, which is inconvenient for the business party to use when switching, and the code is highly invasive. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 The figure shows a schematic diagram of the structure of a distributed lock engine for a financial distributed system in an embodiment of this specification;

[0036] Figure 2 The figure is a flow chart of a control method of a distributed lock engine for a financial distributed system according to an embodiment of the present specification;

[0037] Figure 3 It is a schematic diagram showing the allocation of ownership of distributed locks based only on the order of time in the embodiment of this specification;

[0038] Figure 4 It is a schematic diagram showing the allocation of ownership of a distributed lock based on time and token in an embodiment of this specification;

[0039] Figure 5 The figure is a schematic diagram of the process of configuring the lock waiting time in the embodiment of this specification;

[0040] Figure 6 The figure is a schematic diagram of the process of configuring the lock release timeout period in the embodiment of this specification;

[0041] Figure 7 The figure is a schematic diagram of the structure of a computer device in an embodiment of the present specification.

[0042]

Description of reference numerals

[0043] 10. Financial distributed systems;

[0044] 101. Implement the engine;

[0045] 102. Configuration engine;

[0046] 103. Management Engine;

[0047] 20. Server;

[0048] 702. Computer equipment;

[0049] 704. Processing equipment;

[0050] 706. Storage resources;

[0051] 708. Drive system;

[0052] 710, input / output module;

[0053] 712. Input devices;

[0054] 714. Output devices;

[0055] 716. Presentation equipment;

[0056] 718. Graphical user interface;

[0057] 720, network interface;

[0058] 722. Communication link;

[0059] 724. Communication bus. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of this specification.

[0061] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this specification and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0062] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification comply with the relevant provisions of national laws and regulations.

[0063] It should be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0064] like Figure 1 The structure diagram of a distributed lock engine for a financial distributed system in an embodiment of this specification is shown. The distributed lock engine is applied to a financial distributed system 10, including: an implementation engine 101, a configuration engine 102 and a management engine 103;

[0065] The implementation engine 101 includes lock implementations corresponding to multiple different versions of distributed locks, and the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system;

[0066] The configuration engine 102 is used to determine a target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establish a communication connection between the financial distributed system 10 and the server 20 of the target distributed lock;

[0067] The management engine 103 is used to call the lock implementation corresponding to the target distributed lock in the implementation engine 101 when a node in the financial distributed system 10 accesses the target shared resource of the financial distributed system 10, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

[0068] In the embodiments of this specification, a distributed lock engine for a financial distributed system can be deployed and run on a computer device. The distributed lock engine of the embodiments of this specification is implemented by writing code. The implementation engine, configuration engine, and management engine are all virtual modules. Corresponding code is deployed in each virtual module, and the execution code implements the functions of the configuration engine, the implementation engine, and the management engine.

[0069] Based on the same inventive concept, the embodiment of this specification also provides a control method for a distributed lock engine for a financial distributed system, which is applied to Figure 1 The distributed lock engine shown in Figure 2 As shown, the control method includes:

[0070] Step 201: The control implementation engine creates lock implementations corresponding to a plurality of different versions of distributed locks, respectively, wherein the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system;

[0071] Step 202: after receiving the distributed lock configuration information, the control configuration engine determines the target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establishes a communication connection between the financial distributed system and the server of the target distributed lock;

[0072] Step 203: When a node in the financial distributed system accesses a target shared resource of the financial distributed system, the control management engine calls the lock implementation corresponding to the target distributed lock in the implementation engine, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

[0073] By using the embodiments of this specification, multiple different versions of distributed locks are implemented by defining an engine. Users can determine the locking mode and perform locking and unlocking operations through the engine combined with the configuration. When switching the locking mode, only the distributed lock configuration information needs to be modified to switch the locking mode. This is convenient and fast, simplifies the difficulty of use, improves flexibility, and has no code intrusion. This solves the problem that there is no unified engine in the prior art to combine multiple distributed locks, and when changing the locking mode, the source code needs to be modified, which is inconvenient for the business party to use when switching, and the code is highly invasive.

[0074] In the embodiments of this specification, there are multiple versions of distributed lock implementations. Different implementations have their own focuses, advantages and disadvantages. Currently, the more popular implementations include redis-based implementations and jraft-based implementations.

[0075] Redisson is the most popular redis-related implementation, and provides a starter based on SpringBoot. It is very easy to use and is most widely used in distributed projects.

[0076] rheakv is an implementation based on jraft and is included in the jraft project. It is a submodule of jraft and has the following features: embedded, strong consistency, self-driving, and monitorable. At the same time, rheakv's distributed lock implementation provides fencingToken function.

[0077] Combined with their own needs, it can be roughly divided into the following two scenarios:

[0078] Scenario 1: The same user repeatedly requests the same resource and performs the same operation at the same time.

[0079] For systems with high instantaneous requests, such as financial scenarios such as "grabbing red envelopes", "snatching coupons", "qualification draws", and "random instant discounts on payments". The most prominent requirements in these scenarios are that they cannot be oversold or overissued, and that they need to queue. That is, a request needs to return a result within a limited time, and for successful results, it is necessary to select and process data issues to ensure data consistency. The same user can make multiple requests, but after one success, all subsequent operations will fail. For this scenario, a distributed lock in redisson mode can be used. When the lock server hangs up and the lock data is not synchronized to the slave node or when the system is delayed and garbage collection causes the lock renewal to fail, the next request to obtain the lock and start the related process will eventually fail because there will be a judgment on user qualification verification, and a user can only have one.

[0080] Scenario 2: The same user repeatedly requests the same resource and performs different operations at the same time

[0081] For the "partial refund" scenario, third-party payment generally supports multiple partial refunds for one order. In this case, there is a requirement that the refund amount of the payment order cannot exceed the payment amount, and users can request multiple times, even multiple times at the same time, and the amounts of multiple requests may be the same or different. This scenario requires limiting and queuing, and there is no limit before certain conditions. If the same user makes multiple requests, success does not mean that the next time will fail or other requests will fail. For this scenario, the rheakv mode distributed lock can be used to ensure the strong consistency of the locked data. When the system is delayed or the lock renewal fails due to garbage collection or the server switches between master and slave nodes, the lock data will not be lost. At the same time, fencingtoken verification is provided to avoid the scenario where the server hangs up and the data is not synchronized, resulting in the next request to obtain the lock; for the situation where multiple locks are caused by garbage collection, resulting in multiple deductions, fencingtoken verification is used to ensure that only one execution is successful at the same time.

[0082] Based on the above scenarios, redis has the basic constraints on the distributed lock model. The redisson distributed lock implementation based on redis is currently the most popular. However, considering the topic of data consistency and correctness, the order based on time is unreliable, and the fencing capability needs to be introduced to achieve absolute mutual exclusivity of resource access. Specific instructions are as follows Figure 3 As shown in the figure, Client 1 first obtains the ownership of the distributed lock. When operating the data, garbage collection (GC) occurs. During the long "Stop-The-World" GC process, the ownership of the lock is lost. Client 2 competes for the lock ownership and starts to operate the data. As a result, after the GC of Client 1 is completed, Client 1 and Client 2 will operate the data at the same time, resulting in data inconsistency.

[0083] The solution to the above problems is to introduce the IO Fence (IO isolation) capability for shared resource access, as follows Figure 4 As shown in the figure, the global lock service provides a global self-incrementing Token. When client 1 obtains the lock, the returned Token is 33, which is brought into the storage system, and GC occurs. When client 2 successfully grabs the lock and returns Token 34, which is brought into the storage system, the storage system will reject subsequent requests with a Token value less than 34. Then, when client 1 recovers after a long period of GC and writes data again, because the Token recorded in the underlying storage system has been updated, the request carrying the Token value of 33 will be directly rejected, thereby achieving the effect of data protection.

[0084] Since redisson and rheaKV have their own implementations and their own advantages and disadvantages, if the financial distributed system needs to switch the distributed lock, the existing technology can only modify the source code, which is very inconvenient for the business party to use when switching and the code is highly invasive.

[0085] Therefore, the implementation engine of the embodiment of this specification includes at least the lock implementations corresponding to the distributed locks of redisson and rheaKV, and the lock implementations call the functional interfaces of the respective distributed locks to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system.

[0086] The configuration engine then determines the target distributed lock (redisson or rheaKV) based on the distributed lock configuration information (including which locking mode needs to be used), and then establishes a communication connection between the financial distributed system and the server of the target distributed lock.

[0087] When a node in a financial distributed system accesses a target shared resource of the financial distributed system, the management engine calls the lock implementation corresponding to the target distributed lock in the implementation engine according to the distributed lock configuration information. The lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

[0088] According to one embodiment of this specification, the implementation engine further includes:

[0089] The lock waiting time configuration interface is used to receive the lock waiting time determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock waiting time as the calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. When the server corresponding to the target distributed lock performs a locking operation on the target shared resource, it determines whether the lock is successfully locked within the lock waiting time and returns the locking result to the lock implementation.

[0090] like Figure 5 As shown, the control method also includes:

[0091] Step 501: receiving the lock waiting time determined by the financial distributed system according to the business scenario through the lock waiting time configuration interface in the implementation engine;

[0092] Step 502: When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock waiting time as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that when the server corresponding to the target distributed lock performs a lock operation on the target shared resource, it is determined whether the lock is successfully locked within the lock waiting time, and the lock result is returned to the lock implementation.

[0093] In the embodiments of this specification, the implementation engine supports users to configure the lock waiting time. The lock waiting time refers to notifying redis and jraft whether the lock is accepted and waiting for a period of time. This time is determined according to the business scenario of the financial distributed system, such as waiting for 100ms or not waiting (that is, the lock waiting time is 0). If the waiting time is not 0, the server corresponding to the distributed lock locks when receiving the call. If the lock is unsuccessful, it determines whether the waiting time has timed out. If it has not timed out, it locks again. If the lock is not successfully locked within the lock waiting time, the lock is no longer processed due to the lock waiting time timeout. If the waiting time is 0, the server corresponding to the distributed lock immediately returns the lock result (successful or unsuccessful) when receiving the call, and even if it is unsuccessful, it will no longer wait for the lock.

[0094] According to one embodiment of the present specification, the implementation engine also includes: a lock release timeout configuration interface, which is used to receive the lock release timeout determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock release timeout as a calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. After the server corresponding to the target distributed lock successfully performs the locking operation on the target shared resource, it determines whether the lock of the target shared resource is released within the lock release timeout, and if not, releases the lock of the target shared resource.

[0095] like Figure 6 As shown, the control method also includes:

[0096] Step 601: receiving the lock release timeout determined by the financial distributed system according to the business scenario through the lock release timeout configuration interface in the implementation engine;

[0097] Step 602: When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock release timeout as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that the server corresponding to the target distributed lock can determine whether the lock of the target shared resource is released within the lock release timeout after successfully performing the locking operation on the target shared resource. If not, the lock of the target shared resource is released.

[0098] In the embodiment of this specification, the implementation engine also supports the configuration of the lock release timeout. The lock release timeout means that after the node obtains the lock, if the lock is not released within the timeout period, the distributed lock server automatically releases the lock to facilitate other nodes to obtain the lock and operate shared resources.

[0099] In the embodiments of the present specification, both the lock waiting time and the lock release timeout time may be empirical values ​​set according to business scenarios.

[0100] According to an embodiment of the present specification, the configuration engine is further used to determine a target data source of the target distributed lock operation according to the distributed lock configuration information.

[0101] The management engine is further used to call the lock implementation corresponding to the target distributed lock in the implementation engine when a node in the financial distributed system accesses the shared resources in the target data source, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the shared resources in the target data source.

[0102] For example, because redis is used as a cache in most scenarios, nodes in the financial distributed system access the data in the redis cache. Therefore, if redisson is used, it can be determined whether to use the default data source (that is, determine whether to use the data in the redis cache as a shared resource). If so, when the node accesses the data in the redis cache, the lock implementation calls the redisson functional interface to perform locking or unlocking operations on the shared resources in the redis cache.

[0103] If the default data source is not used, user-configured data sources are supported. When a node accesses data in a user-configured data source, the lock implementation calls the redisson functional interface to lock or unlock the shared resources in the user-configured data source.

[0104] In some other embodiments of the present specification, multiple lock implementations corresponding to a distributed lock may be created in the implementation engine, and the data source may be used as a configuration parameter. The management engine may use the specific data source accessed by the node as a parameter to call the corresponding lock implementation, thereby locking or unlocking the data in the data source, realizing the separation of the data source and improving flexibility.

[0105] like Figure 7 The figure is a schematic diagram of the structure of the computer device in the embodiment of this specification. The computer device in the embodiment of this specification can run the feature processing platform in the embodiment of this specification.

[0106] The computer device 702 may include one or more processing devices 704, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 702 may also include any storage resources 706 for storing any type of information such as code, settings, data, etc. Without limitation, for example, the storage resources 706 may include any one or more combinations of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any storage resource may use any technology to store information.

[0107] Further, any storage resource may provide volatile or non-volatile retention of information.

[0108] Further, any storage resource may represent a fixed or removable component of the computer device 702. In one case, when the processing device 704 executes the associated instructions stored in any storage resource or combination of storage resources, the computer device 702 may perform any operation of the associated instructions. The computer device 702 also includes one or more drive systems 708 for interacting with any storage resource, such as a hard disk drive system, an optical disk drive system, etc.

[0109] The computer device 702 may also include an input / output module 710 (I / O) for receiving various inputs (via input devices 712) and for providing various outputs (via output devices 714). A specific output mechanism may include a presentation device 716 and an associated graphical user interface (GUI) 718. In other embodiments, the input / output module 710 (I / O), the input device 712, and the output device 714 may not be included, and the computer device 702 may be used as a computer device in a network. The computer device 702 may also include one or more network interfaces 720 for exchanging data with other devices via one or more communication links 722. One or more communication buses 724 couple the components described above together.

[0110] The communication link 722 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 722 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.

[0111] The embodiments of the present specification also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0112] The embodiments of the present specification also provide a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to execute the above method.

[0113] It should be understood that in the various embodiments of the present specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present specification.

[0114] It should also be understood that in the embodiments of this specification, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the embodiments of this specification generally indicates that the associated objects before and after are in an "or" relationship.

[0115] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of this specification can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of this specification.

[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0117] In the several embodiments provided in the embodiments of this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.

[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.

[0119] In addition, each functional unit in each embodiment of the present specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0120] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0121] The embodiments of this specification use specific embodiments to illustrate the principles and implementation methods of the embodiments of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of this specification. At the same time, for those skilled in the art, according to the ideas of the embodiments of this specification, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of this specification.

Claims

1. A distributed lock engine for financial distributed systems, characterized in that: The distributed lock engine is applied to a financial distributed system, including: an implementation engine, a configuration engine, and a management engine; The implementation engine includes lock implementations corresponding to multiple different versions of distributed locks, and the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system; The configuration engine is used to determine a target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establish a communication connection between the financial distributed system and the server of the target distributed lock; The management engine is used to call the lock implementation corresponding to the target distributed lock in the implementation engine when a node in the financial distributed system accesses the target shared resource of the financial distributed system, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

2. The distributed lock engine for financial distributed systems according to claim 1, characterized in that: The implementation engine also includes: The lock waiting time configuration interface is used to receive the lock waiting time determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock waiting time as the calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. When the server corresponding to the target distributed lock performs a locking operation on the target shared resource, it determines whether the lock is successfully locked within the lock waiting time and returns the locking result to the lock implementation.

3. The distributed lock engine for financial distributed systems according to claim 1, characterized in that: The implementation engine also includes: The lock release timeout configuration interface is used to receive the lock release timeout determined by the financial distributed system according to the business scenario, so that when the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation uses the lock release timeout as the calling parameter of the functional interface of the target distributed lock and calls the functional interface of the target distributed lock. After the server corresponding to the target distributed lock successfully performs the locking operation on the target shared resource, it determines whether the lock of the target shared resource is released within the lock release timeout, and if not, releases the lock of the target shared resource.

4. The distributed lock engine for financial distributed systems according to claim 1, characterized in that: The configuration engine is further configured to determine a target data source for the target distributed lock operation according to the distributed lock configuration information.

5. The distributed lock engine for financial distributed systems according to claim 4, characterized in that: The management engine is further used to call the lock implementation corresponding to the target distributed lock in the implementation engine when a node in the financial distributed system accesses the shared resources in the target data source, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the shared resources in the target data source.

6. A control method for a distributed lock engine for a financial distributed system, applied to the distributed lock engine for a financial distributed system according to any one of claims 1 to 5, characterized in that: The control method comprises: The control implementation engine creates lock implementations corresponding to the distributed locks of different versions, and the lock implementations are used to call the corresponding functional interface of the distributed lock to perform locking or unlocking operations on the corresponding shared resources of the financial distributed system; After receiving the distributed lock configuration information, the control configuration engine determines the target distributed lock from the multiple distributed locks of different versions according to the distributed lock configuration information, and establishes a communication connection between the financial distributed system and the server of the target distributed lock; When a node in the financial distributed system accesses a target shared resource of the financial distributed system, the control management engine calls the lock implementation corresponding to the target distributed lock in the implementation engine, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the target shared resource.

7. The control method according to claim 6, characterized in that: The control method further comprises: Receiving the lock waiting time determined by the financial distributed system according to the business scenario through the lock waiting time configuration interface in the implementation engine; When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock waiting time as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that when the server corresponding to the target distributed lock performs a lock operation on the target shared resource, it is determined whether the lock is successfully locked within the lock waiting time, and the lock result is returned to the lock implementation.

8. The control method according to claim 6, characterized in that: The control method further comprises: Receiving a lock release timeout determined by the financial distributed system according to a business scenario through a lock release timeout configuration interface in the implementation engine; When the management engine calls the lock implementation corresponding to the target distributed lock, the lock implementation is controlled to use the lock release timeout as a calling parameter of the functional interface of the target distributed lock and call the functional interface of the target distributed lock, so that the server corresponding to the target distributed lock can determine whether the lock of the target shared resource is released within the lock release timeout after successfully performing the locking operation on the target shared resource. If not, the lock of the target shared resource is released.

9. The control method according to claim 6, characterized in that: The control method further comprises: The configuration engine is controlled to determine a target data source for the target distributed lock operation according to the distributed lock configuration information.

10. The control method according to claim 9, characterized in that: The control method further comprises: When a node in the financial distributed system accesses the shared resources in the target data source, the management engine is controlled to call the lock implementation corresponding to the target distributed lock in the implementation engine, so that the lock implementation calls the functional interface of the target distributed lock to perform locking or unlocking operations on the shared resources in the target data source.

11. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: When the processor executes the computer program, the control method described in any one of claims 6 to 10 is implemented.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the control method according to any one of claims 6 to 10 is implemented.

13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the control method according to any one of claims 6 to 10 is implemented.