A method and apparatus for disconnecting

By obtaining the access lock of the interacting party through an intermediary to query the sending and receiving records and allowing disconnection when the set conditions are met, the problem of information loss when different programming language systems disconnect is solved, thus achieving stability and reliability of information transmission.

CN112866383BActive Publication Date: 2026-05-29WEBANK (CHINA)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEBANK (CHINA)
Filing Date
2021-01-19
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In a network environment, since application systems developed in different programming languages ​​cannot communicate directly, existing technologies are prone to loss of request or response information when the connection is broken, especially when the sender or receiver actively disconnects, making it impossible to guarantee the integrity and stability of the information.

Method used

By acquiring the access lock of the interacting party through an intermediary, querying its send and receive records, and allowing disconnection when the set conditions are met, information is ensured not to be lost. The access lock mechanism prevents recording errors under high concurrency, thereby improving the reliability and accuracy of the intermediary.

Benefits of technology

It effectively prevents information loss when the connection is lost, increases the stability and reliability of the intermediary, reduces the possibility of information loss, and ensures the integrity of information transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112866383B_ABST
    Figure CN112866383B_ABST
Patent Text Reader

Abstract

The application discloses a disconnection method and device, comprising: an intermediate party receiving a disconnection request sent by a request party, determining whether the number of transceiving in a first transceiving record meets a set condition, wherein the first transceiving record is determined from the transceiving record of each interactive party and contains the transceiving record of the request party, the transceiving record of each interactive party is generated by the intermediate party according to the message transceiving number of the interactive party, and the transceiving record of each interactive party is provided with a respective access lock; and then determining that the number of transceiving in the first transceiving record meets the set condition, and sending a disconnection permission response to the request party. The request party is informed that the connection can be disconnected, so that when the interactive party disconnects with the intermediate party, information is not lost, the stability of the intermediate party is increased, and the possibility of information loss of the intermediate party is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial technology (Fintech), and more particularly to a method and apparatus for disconnecting connections. Background Technology

[0002] With the development of computer technology, more and more technologies (such as blockchain, cloud computing or big data) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also being placed on big data technology.

[0003] Currently, application systems in a network environment may be developed using different programming languages. These application systems developed in different languages ​​cannot directly communicate via message transmission. They require a multi-language intermediary to decode, translate, and forward messages, enabling communication between interactive systems developed in different programming languages. In existing technologies, during message transmission communication, a connection is established between each application system. From sending a request message to receiving a response message, an application system typically needs to wait for a certain period of time. During communication, if the sender or receiver actively disconnects this communication connection without protective measures, it can easily lead to the loss of the sender's request message or the receiver's response message.

[0004] Therefore, a method for disconnecting communication connections is needed to prevent the loss of request or response information when the sender or receiver disconnects from the message middleware. Summary of the Invention

[0005] This invention provides a method and apparatus for disconnecting, which ensures that information is not lost when the interacting party disconnects from the intermediary, increases the stability of the intermediary, and reduces the possibility of information loss by the intermediary.

[0006] In a first aspect, embodiments of the present invention provide a method for disconnecting a connection, comprising:

[0007] The intermediary receives the disconnection request sent by the requesting party;

[0008] The intermediary determines whether the number of messages sent and received in the first message sending and receiving record meets the set conditions; the first message sending and receiving record is determined from the message sending and receiving records of each interaction party, including the message sending and receiving record of the requesting party; the message sending and receiving record of each interaction party is generated by the intermediary based on the message sending and receiving count of that interaction party; each message sending and receiving record of each interaction party is equipped with its own access lock.

[0009] If the intermediary determines that the number of transmissions in the first transmission record meets the set conditions, it sends a disconnection permission response to the requesting party.

[0010] In the above technical solution, the requesting party can be any of the interacting parties. After receiving the disconnection request, the intermediary acquires the access lock of the interacting party and queries the send and receive records of the interacting party. Since the send and receive records of the interacting party record the number of messages sent and received by the interacting party (i.e., the number of times the intermediary receives a request message from the sender and sends it to the receiver, and waits for the receiver to reply with a response message), when it is determined that the send and receive records of the interacting party meet the preset conditions, it sends a disconnection permission response to the requesting party to inform the requesting party that it can disconnect. This ensures that the information is not lost when the interacting party disconnects from the intermediary, increases the stability of the intermediary, and reduces the possibility of the intermediary losing information.

[0011] Optionally, each party's send and receive records are configured with its own access lock, including:

[0012] The intermediary receives registration information sent by the interacting party, the registration information including the sender's identification information and the receiver's identification information;

[0013] The intermediary generates an access lock for accessing the sending and receiving records of the interacting party based on the identifier information of the sender and the identifier information of the receiver.

[0014] The intermediary adds a key-value pair to the sending lock table, with the sender's identification information as the key and the receiver's identification information and the access lock as the values.

[0015] The intermediary adds a key-value pair to the receive lock table, with the receiver's identification information as the key and the sender's identification information and the access lock as the values.

[0016] In the above technical solution, an access lock is generated for the intermediary to access the sending and receiving records of the intermediary through the identification information of the sender and receiver. That is, the intermediary can only access the sending and receiving records of the corresponding intermediary through the access lock, so as to prevent the intermediary from recording the sending and receiving records of the intermediary incorrectly when there is high concurrency of information, thereby improving the reliability and accuracy of the intermediary.

