Gateway transaction method and system, computer device
Patent Information
- Application Number
- CN202211536761.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2042-12-02
AI Technical Summary
目前,通道对处理过程组件序列的初始化有不同的方式,组件能力越强大,配置功能越复杂,则其初始化过程越复杂,时间和资源消耗就越大
[0034] The aforementioned gateway transaction method and system, computer equipment, and computer-readable storage medium pre-build a channel cache manager. When transaction instructions need to be processed, the system checks if a pre-configured channel instance exists in the channel cache manager for processing transaction information. If a pre-configured channel instance exists, it is invoked to process the transaction information. If a channel instance in the channel cache manager is available for processing transaction information, a new channel is created. This gateway transaction channel caching and acceleration method ensures the dynamic updating, deployment, and refresh characteristics of channels in the channel cache manager while reducing the resource and time consumption of channel re-initialization. In other words, when a channel instance available for processing transaction information exists in the channel cache manager, the channel instance can be directly invoked without initialization.
Smart Images

Figure CN115809143B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and in particular to a gateway transaction method and system, computer equipment, and computer-readable storage medium. Background Technology
[0002] In general gateway transaction systems, channels, processors, or pipelines typically act as integrators of a complete processing flow, connecting all the code components that need to run throughout the process. To improve channel flexibility, general gateway transaction systems generally support channel configurability. Currently, channels initialize the sequence of processing components in different ways. The more powerful the component and the more complex the configuration, the more complex its initialization process, and the greater the time and resource consumption. If the channel is re-initialized every time a transaction request enters, it will result in significant system resource consumption, prolong transaction processing time, and degrade system performance. Summary of the Invention
[0003] In view of this, it is necessary to provide a gateway transaction method and system, computer equipment, and computer-readable storage medium to reduce the resource and time consumption of channel reinitialization.
[0004] In a first aspect, embodiments of this application provide a gateway transaction method, the gateway transaction method comprising:
[0005] When a transaction instruction is received, it is determined whether there is a channel instance in the channel cache manager that corresponds to the target channel name. The transaction instruction includes transaction information and a target channel name. The channel cache manager is configured with several channel instances, and each channel instance includes a channel name.
[0006] When a channel instance corresponding to the target channel name exists in the channel cache manager, the channel instance is invoked to process the transaction information;
[0007] When no channel instance corresponding to the target channel name exists in the channel cache manager, a new channel is created based on the target channel name; and
[0008] The new channel is invoked to process the transaction information.
[0009] Optionally, the channel cache manager includes several cache pools, each corresponding one-to-one with a channel instance, and each cache pool caches several threads; calling the channel instance to process the transaction information specifically includes:
[0010] The transaction information is processed by invoking the thread corresponding to the channel instance.
[0011] Optionally, before determining whether a channel instance corresponding to the target channel name exists in the channel cache manager, the gateway transaction method further includes:
[0012] When a process start instruction is received, a first number of cache objects are created in the channel cache manager according to the thread value and channel value in the process start instruction. The process start instruction includes a thread value and a channel value, and the first number is the product of the thread value and the channel value.
[0013] Optionally, creating a first number of cache objects in the channel cache manager based on the thread value and the channel value specifically includes:
[0014] Create a second number of channel instances in the channel cache manager based on the channel value, wherein the second number is the same as the channel value; and
[0015] Based on the thread value, a third number of threads are created in the cache pool corresponding to each of the channel instances, wherein the third number is the same as the thread value, and the cache object corresponds one-to-one with all threads in the channel cache manager.
[0016] Optionally, creating a new channel based on the target channel name specifically includes:
[0017] Select one cache pool from all the cache pools mentioned as the target cache pool;
[0018] Clear the cached objects in the target cache pool;
[0019] Create a new channel corresponding to the cache pool, wherein the channel name of the new channel is the target channel name; and
[0020] Initialize the new channel.
[0021] Optionally, the channel cache manager further includes a cleanup interface, which specifically includes clearing the cache objects in the target cache pool:
[0022] Call the cleanup interface to clear the cached objects in the target cache pool.
[0023] Secondly, embodiments of this application provide a computer device, the computer device comprising:
[0024] Memory, used to store program instructions; and
[0025] A processor for executing the program instructions to implement the gateway transaction method as described above.
[0026] Thirdly, embodiments of this application provide a gateway transaction system, which includes a channel cache manager and comprises:
[0027] The judgment module is used to determine whether there is a channel instance corresponding to the target channel name in the channel cache manager when a transaction instruction is received. The transaction instruction includes transaction information and a target channel name. The channel cache manager is configured with a number of channel instances, and each channel instance includes a channel name.
[0028] The first calling module is used to call the channel instance to process the transaction information when there is a channel instance in the channel cache manager that corresponds to the target channel name;
[0029] A creation module is used to create a new channel based on the target channel name when no channel instance corresponding to the target channel name exists in the channel cache manager; and
[0030] The second calling module is used to call the new channel to process the transaction information.
[0031] Optionally, the channel cache manager includes several cache pools, each corresponding one-to-one with a channel instance, and each cache pool caches several threads; the first calling module includes:
[0032] The sub-call module is used to invoke the thread corresponding to the channel instance to process the transaction information.
[0033] Fourthly, embodiments of this application provide a computer-readable storage medium for storing computer program instructions, which are executed by a processor to implement the gateway transaction method described above.
[0034] The aforementioned gateway transaction method and system, computer equipment, and computer-readable storage medium pre-build a channel cache manager. When transaction instructions need to be processed, the system checks if a pre-configured channel instance exists in the channel cache manager for processing transaction information. If a pre-configured channel instance exists, it is invoked to process the transaction information. If a channel instance in the channel cache manager is available for processing transaction information, a new channel is created. This gateway transaction channel caching and acceleration method ensures the dynamic updating, deployment, and refresh characteristics of channels in the channel cache manager while reducing the resource and time consumption of channel re-initialization. In other words, when a channel instance available for processing transaction information exists in the channel cache manager, the channel instance can be directly invoked without initialization. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0036] Figure 1 This is a first flowchart of a gateway transaction method provided in an embodiment of this application.
[0037] Figure 2 This is a second flowchart of the gateway transaction method provided in an embodiment of this application.
[0038] Figure 3 This is a first sub-flowchart of the gateway transaction method provided in an embodiment of this application.
[0039] Figure 4 This is a second sub-flowchart of the gateway transaction method provided in the embodiments of this application.
[0040] Figure 5 This is a schematic diagram illustrating an application scenario of the gateway transaction method provided in this application embodiment.
[0041] Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application.
[0042] Figure 7 This is a schematic diagram of the internal structure of the gateway transaction system provided in an embodiment of this application.
[0043] Figure 8 for Figure 7 The diagram shows the internal structure of the first calling module of the gateway transaction system.
[0044] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0046] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar planned objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data are interchangeable where appropriate; in other words, the described embodiments are implemented according to a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, may also include other content; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0047] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" and "second" may explicitly or implicitly include one or more of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0048] Please refer to the following: Figure 1 and Figure 5 , Figure 1 This is a first flowchart of the gateway transaction method provided in an embodiment of this application. Figure 5 This diagram illustrates an application scenario of the gateway transaction method provided in this embodiment. The gateway transaction method is applied in the fintech field, processing transaction instructions through a channel. In this embodiment, the channel acts as an integrator of a complete processing flow, connecting all the code components that need to run throughout the entire process.
[0049] by Figure 5 Taking the illustrated application scenario as an example, the trading platform 30 includes a processing device 31 and a channel cache manager 32, which are communicatively connected. In this embodiment, the trading platform 30 is used to execute a gateway trading method. The functions of the processing device 31 and the channel cache manager 32 can be implemented by a single device, multiple devices working together, or one or more functional modules within a single device; no specific limitations are made here. It is understood that the aforementioned functions can be network elements in hardware devices, software functions running on dedicated hardware, a combination of hardware and software, or virtualization functions instantiated on a platform (e.g., a cloud platform).
[0050] The gateway transaction method specifically includes the following steps.
[0051] Step S102: When a transaction instruction is received, determine whether there is a channel instance in the channel cache manager that corresponds to the target channel name.
[0052] The trading platform 30 is communicatively connected to the user terminal and the business system, allowing the user terminal and the business system to send trading instructions to the trading platform 30. Each trading instruction includes trading information and a target channel name. In this embodiment, the target channel name is used to specify a channel, and the specified channel is used to process the corresponding trading information.
[0053] When a transaction instruction is received, the processing device 31 determines whether a channel instance corresponding to the target channel name exists in the channel cache manager 32. In this embodiment, the channel cache manager 32 has several channel instances, each including a channel name. That is, there is a one-to-one correspondence between channels and channel names. It can be understood that the processing device 31 searches for a channel instance in the channel cache manager 32 whose channel name is the same as the target channel name. Preferably, the channel cache manager 32 holds all available instances of channels within the current process.
[0054] The channel cache manager 32 is held by the upper-layer code of the trading platform 30, which includes, but is not limited to, channel routing components and communication components. In this embodiment, the upper-layer code is the processing device 31. When the upper-layer code obtains a channel instance, it needs to first check whether there is a channel instance in the channel cache manager 32. Therefore, when the upper-layer code calls the channel cache manager 32, it uses the target channel name as the search condition to search for a matching channel instance in the channel cache manager 32.
[0055] In this embodiment, the channel cache manager 32 includes several cache pools, each corresponding to a channel instance. The channel cache manager 32 maintains a cache pool for each channel instance, using the channel name as the key. Each cache pool caches several threads, with the thread ID as the key. Preferably, the threads cached in each cache pool are identical. That is, if the current process includes N threads, all N threads are cached in each cache pool. It is understood that each channel instance references several threads, thus satisfying thread safety requirements.
[0056] If a channel instance corresponding to the target channel name exists in the channel cache manager, proceed to step S104; if no channel instance corresponding to the target channel name exists in the channel cache manager, proceed to step S106.
[0057] Step S104: Call the channel instance to process the transaction information.
[0058] When a channel instance corresponding to the target channel name exists in the channel cache manager 32, the processing device 31 calls the corresponding channel instance to process the transaction information.
[0059] The specific steps of processing transaction information by calling a channel instance include: calling the thread corresponding to the channel instance to process the transaction information.
[0060] Processing device 31 invokes a thread in the cache pool corresponding to the channel instance to process the transaction information. Understandably, when a matching channel instance is available in the channel cache manager 32, processing device 31 directly returns the cache and uses it.
[0061] Step S106: Create a new channel based on the target channel name.
[0062] When no channel instance corresponding to the target channel name exists in the channel cache manager 32, the processing device 31 creates a new channel based on the target channel name. In this embodiment, when no matching channel instance is available in the channel cache manager 32, the processing device 31 creates a new channel and initializes it. Preferably, the new channel is built into the channel cache manager 32 to prevent defects in the upper-level code's handling of creation rules and caching logic.
[0063] The specific process of creating a new channel based on the target channel name will be described in detail below.
[0064] Step S108: Call the new channel to process the transaction information.
[0065] After creating the new channel, processing device 31 calls the new channel to process the transaction information. Accordingly, processing device 31 calls the thread in the cache pool corresponding to the new channel to process the transaction information.
[0066] In the above embodiments, a channel cache manager is pre-built. When transaction instructions need to be processed, it is determined whether a pre-configured channel instance exists in the channel cache manager that can be used to process transaction information. If a pre-configured channel instance exists in the channel cache manager, it is invoked to process the transaction information. If a channel instance in the channel cache manager can be used to process transaction information, a new channel is created. This method of gateway transaction channel caching and acceleration ensures the dynamic updating, deployment, and refresh characteristics of channels in the channel cache manager while reducing the resource and time consumption of channel re-initialization. In other words, when a channel instance exists in the channel cache manager that can be used to process transaction information, the channel instance can be directly invoked without initialization.
[0067] Please refer to the following: Figure 2 and Figure 3 , Figure 2 This is a second flowchart of the gateway transaction method provided in the embodiments of this application. Figure 3 This is a first sub-flowchart of the gateway transaction method provided in an embodiment of this application. Before executing step S102, the gateway transaction method further includes the following steps.
[0068] Step S101: When a process start instruction is received, a first number of cache objects are created in the channel cache manager according to the thread value and channel value in the process start instruction.
[0069] The administrator of trading platform 30 can input a process start command through trading platform 30 to initiate the gateway trading process. This process start command includes a thread value and a channel value. The specific values of the thread value and channel value can be set according to actual business needs and are not limited here.
[0070] Upon receiving a process start command, processing device 31 creates cache objects in channel cache manager 32 based on the thread value and channel value in the process start command. It is understood that after the gateway transaction process starts, processing device 31 will gradually create cache objects during the initial stage of the transaction platform 30's operation. In this embodiment, the number of cache objects is a first quantity, which is the product of the thread value and the channel value.
[0071] The process of creating the first number of cache objects in the channel cache manager based on the thread value and channel value in the process startup instruction includes the following steps.
[0072] Step S302: Create a second number of channel instances in the channel cache manager based on the channel value.
[0073] Processing device 31 creates a second number of channel instances in channel cache manager 32. This second number is the same as the channel value. In other words, the channel value specifies the number of channel instances.
[0074] Step S304: Create a third number of threads in the cache pool corresponding to each channel instance based on the thread value.
[0075] Processing device 31 creates a third number of threads in the cache pool corresponding to each channel instance. This third number is the same as the thread value; that is, the thread value specifies the number of threads. In this embodiment, processing device 31 creates a third number of threads in all cache pools. Each cache object corresponds one-to-one with all threads in the channel cache manager 32.
[0076] For example, if the process startup instruction includes a thread value of 20 and a channel value of 1, then the channel cache manager 32 has only one channel instance, and the corresponding cache pool has 20 threads. Accordingly, the channel cache manager 32 can have a maximum of 1 * 20 cache objects. If the process startup instruction includes a thread value of 20 and a channel value of 2, then the channel cache manager 32 has two channel instances, and the corresponding two cache pools each have 20 threads. Accordingly, the channel cache manager 32 can have a maximum of 2 * 20, or 40, cache objects.
[0077] Once all cached objects are created, every subsequent call to process transaction information will use the already cached channel instance.
[0078] In the above embodiments, a corresponding number of cache objects are created in the channel cache manager according to the process startup instruction. This reduces the resource overhead of creating a channel instance that would have originally required the same amount of time as the number of transactions to be processed to the product of the channel value and the thread value, i.e., the resource overhead of creating the first number of cache objects. This greatly reduces the resource overhead.
[0079] Please refer to the following: Figure 4 This is the second sub-flowchart of the gateway transaction method provided in the embodiments of this application. Step S106 specifically includes the following steps.
[0080] Step S402: Select one cache pool from all cache pools as the target cache pool.
[0081] Processing device 31 randomly selects a cache pool from all cache pools as the target cache pool.
[0082] Step S404: Clear the cached objects in the target cache pool.
[0083] Processing device 31 clears the cached objects in the target cache pool.
[0084] In this embodiment, the channel cache manager 32 also includes a cleanup interface.
[0085] Clearing cached objects in the target cache pool specifically includes calling the cleanup interface to clear cached objects in the target cache pool.
[0086] The channel cache manager 32 provides a cleanup interface, and the processing device 31 calls the cleanup interface to clear the cache objects in the target cache pool.
[0087] Step S406: Create a new channel corresponding to the cache pool.
[0088] Processing device 31 creates a new channel corresponding to the cache pool. The channel name of this new channel is the target channel name. In this embodiment, processing device 31 can configure existing code blocks as components into a concatenated sequence according to the target channel name, thereby forming a complete processing flow, i.e., the new channel. Correspondingly, the new channel will possess the corresponding capabilities according to the requirements in the target channel name. It can be understood that the target channel name contains the channel's requirements.
[0089] Step S408: Initialize the new channel.
[0090] Processing device 31 initializes a new channel.
[0091] In the above embodiments, the channel cache manager is equipped with a cleanup interface, which is called by the trading platform when reloading resources. This interface can clear all caches in the cache pool to maintain the dynamic configuration and loading capacity of the channels. At the same time, it greatly reduces the amount of development work required to create new channels.
[0092] Please refer to the following: Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. The computer device 10 includes a memory 11 and a processor 12. The memory 11 is used to store program instructions, and the processor 12 is used to execute the program instructions to implement the above-described gateway transaction method.
[0093] In some embodiments, the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program instructions stored in the memory 11.
[0094] The memory 11 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of a computer device, such as a hard disk. In other embodiments, the memory 11 may be an external storage device of a computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the memory 11 may include both internal and external storage units of the computer device. The memory 11 can be used not only to store application software and various types of data installed on the computer device, such as code implementing gateway transaction methods, but also to temporarily store data that has been output or will be output.
[0095] Please refer to the following: Figure 7 This is a schematic diagram of the internal structure of the gateway transaction system provided in this application embodiment. The gateway transaction system 20 includes a judgment module 21, a first invocation module 22, a creation module 23, and a second invocation module 24. The gateway transaction system 20 also includes a channel cache manager 25.
[0096] The judgment module 21 is used to determine whether there is a channel instance corresponding to the target channel name in the channel cache manager when a transaction instruction is received.
[0097] The gateway transaction system 20 is communicatively connected to the user terminal and the business system. The user terminal and the business system can send transaction instructions to the gateway transaction system 20. The transaction instruction includes transaction information and the target channel name. In this embodiment, the target channel name is used to specify a channel, and the specified channel is used to process the corresponding transaction information.
[0098] When a transaction instruction is received, the judgment module 21 determines whether a channel instance corresponding to the target channel name exists in the channel cache manager 25. In this embodiment, the channel cache manager 25 has several channel instances, each including a channel name. That is, there is a one-to-one correspondence between channels and channel names. It can be understood that the judgment module 21 searches for a channel instance in the channel cache manager 25 whose channel name is the same as the target channel name. Preferably, the channel cache manager 25 holds all available instances of channels within the current process.
[0099] The channel cache manager 25 is held by the upper-layer code of the gateway transaction system 20. This upper-layer code includes, but is not limited to, channel routing components and communication components. In this embodiment, the upper-layer code includes a judgment module 21, a first invocation module 22, a creation module 23, and a second invocation module 24. When the upper-layer code obtains a channel instance, it first needs to check if there is a channel instance in the channel cache manager 25. Therefore, when the upper-layer code invokes the channel cache manager 25, it uses the target channel name as the search condition to retrieve a matching channel instance from the channel cache manager 25.
[0100] In this embodiment, the channel cache manager 25 includes several cache pools, each corresponding to a channel instance. In the channel cache manager 25, a cache pool corresponding to each channel instance is maintained, using the channel name as the key. Each cache pool caches several threads, and each cache pool uses the thread ID as the key. Preferably, the threads cached in each cache pool are the same. That is, if the current process includes N threads, then all N threads are cached in each cache pool. It can be understood that each channel instance references several threads, thereby satisfying thread safety requirements.
[0101] The first calling module 22 is used to call the channel instance to process the transaction information when there is a channel instance in the channel cache manager that corresponds to the target channel name.
[0102] When a channel instance corresponding to the target channel name exists in the channel cache manager 25, the first calling module 22 calls the corresponding channel instance to process the transaction information.
[0103] Create module 23 to create a new channel based on the target channel name when there is no channel instance corresponding to the target channel name in the channel cache manager.
[0104] When no channel instance corresponding to the target channel name exists in the channel cache manager 25, the creation module 23 creates a new channel based on the target channel name. In this embodiment, when no matching channel instance is available in the channel cache manager 25, the creation module 23 creates a new channel and initializes it. Preferably, the new channel is built into the channel cache manager 25 to prevent defects in the upper-level code's handling of creation rules and caching logic.
[0105] The second calling module 24 is used to call the new channel to process transaction information.
[0106] After the new channel is created, the second calling module 24 calls the new channel to process the transaction information. Accordingly, the second calling module 24 calls the thread in the cache pool corresponding to the new channel to process the transaction information.
[0107] Please refer to the following: Figure 8 This is a schematic diagram of the internal structure of the first calling module provided in the embodiments of this application. The first calling module 22 includes a sub-calling module 220.
[0108] Sub-call module 220 is used to call the thread corresponding to the channel instance to process transaction information.
[0109] Sub-call module 220 invokes a thread in the cache pool corresponding to the channel instance to process the transaction information. Understandably, when a matching channel instance is available in the channel cache manager 25, sub-call module 220 directly returns the cache and uses it.
[0110] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
[0111] The above-listed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A gateway transaction method, characterized in that, The gateway transaction method includes: When a transaction instruction is received, it is determined whether there is a channel instance in the channel cache manager that corresponds to the target channel name. The transaction instruction includes transaction information and the target channel name. The channel cache manager is configured with several channel instances, and each channel instance includes a channel name. When a channel instance corresponding to the target channel name exists in the channel cache manager, the channel instance is invoked to process the transaction information; When no channel instance corresponding to the target channel name exists in the channel cache manager, a new channel is created based on the target channel name; and The new channel is invoked to process the transaction information; The channel cache manager includes several cache pools, each corresponding one-to-one with a channel instance; creating a new channel based on the target channel name specifically includes: Randomly select one cache pool from all the cache pools mentioned as the target cache pool; Clear the cached objects in the target cache pool; Create a new channel corresponding to the cache pool, wherein the channel name of the new channel is the target channel name; and Initialize the new channel.
2. The gateway transaction method as described in claim 1, characterized in that, Each of the aforementioned cache pools caches several threads; the specific steps of calling the channel instance to process the transaction information include: The transaction information is processed by invoking the thread corresponding to the channel instance.
3. The gateway transaction method as described in claim 1, characterized in that, Before determining whether a channel instance corresponding to the target channel name exists in the channel cache manager, the gateway transaction method further includes: When a process start instruction is received, a first number of cache objects are created in the channel cache manager according to the thread value and channel value in the process start instruction. The process start instruction includes a thread value and a channel value, and the first number is the product of the thread value and the channel value.
4. The gateway transaction method as described in claim 3, characterized in that, Creating a first number of cache objects in the channel cache manager based on the thread value and the channel value specifically includes: Create a second number of channel instances in the channel cache manager based on the channel value, wherein the second number is the same as the channel value; and Based on the thread value, a third number of threads are created in the cache pool corresponding to each of the channel instances, wherein the third number is the same as the thread value, and the cache object corresponds one-to-one with all threads in the channel cache manager.
5. The gateway transaction method as described in claim 2, characterized in that, The channel cache manager also includes a cleanup interface, which specifically includes clearing cache objects in the target cache pool: Call the cleanup interface to clear the cached objects in the target cache pool.
6. A computer device, characterized in that, The computer device includes: Memory, used to store program instructions; and A processor for executing the program instructions to implement the gateway transaction method as described in any one of claims 1 to 5.
7. A gateway transaction system, characterized in that, The gateway transaction system is equipped with a channel cache manager. The gateway transaction system includes: The judgment module is used to determine whether there is a channel instance corresponding to the target channel name in the channel cache manager when a transaction instruction is received. The transaction instruction includes transaction information and a target channel name. The channel cache manager is configured with a number of channel instances, and each channel instance includes a channel name. The first calling module is used to call the channel instance to process the transaction information when there is a channel instance in the channel cache manager that corresponds to the target channel name; A creation module is used to create a new channel based on the target channel name when no channel instance corresponding to the target channel name exists in the channel cache manager; and The second calling module is used to call the new channel to process the transaction information; The channel cache manager includes several cache pools, each corresponding one-to-one with a channel instance; creating a new channel based on the target channel name specifically includes: Select one cache pool from all the cache pools mentioned as the target cache pool; Clear the cached objects in the target cache pool; Create a new channel corresponding to the cache pool, wherein the channel name of the new channel is the target channel name; and Initialize the new channel.
8. The gateway transaction system as described in claim 7, characterized in that, Each cache pool caches several threads; the first calling module includes: The sub-call module is used to invoke the thread corresponding to the channel instance to process the transaction information.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store computer program instructions, which are executed by a processor to implement the gateway transaction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Processing method and system of high-performance gateway system based on Netty
CN113641410A