Connection keep-alive method, device, equipment, medium and program product
By detecting connection parameter changes in the connection pool or connection and propagating update events, the problem of connection inactivation caused by connection parameter changes in the prior art is solved, and more efficient connection keep-aliveness and flexibility are achieved.
Patent Information
- Application Number
- CN202510193265.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-06-10
AI Technical Summary
The existing connection keep-alive method cannot effectively keep the created connection when the connection parameters are changed, resulting in the connection being inactivated and the flexibility of keep-alive.
By determining whether the connection parameters have changed in the connection pool or connection, and initiating and propagating update events, synchronously updating the changed connection parameters, to achieve active synchronous update of the connection parameters.
When the connection parameters change, the connection parameters in the connection pool and the connection pool can be updated synchronously in a timely manner to avoid connection inactivation, improve the flexibility of connection keeping, and enhance the response speed and reliability of the communication between the application and the server.
Smart Images

Figure CN120123402A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a connection keep-alive method, apparatus, device, medium, and program product. Background Art
[0002] A connection can refer to a communication channel established between an application program and a server such as a database. For example, through the communication channel, the application program can send query instructions, update requests, and other commands to the database and receive the results returned by the database. Multiple connections can be established between the application program and the database, and these connections can be established based on the same or partially the same connection parameters.
[0003] Generally, on the application program side, a connection pool can be set up to create, allocate, and recycle connections. The connection pool can maintain multiple connections, which are allocated for use when the application program needs them, thus avoiding the creation of new connections every time the application program requests communication. By using the connection pool, the overhead of connection establishment and release can be reduced, and the resource utilization rate of the connections, as well as the performance and response speed of the application program, can be improved.
[0004] When the connections in the connection pool are idle and not allocated for use, they may be in an active state where they remain valid or in an inactive state where they are no longer valid. After a connection becomes inactive, normal communication cannot be achieved. Therefore, the connection pool usually uses some connection keep-alive methods to detect the activity of the connections and handle the inactive connections.
[0005] When creating a connection, it is created based on connection parameters. During the interaction between the application program and the database, if the connection parameters change, the established connections may become inactive. Existing connection keep-alive methods can only detect the activity of the connections in the connection pool or reconstruct inactive connections, and cannot keep the created connections alive when the connection parameters change. Therefore, the flexibility of existing connection keep-alive methods is relatively low. Summary of the Invention
[0006] Embodiments of this application provide a connection keep-alive method, apparatus, device, medium, and program product, so as to achieve the effect of keeping the connections in the connection pool alive when the connection parameters change, and improve the flexibility of connection keep-alive.
[0007] In a first aspect, an embodiment of the present application provides a connection keep-alive method, and the method includes: determining whether there is a change in connection parameters according to a connection pool or a connection in the connection pool, where the connection parameters are used to configure a connection when creating or using the connection; initiating and propagating an update event for updating the connection parameters when it is determined that there is a change in the connection parameters in the connection pool or any of the connections; and synchronously updating the changed connection parameters to the connection pool and / or the connections in the connection pool by propagating the update event.
[0008] In a possible implementation manner, the initiating and propagating an update event for updating the connection parameters includes: the determiner that determines that there is a change in the connection parameters initiates an update event for updating the connection parameters; calculates a hash value corresponding to the current connection parameters of the determiner, and propagates the update event based on the hash value.
[0009] In a possible implementation manner, the connection parameters include public parameters, and the public parameters are basic parameters used when the connection pool creates any connection. The calculating a hash value corresponding to the current connection parameters of the determiner and propagating the update event based on the hash value includes: calculating a total hash value corresponding to all the current public parameters of the determiner, and calculating sub-hash values corresponding to each of the current public parameters of the determiner; and propagating the update event based on the total hash value and each of the sub-hash values.
[0010] In a possible implementation manner, the propagating the update event based on the total hash value and each of the sub-hash values includes: for any recipient to which the update event is propagated, calculating a total hash value corresponding to all the current public parameters of the any recipient; comparing whether the total hash value of the determiner is the same as the total hash value of the any recipient; when the total hash value of the determiner is not the same as the total hash value of the any recipient, calculating sub-hash values corresponding to each of the current public parameters of the any recipient; correspondingly comparing whether each of the sub-hash values of the determiner is the same as each of the sub-hash values of the any recipient, and determining at least one pair of target sub-hash values with different hash values; for any pair of the target sub-hash values, updating the public parameter corresponding to the target sub-hash value of the any recipient to the public parameter corresponding to the target sub-hash value of the determiner value.
[0011] In a possible implementation, the connection parameters include private parameters, where the private parameters are specified parameters configured to meet the connection requirements of the connection when the connection pool creates a connection. When the determiner is any one of the connections, calculating the hash value corresponding to the current connection parameters of the determiner and propagating the update event based on the hash value includes: calculating the private hash value corresponding to each current private parameter of the determiner; propagating the update event based on each private hash value.
[0012] In a possible implementation, the update event is propagated using a random propagation protocol.
[0013] In a second aspect, an embodiment of the present application provides a connection keep-alive device, where the device includes: a determination module, configured to determine whether there is a change in connection parameters according to the connection pool or a connection in the connection pool, where the connection parameters are used to configure a connection when creating or using the connection; an update module, configured to initiate and propagate an update event for updating the connection parameters when it is determined that there is a change in the connection parameters in the connection pool or any one of the connections; the update module is further configured to synchronize the updated connection parameters to the connection pool and / or the connections in the connection pool by propagating the update event.
[0014] In a possible implementation, the update module is specifically configured to: initiate, by the determiner that determines that there is a change in the connection parameters, an update event for updating the connection parameters; calculate the hash value corresponding to the current connection parameters of the determiner, and propagate the update event based on the hash value.
[0015] In a possible implementation, the connection parameters include public parameters, where the public parameters are basic parameters used by the connection pool when creating any connection. The update module is specifically configured to: calculate the total hash value corresponding to all current public parameters of the determiner, and calculate the sub-hash value corresponding to each current public parameter of the determiner; propagate the update event based on the total hash value and each sub-hash value.
[0016] In a possible implementation manner, the update module is specifically configured to: for any recipient to which the update event propagates, calculate the total hash value corresponding to all the current public parameters of the any recipient; compare whether the total hash value of the determiner is the same as the total hash value of the any recipient; in the case where the total hash value of the determiner is different from the total hash value of the any recipient, calculate the sub-hash value corresponding to each of the current public parameters of the any recipient; correspondingly compare whether each of the sub-hash values of the determiner is the same as each of the sub-hash values of the any recipient, and determine at least one pair of target sub-hash values with different hash values; for any pair of the target sub-hash values, update the public parameter corresponding to the target sub-hash value of the any recipient to the public parameter corresponding to the target sub-hash value of the determiner value.
[0017] In a possible implementation manner, the connection parameter includes a private parameter, and the private parameter is a specified parameter configured to meet the connection requirements of the connection when the connection pool creates the connection. In the case where the determiner is any one of the connections, the update module is specifically configured to: calculate the private hash value corresponding to each of the current private parameters of the determiner; propagate the update event based on each of the private hash values.
[0018] In a possible implementation manner, the update event is propagated using a random propagation protocol.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the first aspect and / or various possible implementation manners of the first aspect as above.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored, and when the computer execution instructions are executed by a processor, they are used to implement the first aspect and / or various possible implementation manners of the first aspect as above.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the first aspect and / or various possible implementation manners of the first aspect as above.
[0022] The connection keep-alive method, device, equipment, medium and program product provided by the embodiments of the present application can determine whether there is a change in connection parameters according to a connection pool or connections in the connection pool, and initiate and propagate an update event for updating the connection parameters when it is determined that there is a change in the connection parameters. By propagating this update event, the connection parameters of the connection pool and / or the connections in the connection pool can be updated, and the corresponding connection parameters can be synchronized to the changed connection parameters. In this way, by initiating and propagating the update event, when one or more connection parameters change, the connection parameters of the connection pool and / or each connection in the connection pool can be synchronized and updated in a timely manner, realizing the active synchronous update of the connection parameters, avoiding connection inactivation caused by changes in the connection parameters, and thus improving the flexibility of connection keep-alive. Since the connection keep-alive method provided by the embodiments of the present application can improve the flexibility of connection keep-alive, the connections in the connection pool can maintain their activity for a longer time, and the connection pool can quickly allocate connections in the keep-alive state to the application program when the application program needs to communicate with the server, which can improve the response speed of the communication between the application program and the server and also enhance the reliability and stability of the application program. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0024] Figure 1 A schematic diagram of a connection pool and connections provided by the embodiments of the present application;
[0025] Figure 2 A flowchart of the connection keep-alive method provided by the embodiments of the present application Figure 1 ;
[0026] Figure 3 A schematic diagram of the hash value corresponding to the connection parameters provided by the embodiments of the present application;
[0027] Figure 4 A flowchart of the connection keep-alive method provided by the embodiments of the present application Figure 2 ;
[0028] Figure 5 A schematic diagram of the structure of the connection keep-alive device provided by the embodiments of the present application;
[0029] Figure 6 A schematic diagram of the structure of an electronic device provided by the embodiments of the present application.
[0030] Through the above-mentioned accompanying drawings, specific embodiments of the present application have been shown, and will be described in more detail hereinafter. These drawings and the textual description are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Description of the Embodiments
[0031] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0032] In the technical solution of the embodiments of the present application, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information and other processing all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0033] It should be noted that the user information (including but not limited to the user device information, user personal information, etc.) and data (including but not limited to the data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for the user to select authorization or rejection.
[0034] In the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, using words such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0035] In the embodiments of the present application, if words such as "first" and "second" are used, it is to distinguish the same items or similar items with basically the same functions and roles. For example, the first electronic device and the second electronic device are only used to distinguish different electronic devices, and do not limit their sequence. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit being different.
[0036] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the front and back associated objects.
[0037] The connection pool can be applied to application programs that connect to a server such as a database. The application program can be any application program that communicates with a server such as a database. For example, it can be an application program of a data management system, an application program of a social service platform, or an application program of an online financial service, etc.
[0038] The application program can create and maintain multiple connections through the connection pool. When the application program needs to communicate with the server, the connection pool can preferentially allocate, among the multiple created connections, the connections that meet the communication requirements of the application program for this communication to the application program for use, so as to improve the performance and response speed of the application program. Moreover, through the connection pool, the resource utilization rate of the connections can also be improved, without creating the same connection multiple times, and the efficient utilization of the hardware computing resources can be realized.
[0039] When creating a connection, it is necessary to configure the connection, or during the use of the connection, it may also be necessary to configure the connection being used. The parameters for configuring the connection can be understood as connection parameters. The connection parameters can include public parameters and private parameters. Among them, the public parameters can be understood as the basic parameters necessary for configuring the connection, and the private parameters can be understood as the personalized parameters configured to meet the communication requirements of a certain communication connection.
[0040] Figure 1 The following is a schematic diagram of the connection pool and the connection provided by the embodiments of the present application, as Figure 1 shown, the connection pool can store at least one public parameter, such as public parameter 1, public parameter 2, public parameter 3, and public parameter n, etc. The connection pool can perform basic configuration on the connection through the public parameters to create one or more connections, so as to pre-establish one or more communication channels. The public parameters can also be called common parameters. For example, they can be parameters such as server address, port number, username, password, or timeout setting. In addition to inheriting the public parameters of the connection pool, some connections in the connection pool may also include private parameters.
[0041] When creating a certain connection, one or more private parameters are usually also used to configure the connection to meet the communication requirements during communication. The private parameters can be, for example, parameters such as whether case sensitivity or client encoding is set for the current connection. The private parameters of the connections corresponding to different communication requirements of the application may vary. For example, in some communications, the data transmitted does not need to distinguish between uppercase and lowercase, so the private parameters of the corresponding connection include private parameters configured to be case-insensitive; in other communications, the data transmitted needs to distinguish between uppercase and lowercase, so the private parameters of the corresponding connection include private parameters configured to be case-sensitive. Due to the similarities and differences of the private parameters, any two connections in the connection pool may be the same connection or different connections.
[0042] In practical applications, since the application and the server may switch between multiple server addresses, or the port number used by the application for the server needs to be changed, or the application needs to change the username or password for logging in to the server, or other change operations, it will cause the connection parameters of the connection to change. Since the connection parameters have changed, it may cause the configuration of some or all of the currently existing connections in the connection pool to become invalid, and then cause these connections to become inactivated; even when the public parameters change and the public parameters stored in the connection pool are not updated to the changed public parameters in time, it will cause the newly created connections in the connection pool to be unable to communicate normally in the future, resulting in the inactivation of the newly created connections.
[0043] In the existing connection pool, the liveness detection or connection keep-alive of the connection is usually achieved by periodically checking the liveness of the connection, using heartbeat messages to check the liveness of the connection, or checking and restoring the liveness of the connection through the code of the application.
[0044] The method of periodically checking the liveness of the connection is usually to periodically check whether the connections in the connection pool are valid through a background thread in the driver to judge the liveness of the connection. The method of using heartbeat messages to check the liveness of the connection is usually that the client of the application sends a request to the server every once in a while to check whether the connections in the connection pool are still valid. If the request cannot be normally connected, it means that the connection has lost its liveness, and then a new connection can be re-established after detection. The method of checking and restoring the liveness of the connection through the code of the application is usually to add logic in the code of the application to periodically check the status of the connection and recreate a new connection when necessary.
[0045] When the public parameters change, since the existing keep-alive method does not have a mechanism to synchronously update the public parameters in the connection pool in a timely manner, it is unable to quickly synchronize the changed public parameters to the connection pool and each connection in the connection pool, resulting in the inactivation of existing connections and some newly created connections. Additionally, when using the existing method to recover an inactivated connection, it is necessary to synchronize the latest parameter settings of the current database and other server sides. However, some of the latest parameter settings are saved on the connections in use, and the connections created using the public parameters in the connection pool may have a delay, causing the newly created connections to also become inactivated.
[0046] It can be seen that the existing methods mainly detect the activity of connections. Although some methods can recreate new connections when detecting that a connection is inactivated, if all connections become inactivated due to only a small number of connection parameter changes, rebuilding all connections will consume a lot of time and computational overhead. Since the existing methods cannot actively synchronously update the changed connection parameters when the connection parameters change, the existing methods are all passive keep-alive methods, with relatively low keep-alive flexibility.
[0047] In view of this, the embodiments of the present application provide a connection keep-alive method to improve the keep-alive flexibility of the connection pool connections. This method can determine whether there are changes in connection parameters based on the connection pool or the connections in the connection pool, and when it is determined that there are changes in connection parameters, initiate and propagate an update event, which is used to update the connection parameters of the connection pool and / or the connections. In this way, by initiating and propagating the update event, when the connection parameters change, the connection parameters of the connection pool and / or each connection in the connection pool can be synchronously updated in a timely manner, realizing the active synchronous update of connection parameters, avoiding connection inactivation caused by changes in connection parameters, and thus improving the keep-alive flexibility of connection keep-alive.
[0048] The technical solutions of the present application will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0049] Figure 2 is a flowchart of the connection keep-alive method provided by the embodiments of the present application Figure 1 , and the execution subject of this method can be an electronic device with corresponding data storage capabilities and computing capabilities, such as a computer, a server, or a server cluster, etc. As Figure 2 shown, this method includes:
[0050] S201, determine whether there are changes in connection parameters according to the connection pool or the connections in the connection pool, where the connection parameters are used to configure the connection when creating or using the connection.
[0051] Exemplarily, the connection parameter can be any parameter used to configure the connection. The connection parameter can include public parameters and private parameters. For example, it can be a server address, port number, username, password, timeout setting, parameter for setting whether case-sensitive, or client encoding, etc.
[0052] Among them, the timeout setting can be understood as the longest waiting time set for the Transmission Control Protocol (TCP). The client encoding is, for example, 8-bit Unicode Transformation Format (UTF-8) or Chinese Internal Code Specification (GBK), etc.
[0053] When creating a connection pool, multiple connection parameters can be set and saved in the connection pool, and the connection pool can create one or more connections according to the saved connection parameters.
[0054] During the process of a certain connection being used by an application, the application may perform change operations such as switching the server address or modifying the password, resulting in a change in the connection parameter. At this time, the connection can determine whether there is a change in the connection parameter by comparing the previous connection parameter and the changed connection parameter.
[0055] In some scenarios, the application may perform a change operation to modify the connection parameters saved in the connection pool, resulting in a change in the connection parameter. At this time, the connection pool can determine whether there is a change in the connection parameter by comparing the previous connection parameter of the connection pool and the changed connection parameter.
[0056] S202, in the case where the connection pool or any connection determines that there is a change in the connection parameter, initiate and propagate an update event for updating the connection parameter.
[0057] Exemplarily, in the case where the connection pool or any connection determines that there is a change in the connection parameter, the connection pool or the connection can initiate and propagate an update event for updating the connection parameter. For example, the update event can be an update event that completes the synchronous update of the connection parameters of the connection pool and each connection in the connection pool by calling a preset instruction or code.
[0058] For example, if the connection parameters determined by the connection pool change, the connection pool can call a preset instruction to initiate an update event and propagate the update event among the connections to synchronously update the connection parameters of each connection in the connection pool. If a connection in the connection pool determines that the connection parameters have changed, the connection can call a preset instruction to initiate an update event and propagate the update event between the connection pool and other connections to synchronously update the connection parameters of the connection pool and other connections except this connection.
[0059] S203. Synchronously update the changed connection parameters for the connection pool and / or the connections in the connection pool by propagating the update event.
[0060] Exemplarily, when synchronously updating the changed connection parameters for the connection pool and / or the connections in the connection pool by propagating the update event, it can be based on a comparison between the current connection parameters of the connection and / or the connection pool and the changed connection parameters before performing the synchronous update.
[0061] For example, if the public parameter 1 of connection 1 changes to public parameter 1a, connection 1 can initiate and propagate an update event. When the update event propagates to connection 2, connection 2 can compare whether its own public parameter 1 is the same as public parameter 1a. Since it is determined that public parameter 1 and public parameter 1a are different after the comparison, the public parameter 1 of connection 2 can be synchronously updated to public parameter 1a to complete the synchronous update of the connection parameters of connection 2, thereby ensuring the survival of connection 2.
[0062] For another example, both the public parameter 1 and the private parameter 1 of connection 1 have changed. The public parameter 1 has changed to public parameter 1a, and the private parameter 1 has changed to private parameter 1a. Then connection 1 can initiate and propagate an update event. When this update event propagates to connection 2 and the connection pool, connection 2 can compare whether its own public parameter 1 is the same as public parameter 1a, and compare whether its own private parameter 1 is the same as private parameter 1a. After comparison, if it is determined that the public parameter 1 is different from public parameter 1a, its own public parameter 1 can be synchronously updated to public parameter 1a. After comparison, if it is determined that the private parameter 1 is different from private parameter 1a, its own private parameter 1 can be synchronously updated to private parameter 1a. In this way, connection 2 has completed the synchronous update of the connection parameters and keeps connection 2 alive. Since the private parameter is not saved in the connection pool and only the public parameter is saved, after the update event propagates to the connection pool, the connection pool can compare whether its own public parameter 1 is the same as public parameter 1a, without comparing private parameter 1a. If the connection pool determines that its own public parameter 1 is different from public parameter 1a after comparison, its own public parameter 1 can be synchronously updated to public parameter 1a. In this way, the connection parameters of the connection pool are updated to the changed connection parameters. When the connection pool creates a new connection later, the newly created connection will inherit public parameter 1a, and public parameter 1a is a valid public parameter. Therefore, the newly created connection can also be kept alive.
[0063] Exemplarily, when an update event propagates to a certain connection or the connection pool, the connection or the connection pool can determine whether to update the connection parameters. When it is determined that the changed connection parameters propagated are the connection parameters that need to be synchronously updated by itself, the corresponding connection parameters in itself can be updated according to the changed connection parameters propagated.
[0064] Since the connection parameters of two different connections are not necessarily the same set of connection parameters, by using the method of this embodiment for update, the connection parameters that need to be synchronously updated can be synchronously updated according to the actual situation of each connection parameter of the connection or the connection pool, and the connection parameters that do not need to be changed can be not synchronously updated. In this way, the actual configuration of the connection or the connection pool can be maintained, avoiding the connection failure caused by the disorder of synchronous update, and improving the reliability and applicability of the synchronous update of the connection parameters.
[0065] For example, if both private parameter 1 and private parameter 2 of connection 1 have changed, private parameter 1 has changed to private parameter 1a, and private parameter 2 has changed to private parameter 2a, connection 1 can initiate and propagate an update event. When the update event is propagated to connection 2, connection 2 can first determine whether it contains private parameter 1 and private parameter 2. Assuming that connection 2 only contains private parameter 2 but not private parameter 1, it can only compare whether private parameter 2 and the propagated private parameter 2a are the same. Since it is determined after comparison that private parameter 2 is different from private parameter 2a, its own private parameter 2 can be synchronously updated to private parameter 2a, so that connection 2 can effectively update the connection parameters that need to be updated while maintaining the original configuration items, so that connection 2 can be kept alive. If the update event is propagated to the connection pool, the connection pool can determine that the connection pool does not contain private parameter 1 and private parameter 2, and it can not update the connection parameters saved by itself.
[0066] Exemplarily, when propagating update events, any event propagation method can be used to propagate the update events, and the connection parameters of the connection pool and / or the connections in the connection pool can be synchronized through the update events, so that the connections that have been created or subsequently created continue to remain active, so that the application can quickly allocate a suitable connection when it needs to use the connection.
[0067] When propagating update events, you can use the priority propagation method. For example, you can pre-set the propagation priority, such as setting the connection pool priority higher than the connection priority. After one of the connections initiates an update event, you can first propagate the update event to the connection pool, update the connection parameters of the connection pool first, and then propagate the update event to other connections to update the connection parameters. In this way, after a connection initiates an update event, the connection parameters of the connection pool can be quickly updated and synchronized, and the newly created connection can be prevented from being deactivated due to the delay in updating the connection parameters of the connection pool, thereby improving the reliability of connection keepalive.
[0068] In a possible implementation, update events are propagated using a random propagation protocol.
[0069] Exemplarily, the random propagation protocol may be, for example, a gossip protocol. The gossip protocol is a decentralized protocol that can realize information propagation and state synchronization between nodes, and can gradually spread the information to be propagated to the entire environment through randomly selected nodes. The gossip protocol can be a multi-master protocol, and all write operations can be initiated by different nodes and synchronized to other nodes. That is, the operation of synchronizing parameters can be initiated by the connection pool or any connection when its connection parameters change.
[0070] For example, when the connection parameters of a connection change, the connection can initiate an update event and randomly propagate the update event to one connection, multiple connections, or a connection pool based on the gossip protocol. After the propagated connection or connection pool updates the connection parameters, it can also randomly propagate the update event to other connections, ultimately making the connection parameters of the connection pool and each connection valid connection parameters, and keeping both the existing connections and newly created connections subsequently in a valid keep-alive state.
[0071] Based on this, since the update event is propagated using a random propagation protocol, the changed connection parameters can be randomly and quickly propagated without relying on the propagation order, enabling the connection pool and each connection to complete the synchronous update of the connection parameters relatively quickly and improving the timeliness of connection keep-alive.
[0072] In the embodiment of the present application, the method can determine whether there is a change in connection parameters based on the connection pool or the connections in the connection pool, and in the case of determining that there is a change in connection parameters, initiate and propagate an update event for updating the connection parameters. By propagating this update event, the connection parameters of the connection pool and / or the connections in the connection pool can be updated, and the corresponding connection parameters can be synchronized to the changed connection parameters. In this way, by initiating and propagating the update event, when one or more connection parameters change, the connection parameters of the connection pool and / or each connection in the connection pool can be synchronously updated in a timely manner, achieving an active synchronous update of the connection parameters, avoiding connection inactivation caused by changes in connection parameters, and thereby improving the flexibility of connection keep-alive.
[0073] Through the method of the embodiment of the present application, the connection and / or the connection pool can synchronously update the connection parameters of the connection pool and each connection in the case of any one or more connection parameters changing. In this way, the impact and influence of the connection parameter change operation on the connection pool and the connection can be weakened, and the flexibility and robustness of the management of the connection pool can be improved. Since the connection and the connection pool can be synchronously updated to the changed connection parameters relatively quickly to maintain the validity of the connection parameters, the connections in the connection pool can maintain their activity for a relatively long time. When the application program needs to communicate with the server, the connection pool can quickly allocate a connection in the keep-alive state to the application program, which can improve the response speed of the communication between the application program and the server and also enhance the reliability and stability of the application program.
[0074] In some application scenarios, there may be many connection parameters for a connection or a connection pool. If the data length of the connection parameters is long, a large amount of data needs to be compared when propagating the update event, and a large amount of operations are required to complete the synchronous update, resulting in a low efficiency of synchronous update. To improve the efficiency of synchronous update, in the embodiment of the present application, the connection parameters can be compared in combination with the hash values corresponding to the connection parameters to reduce the amount of data operations and improve the efficiency of synchronous update of the connection parameters.
[0075] In a possible implementation, when initiating and propagating an update event for updating connection parameters, it can be implemented in the following manner: The determiner that determines that there is a change in the connection parameters initiates an update event for updating the connection parameters; calculates the hash value corresponding to the current connection parameters of the determiner, and propagates the update event based on the hash value.
[0076] Exemplarily, the determiner can be understood as the entity that determines the change in the connection parameters, and can be any one connection or a connection pool.
[0077] When initiating the update event, the determiner can call a hash function to calculate the hash value of its current connection parameters to obtain the hash value corresponding to the current connection parameters. When propagating the update event, the calculated hash value can be used as a propagation element of the update event for propagation to synchronously update the connection parameters of other connections or connection pools. Among them, the hash function can be any hash function, such as Secure Hash Algorithm 1 (SHA-1), Secure Hash Algorithm 2 (SHA-2) and its variants, or Message-Digest Algorithm 5 (MD5), etc.
[0078] In this embodiment, since the update event is propagated based on the hash value, and the hash value corresponding to the connection parameters has the advantage of a smaller data length compared to the connection parameters themselves, propagating the update event through the hash value can quickly propagate the update event, reduce the computational amount during connection parameter comparison, and improve the efficiency of synchronous update.
[0079] In a possible implementation, the connection parameters include public parameters, and the public parameters are the basic parameters used when the connection pool creates any connection. When calculating the hash value corresponding to the current connection parameters of the determiner and propagating the update event based on the hash value, it can be specifically implemented in the following manner: Calculate the total hash value corresponding to all the current public parameters of the determiner, and calculate the sub-hash values corresponding to each of the current public parameters of the determiner; Propagate the update event based on the total hash value and each sub-hash value.
[0080] Exemplarily, the public parameters are the basic parameters used when the connection pool creates any connection, and can also be understood as the basic parameters necessary for configuring the connection. The public parameters can be, for example, server address, port number, username, password, timeout setting, and connection keepalive, etc.
[0081] Figure 3 Schematic diagram of the hash value corresponding to the connection parameters provided by the embodiments of the present application, as Figure 3As shown, when the determiner of connection n initiates an update event, all public parameters of connection n can be used as a whole to calculate the corresponding hash value, obtaining the total hash value corresponding to all current public parameters. Moreover, for each public parameter of connection n, the corresponding hash value is calculated separately to obtain the sub-hash value corresponding to each public parameter.
[0082] When propagating the update event, the total hash value and each sub-hash value can be used as elements for propagation. When propagating to other connections or connection pools, the total hash value can be compared with the total hash value of all public parameters of the other connections or connection pools to which it is propagated. In this way, all public parameters can be compared as a whole in terms of hash values to determine whether there are similarities or differences; or each sub-hash value can be compared separately to determine the public parameters with differences, and then the public parameters that need to be updated can be synchronously updated more accurately to improve the accuracy of the update; or both the total hash value and each sub-hash value can be compared to further improve the accuracy of the comparison.
[0083] In this embodiment, for the public parameters in the connection parameters, the total hash value of all public parameters as a whole is calculated, and then the sub-hash value of each public parameter is calculated separately. In this way, when the update event is propagated, a hash value comparison with a higher degree of flexibility can be performed based on the total hash value and each sub-hash value, and a more accurate comparison result can be obtained and the comparison speed can be increased, improving the accuracy and efficiency of the synchronous update of the connection parameters.
[0084] Exemplarily, when the connection parameters change, it may be that one public parameter changes, or it may be that multiple public parameters change. If only a small number of public parameters change, in order to avoid a full-scale comparison of sub-hash values and reduce the computational amount during the comparison, the overall comparison can be first performed through the total hash value, and then the refined comparison can be appropriately performed through the sub-hash values after obtaining the comparison result of the total hash value. In this way, by combining the overall comparison and the timely refined comparison, both the accuracy and efficiency of the comparison can be taken into account, improving the accuracy and efficiency of the synchronous update of the connection parameters.
[0085] In a possible implementation, when propagating and updating events based on the total hash value and each sub-hash value, it can be specifically implemented in the following way: for any recipient to which the update event is propagated, calculate the total hash value corresponding to all the public parameters of the recipient currently; compare whether the total hash value of the determiner is the same as the total hash value of any recipient; in the case where the total hash value of the determiner is different from the total hash value of any recipient, calculate the sub-hash value corresponding to each public parameter of the recipient currently; correspondingly compare whether each sub-hash value of the determiner is the same as each sub-hash value of any recipient, and determine at least one pair of target sub-hash values with different hash values; for any pair of target sub-hash values, update the public parameter corresponding to the target sub-hash value of the recipient to the public parameter corresponding to the target sub-hash value of the determiner.
[0086] Exemplarily, the recipient can be understood as the entity to which the update event is propagated, which can be any one connection or a connection pool. When calculating the total hash value and sub-hash value corresponding to all the public parameters of any recipient to which the update event is propagated, the same hash function as that for calculating the total hash value and sub-hash value of the determiner can be used. A pair of target sub-hash values can be understood as two participating sub-hash values that are different when comparing a pair of sub-hash values.
[0087] When propagating the update event based on the total hash value and each sub-hash value, the comparison can be first made based on the total hash value. Specifically, when the update event is propagated to a certain connection or connection pool, the total hash value propagated in the update event can be first compared with the total hash value of all the public parameters of the connection or connection pool to which it is propagated.
[0088] In the case where the two compared hash values are the same, it can be indicated that the public parameters of the connection or connection pool are consistent with the public parameters in the propagation, so there is no need to synchronously update the public parameters of the connection or connection pool to which it is propagated.
[0089] In the case where the two compared hash values are different, it can be indicated that the public parameters of the connection or connection pool are inconsistent with the public parameters in the propagation, so the public parameters of the connection or connection pool to which it is propagated need to be synchronously updated.
[0090] Furthermore, in the case where the total hash values are inconsistent, it is also necessary to compare the sub-hash values of the two respectively to determine which or which sub-hash values are different, that is, to determine at least one pair of target sub-hash values, and then synchronously update the public parameters corresponding to the at least one pair of target sub-hash values.
[0091] In this embodiment, the total hash values are first compared for similarities and differences, and then the sub-hash values are compared when the total hash values are different. In this way, it is possible to avoid fully comparing the sub-hash values when the total hash values are the same, thereby saving time and computing resources for comparing public parameters, and improving both the accuracy and efficiency of the comparison.
[0092] In one possible implementation, the connection parameters include private parameters, which are specified parameters configured when the connection pool creates a connection to meet the connection requirements of the connection. When the determiner is any connection, the hash value corresponding to the current connection parameters of the determiner is calculated, and the update event is propagated based on the hash value. This can be specifically implemented in the following way: calculate the private hash values corresponding to each of the current private parameters of the determiner; and propagate the update event based on each private hash value.
[0093] Exemplarily, private parameters are specified parameters configured when the connection pool creates a connection to meet the connection requirements of the connection, and can also be understood as personalized parameters configured to meet the communication requirements of a certain communication connection. Private parameters can be, for example, parameters for setting case sensitivity or client encoding, etc. Private hash values can be understood as hash values obtained by performing hash function calculations on private parameters.
[0094] For example, a hash table is a data structure for storing data. When storing connection parameters of a connection and connection parameters of a connection pool, a hash table can be used for storage. Figure 3 As shown, for the public parameters and private parameters of a connection, when storing, all public parameters can be hashed once to obtain a total hash value, and then the corresponding hash values of each public parameter and each private parameter are calculated in turn to obtain each sub-hash value and each private hash value. The connection parameters, total hash value, sub-hash values corresponding to each public parameter, and private hash values corresponding to each private parameter of the connection can be stored in a hash table.
[0095] When propagating update events based on each private hash value, the private hash value of the private parameter of the determiner can be compared with the private hash value of the private parameter of the recipient. When the private hash values of any pair of corresponding private parameters are different, the private parameter corresponding to the private hash value of the recipient can be synchronously updated to the private parameter corresponding to the private hash value of the determiner.
[0096] Figure 4 Schematic diagram of the connection keeping alive method provided in the embodiment of the present application Figure 2 ,like Figure 4As shown, in the method of this embodiment, the connection parameters are stored in the form of a hash table. When storing, in addition to the hash values corresponding to each connection parameter, all public parameters are used as a keyword as a whole, and a corresponding total hash value is calculated. When an update event based on the gossip protocol is initiated by the connection pool or any connection, it can be processed in the following two cases.
[0097] The first case is to spread the hash value of the public parameters. In this case, the total hash value can be spread first. If the connection pool and all connections match it at this time, it means that the current public parameters of the connection pool and all connections are the same, and there is no information to be synchronized. When the total hash value does not match the connection pool or any connection, further operations will be carried out. The sub-hash values of the current public parameters will be compared one by one until the public parameter that is inconsistent with the spread public parameter is determined and then updated and synchronized. After the update, the hash value of the updated connection parameters can also be calculated.
[0098] The second case is to spread the hash value of the private parameters. In this case, the connection pool does not need to store the private parameters, while for the connection, it will further determine whether it is necessary to synchronously update the changed private parameters according to the communication needs of the current application program. When it is determined that an update is required, the spread private parameters are updated or added based on the current connection. When adding private parameters, the hash value of the added private parameters can be calculated and stored in the hash table.
[0099] After the above two cases, the update event can continue to be spread through the gossip protocol to keep the connection parameters of the connection pool and each connection consistent and keep each connection alive.
[0100] For example, when changes occur to the public parameters in the current connection pool, such as timeout settings and / or keepalive, etc., the connection pool can initiate an update event based on the gossip protocol. When spreading, it does not use the method of directly spreading the parameter values of the connection parameters, but spreads the hash values of the connection parameters. When the spread is the hash value of the public parameters, when it spreads to a new connection, it can be determined whether the public parameters of the current connection need to be updated by judging whether the total hash values match. If the two match as the same total hash value, no update is required, and the update event can continue to be spread to other connections. If the two do not match as the same total hash value, then each sub-hash value of each public parameter needs to be matched in turn until the target sub-hash value is found, and then the public parameter corresponding to the target sub-hash value is synchronously updated. After calculating the new hash value after the update, it can continue to be spread downward, and so on, finally realizing that all changes to the public parameters are updated to all connections and the connection pool.
[0101] Similarly, when there are changes in the private parameters of the connections in the connection pool, the changed private parameters need to be synchronized to other connections that include the private parameters. At this time, the connection can initiate an update event based on the gossip protocol. For each propagating private parameter, when the update event propagates to each connection, the connection can determine again whether the private parameter is the private parameter that itself needs to update. When it is determined that the private parameter needs to be updated, the private parameter of itself is updated and saved.
[0102] As described above, by using the hash table in combination with the gossip protocol, the bandwidth consumption caused by the gossip protocol exchanging information based on probability can be avoided, and for private parameters, each connection can determine again whether an update is needed, thus avoiding information redundancy. Finally, by propagating the hash value of the connection parameters through the gossip protocol, each connection can timely exchange information about the connection parameters with other connections, including its own status and connection parameters, etc. In this way, each connection can obtain information such as the existence and connection parameters of other connections in the connection pool, so that the connection parameters on each connection are the latest connection parameters, thus avoiding the connection from becoming inactivated due to incorrect connection parameters.
[0103] Exemplarily, for a connection that has become inactivated, the connection pool can mark it as an invalid connection, and can check whether a new connection needs to be newly created to replace the current connection or delete the current inactivated connection according to the maximum and minimum number of connections set in the connection pool. When a new connection needs to be created, it is initially created using the current connection parameters in the connection pool, and finally the latest connection parameters in other connections are synchronized to the newly created connection through the gossip protocol, which can keep the connection active and improve the success rate of connection keep-alive.
[0104] In this embodiment, by propagating the private hash value of the private parameter through the update event, the connections that need to update the private parameter can be quickly updated, improving the timeliness of the synchronous update of the private parameter.
[0105] Figure 5 It is a schematic structural diagram of the connection keep-alive device provided by the embodiment of the present application, as Figure 5 shown, the embodiment of the present application provides a connection keep-alive device, and the device includes:
[0106] A determination module 501, configured to determine whether there are changes in connection parameters according to the connection pool or the connections in the connection pool, where the connection parameters are used to configure the connection when creating or using the connection;
[0107] An update module 502, configured to initiate and propagate an update event for updating connection parameters when the connection pool or any connection determines that there are changes in connection parameters;
[0108] The update module 502 is further configured to synchronize the updated connection parameters to the connection pool and / or the connections in the connection pool by propagating an update event.
[0109] In a possible implementation manner, the update module 502 is specifically configured to: initiate an update event for updating the connection parameters by the determiner that determines that the connection parameters have changed; calculate the hash value corresponding to the current connection parameters of the determiner, and propagate the update event based on the hash value.
[0110] In a possible implementation manner, the connection parameters include public parameters, and the public parameters are basic parameters used when the connection pool creates any connection. The update module 502 is specifically configured to: calculate the total hash value corresponding to all the current public parameters of the determiner, and calculate the sub-hash value corresponding to each current public parameter of the determiner; propagate the update event based on the total hash value and each sub-hash value.
[0111] In a possible implementation manner, the update module 502 is specifically configured to: for any recipient to which the update event is propagated, calculate the total hash value corresponding to all the current public parameters of the recipient; compare whether the total hash value of the determiner is the same as the total hash value of any recipient; in the case where the total hash value of the determiner is different from the total hash value of any recipient, calculate the sub-hash value corresponding to each current public parameter of the recipient; correspondingly compare whether each sub-hash value of the determiner is the same as each sub-hash value of any recipient, and determine at least one pair of target sub-hash values with different hash values; for any pair of target sub-hash values, update the public parameter corresponding to the target sub-hash value of the recipient to the public parameter corresponding to the target sub-hash value of the determined value.
[0112] In a possible implementation manner, the connection parameters include private parameters, and the private parameters are specified parameters configured to meet the connection requirements of the connection when the connection pool creates a connection. When the determiner is any connection, the update module 502 is specifically configured to: calculate the private hash value corresponding to each current private parameter of the determiner; propagate the update event based on each private hash value.
[0113] In a possible implementation manner, the update event is propagated using a random propagation protocol.
[0114] The connection keep-alive device provided by the embodiments of the present application can be used to execute the technical solutions of the connection keep-alive method in any of the above embodiments of the present application, and its implementation principle and technical effects are similar, which will not be elaborated here in this embodiment.
[0115] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application, as Figure 6As shown in the figure, the electronic device of this embodiment may include: at least one processor 601; and a memory 602 communicatively connected to the at least one processor; wherein, the memory 602 stores instructions executable by the at least one processor 601, and when the instructions are executed by the at least one processor 601, the electronic device executes the method of any of the foregoing embodiments.
[0116] Optionally, the memory 602 can be either independent or integrated with the processor 601.
[0117] For the implementation principle and technical effects of the electronic device provided in this embodiment, reference can be made to the foregoing embodiments, which will not be elaborated here.
[0118] This application embodiment also provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the processor executes the computer-executable instructions, the method of any of the foregoing embodiments is implemented.
[0119] This application embodiment also provides a computer program product, including a computer program, which when executed by the processor implements the method of any of the foregoing embodiments.
[0120] In several embodiments provided by this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0121] The integrated modules implemented in the form of software function modules as described above can be stored in a computer-readable storage medium. The above software function modules are stored in a storage medium, including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods described in various embodiments of this application.
[0122] It should be understood that the above-mentioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly implemented by the execution of the hardware processor, or by the combination of the hardware and software modules in the processor. The memory may include random access memory (RAM), and may also include non-volatile memory (NVM), such as at least one disk memory, and may also be a USB flash drive, a portable hard drive, a read-only memory, a magnetic disk, or an optical disc, etc.
[0123] The above-mentioned storage medium can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disc. The storage medium can be any available medium accessible by a general or special-purpose computer.
[0124] An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit. Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a master control device.
[0125] It should be noted that in this document, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including such element.
[0126] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.
[0127] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to enable a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0128] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application accordingly. Any equivalent structure or equivalent process transformation made by using the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.
[0129] Those skilled in the art will readily think of other implementation schemes of the embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses or adaptive changes of the embodiments of the present application, and these variations, uses or adaptive changes follow the general principles of the embodiments of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the embodiments of the present application.
[0130] It should be understood that the embodiments of the present application are not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the embodiments of the present application is only limited by the appended claims.
Claims
1. A connection keep-alive method, characterized in that: The method comprises: Determining, based on a connection pool or a connection in the connection pool, whether connection parameters have changed, the connection parameters being used to configure a connection when creating or using a connection; In the case where the connection pool or any of the connections determines that a connection parameter has changed, initiating and propagating an update event for updating the connection parameter; By propagating the update event, the connection pool and / or the connections in the connection pool are synchronously updated with the changed connection parameters.
2. The method according to claim 1, characterized in that The initiating and propagating an update event for updating the connection parameters includes: An update event for updating the connection parameters is initiated by a determiner that determines that the connection parameters have changed; A hash value corresponding to the current connection parameter of the determiner is calculated, and the update event is propagated based on the hash value.
3. The method according to claim 2, characterized in that The connection parameters include public parameters, which are basic parameters used when the connection pool creates any connection. The calculating of the hash value corresponding to the current connection parameter of the determiner and propagating the update event based on the hash value include: Calculate the total hash value corresponding to all current public parameters of the determiner, and calculate the sub-hash value corresponding to each current public parameter of the determiner; The update event is propagated based on the total hash value and each of the sub-hash values.
4. The method according to claim 3, characterized in that The propagating the update event based on the total hash value and each of the sub-hash values comprises: For any recipient to which the update event is propagated, calculate the total hash value corresponding to all current public parameters of any recipient; Comparing whether the total hash value of the determiner is the same as the total hash value of any of the recipients; When the total hash value of the determiner is different from the total hash value of any of the recipients, calculating the sub-hash values corresponding to the current public parameters of any of the recipients; Comparing the sub-hash values of the determiner with the sub-hash values of any of the recipients to determine whether they are the same, and determining at least one pair of target sub-hash values with different hash values; For any pair of the target sub-hash values, the public parameter corresponding to the target sub-hash value of any recipient is updated to the public parameter corresponding to the target sub-hash value of the determined value.
5. The method according to claim 3, characterized in that: The connection parameters include private parameters, which are designated parameters configured by the connection pool to meet the connection requirements of the connection when the connection pool creates a connection. When the determiner is any of the connections, the calculating of a hash value corresponding to the current connection parameter of the determiner and the propagation of the update event based on the hash value include: Calculate the private hash values corresponding to the current private parameters of the determiner; The update event is propagated based on each of the private hash values.
6. The method according to any one of claims 1 to 5, characterized in that: The update event is propagated using a random propagation protocol.
7. A connection keep-alive device, characterized in that: The device comprises: A determination module, used to determine whether a connection parameter has changed according to a connection pool or a connection in the connection pool, wherein the connection parameter is used to configure a connection when creating or using a connection; An update module, configured to initiate and propagate an update event for updating connection parameters when it is determined that a connection parameter of the connection pool or any of the connections has changed; The update module is further configured to synchronously update the changed connection parameters of the connection pool and / or the connections in the connection pool by propagating the update event.
8. An electronic device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.