[0017] Optionally, the first send / receive record is determined from the send / receive records of each interacting party, including the send / receive record containing the requesting party.

[0018] If the requesting party is the sender, then the value corresponding to the sender's identification information is determined from the send lock table; based on the receiver's identification information and the sender's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0019] If the requester is the receiver, then the value corresponding to the receiver's identification information is determined from the receiver lock table; based on the sender's identification information and the receiver's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0020] In the above technical solution, before accessing the first send and receive record, the intermediary needs to determine the access lock corresponding to the requester in the lock table of the interacting party. Only by acquiring the access lock can the intermediary query or modify the requester's send and receive record in the first send and receive record. This prevents the intermediary from recording the requester's send and receive record incorrectly when there is high concurrency of information, thereby improving the reliability and accuracy of the intermediary.

[0021] Optionally, the requester is the receiver;

[0022] The intermediate party determines whether the number of transmitted and received data in the first transmit / receive record meets the set conditions, including:

[0023] The intermediary uses the access lock in the value to access the first transmit / receive record;

[0024] After the intermediary determines that the number of transmitted and received data in the first transmit / receive record meets the set conditions and sends a first disconnection permission response to the requesting party, the method further includes:

[0025] Upon receiving a connection termination notification from the receiver, the intermediary releases the access lock.

[0026] In the above technical solution, when the requester is the receiver, the intermediary needs to acquire the receiver's access lock before accessing the receiver's send and receive records through the corresponding access lock. Because the intermediary has acquired the receiver's access lock, the sender that interacts with the receiver in the value cannot use the access lock, that is, the sender cannot send information to the receiver, which ensures that the sender's information is not lost when the receiver disconnects, and reduces the possibility of the intermediary losing information.

[0027] Optionally, the requester is the sender;

[0028] The method further includes:

[0029] The intermediary receives the message from the sender; the message includes the identification information of the target receiver;

[0030] If the intermediary does not obtain the access locks for the sender and the target receiver from the send lock table, it obtains the access locks for the sender and the alternative receiver from the send lock table and sends the message to the alternative receiver; the alternative receiver has the same function as the target receiver.

[0031] In the above technical solution, the target receiver is the receiver accessed by the sender. If the intermediary does not obtain the access locks of the sender and the target receiver in the send lock table, it will obtain the access locks of the sender and the substitute receiver to prevent the intermediary from directly sending the failure message to the sender, thereby improving the success rate of the sender's access.

[0032] Optionally, the method further includes:

[0033] If the intermediary determines that the number of transmitted and received data in the first transmit / receive record does not meet the set conditions, it sends a disconnection and waiting response to the requesting party.

[0034] The intermediary receives messages sent by the receiver in the interaction party and modifies the number of messages sent and received in the first send and receive record through the access lock of the first send and receive record;

[0035] If the intermediary determines that the number of transmissions in the first transmission record meets the set conditions or the waiting time meets the set threshold, it sends the disconnection permission response to the requesting party.

[0036] Optionally, the message sending and receiving records for each interacting party are generated by the intermediary based on the message sending and receiving count of that interacting party, including:

[0037] If the intermediary receives a message from the sender in the interaction party, it acquires the access lock corresponding to the send and receive record of the interaction party.

[0038] The intermediary increments the access count in the sending and receiving records of the interacting party by 1 using the access lock;

[0039] If the intermediary receives a message sent by the receiver in the interaction party, it acquires the access lock corresponding to the send and receive record of the interaction party.

[0040] The intermediary uses the access lock to decrement the access count in the sending and receiving records of the interacting party by 1.

[0041] In the above technical solution, the intermediary needs to obtain an access lock from the receive lock table for the receiver and from the sender lock table for the sender. By setting the corresponding access rules in the send and receive lock tables, the intermediary modifies the access count of the send and receive records of the interacting parties. This allows the intermediary to clearly know the number of response messages the sender is waiting for from the receiver, preventing the loss of response information from the receiver or request information from the sender when the intermediary disconnects from the interacting parties, thus improving the reliability and accuracy of the intermediary.

[0042] Optionally, the method further includes:

[0043] Before initiating a connection termination, the intermediary party rejects messages sent by the sender among the interacting parties.

[0044] The intermediary disconnects from each interacting party when it determines that the number of accesses in the sending and receiving records of each interacting party meets the set conditions.

[0045] In the above technical solution, when the intermediary initiates a connection termination, it rejects messages sent by each sender to prevent message loss, and determines that the number of accesses in the sending and receiving records of each interacting party meets the set conditions to prevent message loss from the receiver.

[0046] In a second aspect, embodiments of the present invention provide a device for disconnecting a connection, comprising:

[0047] The receiving module is used to receive disconnection requests sent by the requesting party;

[0048] The processing module is used to determine whether the number of messages sent and received in the first message sending and receiving record meets the set conditions; the first message sending and receiving record is determined from the message sending and receiving records of each interaction party that includes the requesting party; the message sending and receiving record of each interaction party is generated by the intermediary based on the message sending and receiving count of that interaction party; each message sending and receiving record of each interaction party is set with its own access lock.

[0049] If the number of transmitted and received records in the first transmit / receive record is determined to meet the set conditions, a disconnection permission response is sent to the requesting party.

[0050] Optionally, the processing module is specifically used for:

