Distributed serial number generation method, device and equipment based on database row lock
CN119311683APending Publication Date: 2025-01-14CPIC ALLIANZ HEALTH INSURANCE CO LTD
-1 Cites -1 Cited by
Patent Information
- Application Number
- CN202411122550.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-01-14
Smart Images

Figure CN119311683A_ABST
Abstract
The invention relates to a distributed serial number generation method, device and equipment based on a database row lock. The method comprises the following steps that when an application program is started, a configuration center loads serial number generator configuration information; packaging the loaded generator configuration information into a class definition by the application program, and injecting the class definition into a spring container; the spring container initializes a serial number generator according to the class definition in the starting process, a database row lock mechanism is used for exclusively occupying a corresponding record, and the current value of the serial number is obtained and updated; the serial number generator is automatically injected into a business object by a spring framework and starts to work; when a certain service requests a serial number, calling a method for generating the serial number by the serial number generator to obtain a serial number; and if the serial number + 1 exceeds the maximum value of the number segment in the memory, updating the number segment, and then generating a serial number for the service to use. Compared with the prior art, the method has the advantages of free control of the length of the serial number, unique serial number, friendly index, simple development and maintenance and the like.
Need to check novelty before this filing date? Find Prior Art