[0051] Receive registration information sent by the interacting party, wherein the registration information includes the identifier information of the sender and the identifier information of the receiver;

[0052] Based on the identifier information of the sender and the identifier information of the receiver, an access lock is generated for accessing the sending and receiving records of the interacting parties.

[0053] Add a key-value pair to the send lock table, with the sender's identification information as the key and the receiver's identification information and the access lock as the values;

[0054] Add a key-value pair to the receive lock table, with the receiver's identification information as the key and the sender's identification information and the access lock as the values.

[0055] Optionally, the processing module is specifically used for:

[0056] If the requesting party is the sender, then the value corresponding to the sender's identification information is determined from the send lock table; based on the receiver's identification information and the sender's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0057] If the requester is the receiver, then the value corresponding to the receiver's identification information is determined from the receiver lock table; based on the sender's identification information and the receiver's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0058] Optionally, the processing module is specifically used for:

[0059] Access the first transmit / receive record using the access lock in the value;

[0060] After determining that the number of transmissions in the first transmission record meets the set conditions, and sending a first disconnection permission response to the requesting party, the access lock is released upon receiving a connection disconnection notification from the receiving party.

[0061] Optionally, the requester is the sender;

[0062] The processing module is also used for:

[0063] Receive a message from the sender; the message includes the identifier information of the target receiver;

[0064] If the access locks for the sender and the target receiver are not obtained from the send lock table, then the access locks for the sender and the alternative receiver are obtained from the send lock table, and the message is sent to the alternative receiver; the alternative receiver has the same function as the target receiver.

[0065] Optionally, the processing module is further configured to:

[0066] If it is determined that the number of transmitted and received records in the first transmit / receive record does not meet the set conditions, a disconnection waiting response is sent to the requesting party.

[0067] Receive messages sent by the receiver in the interaction party, and modify the number of messages sent and received in the first send and receive record through the access lock of the first send and receive record;

[0068] If the number of transmissions in the first transmission record meets the set conditions or the waiting time meets the set threshold, then the disconnection permission response is sent to the requesting party.

[0069] Optionally, the processing module is specifically used for:

[0070] If a message is received from the sender in the interaction, the access lock corresponding to the send and receive record of the interaction is obtained;

[0071] The access lock is used to increment the access count in the send / receive records of the interacting party by 1;

[0072] If a message is received from the receiver in the interaction, the access lock corresponding to the send and receive record of the interaction is obtained.

[0073] The access lock is used to decrement the access count in the send / receive records of the interacting party by 1.

[0074] Optionally, the processing module is further configured to:

[0075] Before initiating a connection termination, reject messages sent by the sender among the interacting parties;

[0076] If the number of accesses in the send and receive records of each interacting party meets the set conditions, the connection with each interacting party is disconnected.

[0077] Thirdly, embodiments of the present invention also provide a computing device, comprising:

[0078] Memory, used to store program instructions;

[0079] The processor is used to call the program instructions stored in the memory and execute the above-mentioned disconnection method according to the obtained program.

[0080] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the above-described disconnection method. Attached Figure Description

[0081] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0082] Figure 1 This is a schematic diagram of a connection disconnection process provided in an embodiment of the present invention;

[0083] Figure 2 A schematic diagram illustrating data loss as provided in an embodiment of the present invention;

[0084] Figure 3 A system architecture provided for an embodiment of the present invention;

[0085] Figure 4 A flowchart illustrating a method for disconnecting a connection according to an embodiment of the present invention;

[0086] Figure 5 This is a schematic diagram illustrating the working state of an interactive party according to an embodiment of the present invention;

[0087] Figure 6 A schematic diagram of an access lock provided in an embodiment of the present invention;

[0088] Figure 7 A schematic diagram of a first transmit / receive record provided in an embodiment of the present invention;

[0089] Figure 8 This is a schematic diagram illustrating the working state of an intermediate party according to an embodiment of the present invention;

[0090] Figure 9 This is a schematic diagram illustrating a method for the sender to disconnect according to an embodiment of the present invention;

[0091] Figure 10 This is a schematic diagram illustrating a method for a receiver to disconnect according to an embodiment of the present invention;

[0092] Figure 11 This is a schematic diagram of a method for disconnecting a connection at an intermediate point, provided by an embodiment of the present invention.

[0093] Figure 12 This is a schematic diagram of a disconnection device provided in an embodiment of the present invention. Detailed Implementation

[0094] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0095] In existing technologies, application systems in a network environment may be developed using different programming languages. Typically, these application systems developed in different languages ​​cannot directly communicate via message transmission. Multi-language proxy programs are needed to decode, translate, and forward messages, thereby enabling interaction between systems developed in different programming languages. These multi-language proxy programs generally reside within message middleware. Message middleware is a software system based on message queues and message passing technology that provides synchronous or asynchronous, reliable message transmission support for application systems in a network environment. A message queue is a container for storing messages during message transmission, used to store messages generated during inter-process communication or communication between different threads of the same process.

[0096] For example, application system A is developed using programming language A1, and application system B is developed using programming language B1. Application systems A and B communicate through a message broker. Application system A sends a request message written in programming language A1 to the message broker. The message broker decodes and translates the request message from A1 into a request message written in programming language B1, and then sends it to application system B. Application system B then sends back a response message written in programming language B1. The message broker then decodes and translates the response message from B1 back into a response message written in programming language A1, and sends it back to application system A. In this example, application system A is the sender, and application system B is the receiver. Upon receiving the request message from the sender, the receiver generates a response message and sends it back to the sender, informing them of the processing result of the request message.

[0097] In the aforementioned communication process, communication is generally conducted by establishing a TCP (Transmission Control Protocol) connection. However, the current connection termination process between the sender and receiver typically only follows the "four-way handshake" specification at the TCP connection layer. Figure 1 An exemplary schematic diagram of a connection disconnection process is shown, such as... Figure 1 As shown, the initiating party initiates a connection termination request and sends it to the passive party. Upon receiving the termination request, the passive party sends an acknowledgment to the initiating party and prepares for connection termination. Once prepared, the passive party sends a connection termination readiness message to the initiating party. After receiving the connection termination readiness message from the passive party, the initiating party terminates its connection with the message broker. The initiating party can be either the receiver or the sender, and the passive party is the corresponding party to the initiating party.

[0098] However, in the above-mentioned disconnection methods, request or response information sent to the message middleware is prone to loss when either the sender or receiver disconnects. Graceful disconnection is only achieved at the TCP connection level between the application system and the message middleware, but it does not guarantee graceful disconnection of request or response information during communication; that is, it cannot guarantee that request or response information will not be lost. The sender typically needs to wait a certain amount of time from sending a request to receiving a response. If, during this waiting period, the sender or receiver actively disconnects from the message middleware, the sender's request information or the receiver's response information will be lost—this process is considered inelegant. Conversely, if no request or response information is lost during disconnection, it is called graceful disconnection.

[0099] Figure 2An exemplary diagram illustrating a data loss scenario is shown, such as... Figure 2 As shown in Figure a, after the sender sends a message to the message middleware, if the sender disconnects from the message middleware before the message middleware sends a response, the response information corresponding to the request information will not be able to be sent back to the sender, resulting in the loss of the response information corresponding to the request information.

[0100] like Figure 2 As shown in Figure b, after the sender sends the message to the message middleware, if the receiver disconnects from the message middleware before the message middleware sends the transcoded and translated request information to the receiver, the request information cannot be sent to the receiver, resulting in the loss of the request information.

[0101] Therefore, a method for disconnecting communication connections is needed to prevent the loss of request or response information when the sender or receiver disconnects from the message middleware.

[0102] Figure 3 An exemplary system architecture applicable to an embodiment of the present invention is shown, which includes a receiver 310, a message middleware 320, and a sender 330.

[0103] The requester can be either the receiver 310 or the sender 330, and the message middleware 320 is the intermediary.

[0104] Receiver 310 is used to receive request information forwarded by message middleware 320 after decoding and translation, and to send response information back to message middleware 320. It acts as the requester, sending a disconnect request to message middleware 320, and disconnecting from message middleware 320 after receiving a disconnect permission response from message middleware 320. Receiver 310 can be a client, message middleware, or server, etc.

[0105] The message middleware 320 is used to decode and translate the response information sent by the receiver 310 and the request information sent by the sender, and then forward them. When the requester sends a disconnection request, it acquires the access lock corresponding to the interacting party, then queries the first send / receive record, and when it determines that the number of accesses of the interacting party in the first send / receive record meets the set conditions, it sends a disconnection permission response to the requester to inform the requester that the connection can be disconnected.

[0106] The sender 330 is used to receive response information forwarded by message middleware 320 after decoding and translation, or to send request information to message middleware 320. It acts as the requester, sending a disconnection request to message middleware 320, and disconnecting from message middleware 320 after receiving a disconnection permission response from message middleware 320. The sender 330 can be a client, message middleware, or server, etc.

[0107] It should be noted that the above Figure 3 The structure shown is merely an example, and the embodiments of the present invention are not limited thereto.

[0108] Based on the above description Figure 4 An exemplary flowchart of a disconnection method provided by an embodiment of the present invention is shown, which can be executed by a disconnection device.

[0109] like Figure 4 As shown, the process specifically includes:

[0110] Step 410: The intermediary receives the disconnection request sent by the requesting party.

[0111] In this embodiment of the invention, the requesting party can be any of the interacting parties, including the sender and the receiver. When sending a disconnection request, the interacting party changes its own working state to inform the intermediary party to perform subsequent processing. For example, the working state of the interacting party is determined according to a state machine. Figure 5 An exemplary diagram illustrating the working state of an interacting party is shown, such as... Figure 5 As shown, the working states of the interacting party include normal working state, disconnect request state, disconnect ready state, and connection disconnected state. In the normal working state, the interacting party can send a disconnect request to the intermediary. If the intermediary does not return a failure message, the interacting party enters the disconnect request state. After the interacting party enters the disconnect request state, the intermediary rejects the request packet from the sender in the interacting party and waits for the response information from the receiver in the interacting party before sending a disconnect permission response to the requesting party. After receiving the disconnect permission response, the requesting party enters the disconnect ready state, then sends a disconnect message to the intermediary, disconnects from the intermediary, and enters the connection disconnected state. After restarting, it can re-enter the normal working state. The methods for handling different working states of the interacting party are described in detail in the following steps.

[0112] Step 420: The intermediary determines whether the number of transmitted and received data in the first transmit / receive record meets the set conditions.

[0113] In this embodiment of the invention, after the requesting party sends a disconnection request, it enters a request disconnection state. Then, the intermediary determines whether the number of messages sent and received in the first message sending and receiving record meets the set conditions. The first message sending and receiving record is determined from the message sending and receiving records of each interacting party, which includes the message sending and receiving record of the requesting party. The message sending and receiving record of each interacting party is generated by the intermediary based on the message sending and receiving count of that interacting party. Each message sending and receiving record of each interacting party is set with its own access lock.

[0114] The access locks of each interacting party can be generated based on the name of the interacting party or based on the address of the interacting party.

[0115] In this embodiment of the invention, the access lock corresponding to each interacting party is determined based on the identification information of the receiver and the sender in the interacting party. Specifically, the intermediary receives the registration information sent by the interacting party, which includes the identification information of the sender and the receiver. Then, based on the identification information of the sender and the receiver, an access lock for accessing the send and receive records of the interacting party is generated. Then, a key-value pair with the sender's identification information as the key and the receiver's identification information and the access lock as the value is added to the send lock table. Finally, a key-value pair with the receiver's identification information as the key and the sender's identification information and the access lock as the value is added to the receive lock table.

[0116] In other words, the intermediary generates two lock tables based on the sender's and receiver's identification information: a sending lock table and a receiving lock table. For the same sender and receiver, the locks in the sending lock table and the receiving lock table are the same locks. Figure 6 An exemplary schematic diagram of an access lock is shown, such as... Figure 6 As shown, the senders include S1 and S2, and the receivers include R3 and R4, where 1, 2, 3 and 4 represent the identification information corresponding to the interacting parties.

[0117] As shown in the diagram, the send lock table uses key-value pairs with the sender's identification information (S1 and S2) as keys and the receiver's identification information (R3 and R4) and access lock as values ​​(e.g., 1, 3). The receive lock table uses key-value pairs with the receiver's identification information (R3 and R4) as keys and the sender's identification information (S1 and S2) and access lock as values ​​(e.g., 1, 4). This allows each interacting party to set its own access lock; for example, the access lock for S1 and R3 is (1, 3).

[0118] After acquiring the access lock from the requester, the intermediary can access the first send and receive record, which includes the send and receive records of each interacting party. The corresponding send and receive record can be determined based on the identifier information of the requester. Figure 7 An exemplary schematic diagram of a first transmit and receive record is shown, such as... Figure 7 As shown, each interacting party has a corresponding number of access records for sending and receiving data. For example, the interacting party "<S1,R3> “:1” represents the number of accesses to the send and receive records of the interaction party, S1, and R3.

[0119] Furthermore, if the requester is the sender, the value corresponding to the sender's identification information as the key is determined from the sender lock table. Based on the receiver's identification information and the sender's identification information in the value, the first transmit / receive record is searched, and the access lock in the value is used to access the first transmit / receive record. For example, if the requester is the sender S1, the value corresponding to the sender's identification information as the key is determined from the sender lock table (including 1, 3 and 1, 4), and then the requester's access lock (1, 4) is determined based on the receiver's identification information in the value (e.g., 4).

[0120] If the requester is the receiver, the value corresponding to the receiver's identification information as the key is determined from the receiver lock table. Based on the sender's identification information and the receiver's identification information in the value, the first transmit / receive record is searched, and the access lock in the value is used to access the first transmit / receive record. For example, if the requester is receiver R3, the value corresponding to the receiver's identification information as the key is determined from the receiver lock table (including 1, 3 and 2, 3), and then the requester's access lock (1, 3) is determined based on the sender's identification information in the value (such as 1).

[0121] In this embodiment of the invention, the set condition may include the number of transmit / receive records in the first transmit / receive record meeting the set condition or the waiting time meeting the set threshold. The number of transmit / receive records in the first transmit / receive record meeting the set condition may be whether a quantity threshold has been reached or 0. For example, ... Figure 7 As shown, in the first send / receive record,<S1,R3> The number of accesses to the send and receive records of the interacting party is 1.<S1,R4> The number of accesses to the send and receive records of the interacting party is 2.<S2,R3> The number of accesses to the send and receive records of the interacting party is 0.<S2,R4> The access count of the send and receive records of the interacting party is 0. It should be noted that the access count of the send and receive records of the interacting party can be modified according to the information sent by the interacting party. For example, when the sender sends request information, the access count of the send and receive records can be multiplied by a preset multiple, or weighted summation can be used.

[0122] Furthermore, if the intermediary receives a message from the sender in the interaction, it acquires the access lock corresponding to the send / receive record of that interaction and increments the access count in the record by 1. If it receives a message from the receiver in the interaction, it acquires the access lock corresponding to the send / receive record of that interaction and decrements the access count by 1. Therefore, when the access count of the send / receive record of an interaction is determined to be 0, it can be determined whether the send / receive count in the record meets the set conditions.

[0123] For example, such as Figure 7 As shown, in the first send / receive record,<S1,R3> If the access count of the sending and receiving records of the interacting party is 1, it means that the receiving party R3 has 1 response message that has not been returned.<S1,R4> If the number of accesses to the sending and receiving records of the interacting party is 2, it means that the receiving party R4 has 2 response messages that have not been returned.<S2,R3> If the number of accesses to the send and receive records of the interacting party is 0, it means...<S2,R3> The number of sent and received records in the interaction party meets the set conditions.<S2,R4> If the number of accesses to the send and receive records of the interacting party is 0, it means...<S2,R4> The number of sent and received records in the interaction party meets the set conditions.

[0124] Step 430: If the intermediary determines that the number of transmitted and received data in the first transmit / receive record meets the set conditions, it sends a disconnection permission response to the requesting party.

[0125] In this embodiment of the invention, after the intermediary sends a disconnection permission response to the requesting party, the requesting party will enter a disconnection ready state and prepare to disconnect from the intermediary.

[0126] For example, when the requester is the receiver, the intermediary uses the access lock in the value to access the first transmit / receive record, determines that the transmit / receive count in the first transmit / receive record meets the set conditions, sends a first disconnection permission response to the receiver, and then releases the access lock upon receiving a connection disconnection notification from the receiver. The receiver then enters the disconnected state. For example, as follows... Figure 6 and Figure 7 As shown, the requester is receiver R3, and the intermediary determines the values ​​(1, 3 and 2, 3) based on the receiver's identification information, and then uses the access lock in the value (<S1,R3> and<S2,R3> ), because at this time<S1,R3> If the access count is 1, then the send / receive count of receiver R3 does not meet the set conditions. The intermediate channel will then send a disconnection request failure message to receiver R3 and hold the access lock.<S1,R3> and<S2,R3> This prevents the senders (S1 and S2) in the access lock from sending request information.

[0127] If at this time<S1,R3> If the access count is 0, then the transmit and receive count of receiver R3 meets the set condition. Then, a first disconnection permission response is sent to receiver R3. After receiving the first disconnection permission response, receiver R3 enters the disconnected state. Then, receiver R3 sends a connection disconnection notification to the intermediary. The intermediary disconnects from receiver R3 and releases the access lock.<S1,R3> and<S2,R3> ).

[0128] For example, when the requester is the sender, if the target recipient included in the sender's request information cannot be accessed, a failure message can be returned to the sender, or a message or option to change the recipient can be returned to the sender.

[0129] Furthermore, the intermediary receives the message from the sender, which includes the identifier information of the target receiver. If the intermediary does not obtain the access locks for the sender and the target receiver from the sender lock table, it obtains the access locks for the sender and the alternative receiver from the sender lock table and sends the message to the alternative receiver. It should be noted that the alternative receiver has the same function as the target receiver.

[0130] In this embodiment of the invention, the target receiver may disconnect from the intermediary due to reasons such as system downtime or upgrades. Therefore, the sender cannot interact with the target receiver at this time. The intermediary will then connect the sender with a substitute receiver and record the corresponding access count. The intermediary can determine the substitute receiver based on the target receiver's resource type or the sender's request information. For example, if the response information expected by the target receiver and the substitute receiver is consistent with the sender's request information, the substitute receiver is considered to have the same function as the target receiver, and the method will then interact with the substitute receiver.

[0131] For example, if the intermediary determines that the number of transmitted and received data in the first transmit / receive record does not meet the set conditions, it sends a disconnection waiting response to the requesting party. The intermediary continues this process until it determines that the number of transmitted and received data in the first transmit / receive record meets the set conditions or the waiting time exceeds a set threshold, at which point it sends a disconnection permission response to the requesting party. The set threshold is preset based on experience; for example, it could be 1 minute, 5 minutes, etc.

[0132] For example, in this embodiment of the invention, the intermediary processes different tasks in different working states. For instance, the working state of the interacting party is determined according to a state machine. Figure 8 An exemplary schematic diagram of the intermediate working state is shown, such as... Figure 8 As shown, the working states of the intermediary include normal working state, request disconnection state, and connection disconnection state. In the normal working state, the tasks processed by the intermediary include the technical solutions described above, which will not be repeated here. When the intermediary sends a disconnection request to the interaction party, it enters the request disconnection state. Before initiating the connection disconnection, it rejects messages sent by the sender in each interaction party to prevent the loss of information sent by the sender when disconnecting from the receiver. Then, after determining that the number of accesses in the send and receive records of each interaction party meets the set conditions, it disconnects the connection with each interaction party and enters the connection disconnection state. After restarting, it can return to the normal working state.

[0133] To better explain the above technical solution, the method of disconnection will be illustrated with a specific example below.

[0134] Example 1

[0135] Figure 9 An exemplary schematic diagram of a method for the sender to disconnect is shown, such as... Figure 9 As shown,

[0136] The senders (S1 and S2) interact with the receivers (R3 and R4) through an intermediary connection. Sender S1 can send a disconnection request to the intermediary via a state machine. The intermediary determines that the first transmit / receive record contains the number of accesses by sender S1.<S1,R3> :1 and<S1,R4> :0), when determining to send the response information fed back by receiver R1 to sender S1, "<S1,R3> Change :1 to "<S1,R3> If the value is set to 0, a disconnect permission response is sent to sender S1, notifying sender S1 that it can disconnect from the intermediate party. If the intermediate party does not receive a response within the set threshold (1 minute), it sends a disconnect permission response to sender S1, notifying sender S1 that it can disconnect from the intermediate party.

[0137] Example 2

[0138] Figure 10 An exemplary schematic diagram of a method for the receiver to disconnect is shown, such as... Figure 10 As shown, receivers (R3 and R4) interact with senders (S1 and S2) through an intermediary connection. Receiver R3 can send a disconnect request to the intermediary via a state machine, and the intermediary acquires the access lock of receiver R3, as shown below. Figure 6 As shown, access locks (1, 3) and (2, 3) are occupied, and sender S1 and sender S2 are refused access requests. Then, the number of accesses by receiver R3 in the first transmit / receive record is determined.<S1,R3> :1 and<S2,R3> :0), and then when determining to send the response information fed back by receiver R3 to sender S1, "<S1,R3> Change :1 to "<S1,R3> If the value is set to "0", a disconnect permission response is sent to receiver R3, notifying receiver R3 that it can disconnect from the intermediary. If the intermediary does not receive a response within the set threshold (1 minute), it sends a disconnect permission response to receiver R3, notifying receiver R3 that it can disconnect from the intermediary.

[0139] Example 3

[0140] Figure 11 An exemplary schematic diagram of a method for disconnecting the connection at an intermediate point is shown, such as... Figure 11 As shown, the intermediary connects to the sender (S1 and S2) and the receiver (R3 and R4). The intermediary rejects request messages from the sender (S1 and S2), queries the access count of all interacting parties in the first transmit / receive record, and disconnects from the sender and receiver when it determines that the access count of all interacting parties in the first transmit / receive record is 0. If the access count of an interacting party is not 0, it waits until the access count of all interacting parties is 0. If, after waiting for more than a set threshold (1 minute), there are still transmit / receive records with non-zero access counts of interacting parties, the intermediary forcibly disconnects from the sender and receiver.

[0141] It should be noted that in the above technical solution, if the sender determines that sending the request information to the intermediary has failed, it will connect to another intermediary.

[0142] In this embodiment of the invention, the requesting party can be any of the interacting parties, i.e., the sender or the receiver. Upon receiving a disconnection request, the intermediary acquires the access lock of the interacting party and queries the interacting party's send / receive records. Because the interacting party's send / receive records contain the number of messages sent and received, the intermediary needs to determine the access lock corresponding to the requesting party in the interacting party's lock table before accessing the first send / receive record. Only by acquiring the access lock can the intermediary query or modify the requesting party's send / receive record in the first send / receive record. This prevents errors in recording the requesting party's send / receive records during high concurrency, improving the intermediary's reliability and accuracy. Since the interacting party's send / receive records contain the number of messages sent and received (i.e., the number of times the intermediary receives a request message from the sender and sends it to the receiver, waiting for a response message from the receiver), when the interacting party's send / receive records meet preset conditions, a disconnection permission response is sent to the requesting party to inform them that the connection can be disconnected. This ensures that no information is lost when the interacting party disconnects from the intermediary, increasing the intermediary's stability and reducing the possibility of information loss.

[0143] Based on the same technological concept Figure 12 An exemplary schematic diagram of a disconnection device provided in an embodiment of the present invention is shown, illustrating the process that the device can perform.

[0144] like Figure 12 As shown, the device specifically includes:

[0145] The receiving module 1210 is used to receive a disconnection request sent by the requester;

[0146] The processing module 1220 is used to determine whether the number of messages sent and received in the first message sending and receiving record meets the set conditions; the first message sending and receiving record is determined from the message sending and receiving records of each interactive party that includes the requesting party; the message sending and receiving record of each interactive party is generated by the intermediary based on the message sending and receiving count of that interactive party; each message sending and receiving record of each interactive party is set with its own access lock.

[0147] If the number of transmitted and received records in the first transmit / receive record is determined to meet the set conditions, a disconnection permission response is sent to the requesting party.

[0148] Optionally, the processing module 1220 is specifically used for:

[0149] Receive registration information sent by the interacting party, wherein the registration information includes the identifier information of the sender and the identifier information of the receiver;

[0150] Based on the identifier information of the sender and the identifier information of the receiver, an access lock is generated for accessing the sending and receiving records of the interacting parties.

[0151] Add a key-value pair to the send lock table, with the sender's identification information as the key and the receiver's identification information and the access lock as the values;

[0152] Add a key-value pair to the receive lock table, with the receiver's identification information as the key and the sender's identification information and the access lock as the values.

[0153] Optionally, the processing module 1220 is specifically used for:

[0154] If the requesting party is the sender, then the value corresponding to the sender's identification information is determined from the send lock table; based on the receiver's identification information and the sender's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0155] If the requester is the receiver, then the value corresponding to the receiver's identification information is determined from the receiver lock table; based on the sender's identification information and the receiver's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

[0156] Optionally, the processing module 1220 is specifically used for:

[0157] Access the first transmit / receive record using the access lock in the value;

[0158] After determining that the number of transmissions in the first transmission record meets the set conditions, and sending a first disconnection permission response to the requesting party, the access lock is released upon receiving a connection disconnection notification from the receiving party.

[0159] Optionally, the requester is the sender;

[0160] The processing module 1220 is further configured to:

[0161] Receive a message from the sender; the message includes the identifier information of the target receiver;

[0162] If the access locks for the sender and the target receiver are not obtained from the send lock table, then the access locks for the sender and the alternative receiver are obtained from the send lock table, and the message is sent to the alternative receiver; the alternative receiver has the same function as the target receiver.

[0163] Optionally, the processing module 1220 is further configured to:

[0164] If it is determined that the number of transmitted and received records in the first transmit / receive record does not meet the set conditions, a disconnection waiting response is sent to the requesting party.

[0165] Receive messages sent by the receiver in the interaction party, and modify the number of messages sent and received in the first send and receive record through the access lock of the first send and receive record;

[0166] If the number of transmissions in the first transmission record meets the set conditions or the waiting time meets the set threshold, then the disconnection permission response is sent to the requesting party.

[0167] Optionally, the processing module 1220 is specifically used for:

[0168] If a message is received from the sender in the interaction, the access lock corresponding to the send and receive record of the interaction is obtained;

[0169] The access lock is used to increment the access count in the send / receive records of the interacting party by 1;

[0170] If a message is received from the receiver in the interaction, the access lock corresponding to the send and receive record of the interaction is obtained.

[0171] The access lock is used to decrement the access count in the send / receive records of the interacting party by 1.

[0172] Optionally, the processing module 1220 is further configured to:

[0173] Before initiating a connection termination, reject messages sent by the sender among the interacting parties;

[0174] If the number of accesses in the send and receive records of each interacting party meets the set conditions, the connection with each interacting party is disconnected.

[0175] Based on the same technical concept, embodiments of the present invention also provide a computing device, including:

[0176] Memory, used to store program instructions;

[0177] The processor is used to call the program instructions stored in the memory and execute the above-mentioned disconnection method according to the obtained program.

[0178] Based on the same technical concept, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a disconnection method.

[0179] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0180] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0181] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0182] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0183] 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.

Claims

1. A method for disconnecting a connection, characterized in that, include: The intermediary receives the disconnection request sent by the requesting party; The intermediary determines whether the number of transmitted and received records in the first transmit / receive record meets the set conditions; The first send and receive record is determined from the send and receive records of each interacting party, which includes the send and receive record of the requesting party; the send and receive record of each interacting party is generated by the intermediary based on the number of messages sent and received by that interacting party; each send and receive record of each interacting party is set with its own access lock. Each interacting party's send and receive records are configured with its own access lock, including: the intermediary receiving registration information sent by the interacting party, the registration information including the sender's identification information and the receiver's identification information; the intermediary generating an access lock for accessing the interacting party's send and receive records based on the sender's identification information and the receiver's identification information; the intermediary adding a key-value pair to the send lock table with the sender's identification information as the key and the receiver's identification information and the access lock as the value; the intermediary adding a key-value pair to the receive lock table with the receiver's identification information as the key and the sender's identification information and the access lock as the value. If the intermediary determines that the number of transmissions in the first transmission record meets the set conditions, it sends a disconnection permission response to the requesting party.

2. The method as described in claim 1, characterized in that, The first send / receive record is determined from the send / receive records of each interacting party, including the send / receive record containing the requesting party, comprising: If the requesting party is the sender, then the value corresponding to the sender's identification information is determined from the send lock table; based on the receiver's identification information and the sender's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value. If the requester is the receiver, then the value corresponding to the receiver's identification information is determined from the receiver lock table; based on the sender's identification information and the receiver's identification information in the value, the first transmit / receive record is searched, and the first transmit / receive record is accessed using the access lock in the value.

3. The method as described in claim 2, characterized in that, The requester is the receiver; The intermediate party determines whether the number of transmitted and received data in the first transmit / receive record meets the set conditions, including: The intermediary uses the access lock in the value to access the first transmit / receive record; After the intermediary determines that the number of transmitted and received data in the first transmit / receive record meets the set conditions and sends a first disconnection permission response to the requesting party, the method further includes: Upon receiving a connection termination notification from the receiver, the intermediary releases the access lock.

4. The method as described in claim 1, characterized in that, The requester is the sender; The method further includes: The intermediary receives the message from the sender; the message includes the identification information of the target receiver; If the intermediary does not obtain the access locks for the sender and the target receiver from the send lock table, it obtains the access locks for the sender and the alternative receiver from the send lock table and sends the message to the alternative receiver; the alternative receiver has the same function as the target receiver.

5. The method as described in claim 1, characterized in that, The method further includes: If the intermediary determines that the number of transmitted and received data in the first transmit / receive record does not meet the set conditions, it sends a disconnection and waiting response to the requesting party. The intermediary receives messages sent by the receiver in the interaction party and modifies the number of messages sent and received in the first send and receive record through the access lock of the first send and receive record; If the intermediary determines that the number of transmissions in the first transmission record meets the set conditions or the waiting time meets the set threshold, it sends the disconnection permission response to the requesting party.

6. The method according to any one of claims 1 to 5, characterized in that, Each interaction party's send and receive records are generated by the intermediary based on the number of messages sent and received by that interaction party, including: If the intermediary receives a message from the sender in the interaction party, it acquires the access lock corresponding to the send and receive record of the interaction party. The intermediary increments the access count in the sending and receiving records of the interacting party by 1 using the access lock; If the intermediary receives a message sent by the receiver in the interaction party, it acquires the access lock corresponding to the send and receive record of the interaction party. The intermediary uses the access lock to decrement the access count in the sending and receiving records of the interacting party by 1.

7. The method as described in claim 6, characterized in that, The method further includes: Before initiating a connection termination, the intermediary party rejects messages sent by the sender among the interacting parties. The intermediary disconnects from each interacting party when it determines that the number of accesses in the sending and receiving records of each interacting party meets the set conditions.

8. A computing device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method according to any one of claims 1 to 7.