Channel processing method, apparatus and device

By dynamically adjusting channel processing strategies in the bank's external system, combined with multiplexing switches and thread group processing, the resource overhead problem during network anomalies was solved, achieving seamless channel switching and resource optimization, and improving system efficiency.

CN115002704BActive Publication Date: 2025-12-09CHINA CONSTRUCTION BANK
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210467591.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2025-12-09
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

When the bank's external connection system experiences network anomalies, it needs to be shut down and polling checks initiated, resulting in significant resource overhead when the channel processes requests. This makes it unsuitable for a large number of tenants and channels.

Method used

By determining the operating status of the multiplexing switch corresponding to the channel queue, the channel processing strategy is dynamically adjusted to a single-threaded multiplexing or thread group processing strategy. Request processing is performed in combination with the work selector and thread group, and a circuit breaker degradation mechanism is introduced to optimize the channel management mode.

Benefits of technology

It enables seamless channel switching without affecting service operation, reduces the impact of IO blocking, improves system resource utilization efficiency, and provides a dynamic, efficient, controllable, and loosely coupled channel management model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115002704B_ABST
    Figure CN115002704B_ABST
Patent Text Reader

Abstract

The application provides a channel processing method, device and equipment, and relates to data processing technology. The method comprises the following steps: if it is determined that a to-be-processed request enters a preset channel queue, determining the running state of a multiplexing switch of a channel corresponding to the channel queue; wherein the running state is obtained in response to a switching operation. According to the running state of the multiplexing switch, a channel processing strategy is determined; wherein the channel processing strategy represents processing rule information about the to-be-processed request. The to-be-processed request is processed according to the channel processing strategy, and target information corresponding to the to-be-processed request is obtained. In the case of not affecting service operation, the application can realize seamless switching of channels in response to the switching operation of a user, reduce the influence of input / output blocking, improve the system resource use efficiency, provide a dynamic, efficient, controllable, loosely-coupled and channel management mode for a bank external system, and solve the problem of low network resource utilization rate when processing channel requests.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the data processing technology field, and particularly relates to a channel processing method, device and equipment. BACKGROUND

[0002] At present, in a bank external contact system, there is a large demand for access of external contact units, each external contact unit has channels and various protocol messages managed by itself, therefore, the bank external contact system needs to uniformly receive information provided by each external contact unit.

[0003] In the prior art, when the bank external contact system uniformly receives information provided by each external contact unit, a separate deployment mode is usually used for each channel, each access point (AP) corresponds to a channel, and a message queue or a thread pool is used to process a request in the channel, so that corresponding information is obtained.

[0004] However, in the prior art, since the message queue or the thread pool is used to process the request in the channel, for a channel that limits 1 AP connection, the service needs to be stopped and polling checking needs to be started after a network exception, and the service can be restored only after the network is normal, which leads to a large resource consumption when the channel processes the request, and is not suitable for a bank external contact system with a large number of tenants and channels. SUMMARY

[0005] The present application provides a channel processing method, device and equipment to solve the technical problem of low utilization rate of network resources when processing a request.

[0006] In a first aspect, the present application provides a channel processing method, comprising:

[0007] If it is determined that a to-be-processed request enters a preset channel queue, a running state of a multiplexing switch of a channel corresponding to the channel queue is determined, wherein the running state is obtained in response to a switching operation;

[0008] According to the running state of the multiplexing switch, a channel processing strategy is determined, wherein the channel processing strategy represents processing rule information about the to-be-processed request;

[0009] According to the channel processing strategy, the to-be-processed request is processed to obtain target information corresponding to the to-be-processed request.

[0010] Further, according to the running state of the multiplexing switch, the channel processing strategy is determined, comprising:

[0011] According to the open state of the multiplexing switch, the channel processing strategy is determined as a single-thread multiplexing strategy;

[0012] According to the closing state of the multiplexing switch, the channel processing strategy is determined as a thread group processing strategy.

[0013] Further, the method further comprises:

[0014] If it is determined that the channel processing strategy is a single-thread multiplexing strategy, a channel queue corresponding to the channel is registered in a preset work selector; wherein the work selector comprises a single thread corresponding to each channel.

[0015] According to the single-thread multiplexing strategy and the single thread in the work selector, the pending request is processed to obtain target information corresponding to the pending request.

[0016] Further, the method further comprises:

[0017] If it is determined that the channel processing strategy is a thread group processing strategy, a thread group corresponding to the channel is generated.

[0018] According to the thread group processing strategy and the plurality of threads in the thread group, the pending request is processed concurrently to obtain target information corresponding to the pending request.

[0019] Further, the method further comprises:

[0020] If it is determined that there is a pending request waiting for processing in the channel queue, and it is determined that the number of threads in the thread group does not reach a preset maximum concurrent thread threshold, a new thread is generated.

[0021] According to the thread group processing strategy, the plurality of threads in the thread group, and the new thread, the pending request is processed concurrently to obtain target information corresponding to the pending request.

[0022] Further, the method further comprises:

[0023] If it is determined that the channel queue is empty, the thread in the idle state is interrupted.

[0024] Further, the channel queue is obtained according to a preset channel component, and the channel component has corresponding channel configuration information; the channel configuration information comprises a channel address, a protocol type corresponding to the channel processing strategy, and a preset channel timeout threshold corresponding to each channel.

[0025] Further, the method further comprises:

[0026] If it is determined that the multiplexing switch is in an open state, and it is determined that the number of requests that fail to be executed in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the channel is logged out;

[0027] If it is determined that the multiplexing switch is in a closed state, and it is determined that the number of threads that fail to be executed in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the thread group corresponding to the channel is destroyed.

[0028] Further, the method further comprises:

[0029] The channel in which the thread that fails to be executed is located is polled by the check manager until the channel returns to normal.

[0030] In a second aspect, the application provides a channel processing apparatus, comprising:

[0031] A first determination unit is configured to determine the running state of a multiplexing switch of a channel corresponding to a preset channel queue if it is determined that a request to be processed enters the channel queue; wherein the running state is obtained in response to a switching operation;

[0032] A second determination unit is configured to determine a channel processing strategy according to the running state of the multiplexing switch; wherein the channel processing strategy represents processing rule information about the request to be processed;

[0033] A processing unit is configured to process the request to be processed according to the channel processing strategy to obtain target information corresponding to the request to be processed.

[0034] Further, the second determination unit comprises:

[0035] A first determination module is configured to determine that the channel processing strategy is a single-thread multiplexing strategy according to the open state of the multiplexing switch;

[0036] A second determination module is configured to determine that the channel processing strategy is a thread group processing strategy according to the closed state of the multiplexing switch.

[0037] Further, the processing unit comprises:

[0038] A registration module is configured to register the channel corresponding to the channel queue in a preset work selector if it is determined that the channel processing strategy is a single-thread multiplexing strategy; wherein the work selector comprises a single thread corresponding to each channel.

[0039] The first processing module is configured to process the to-be-processed request according to the single-thread multiplexing strategy and the single thread in the work selector, to obtain target information corresponding to the to-be-processed request.

[0040] Further, the processing unit comprises:

[0041] The generating module is configured to generate a thread group corresponding to the channel if it is determined that the channel processing strategy is a thread group processing strategy.

[0042] The second processing module is configured to concurrently process the to-be-processed request according to the thread group processing strategy and the multiple threads in the thread group, to obtain target information corresponding to the to-be-processed request.

[0043] Further, the second processing module comprises:

[0044] The generating submodule is configured to generate a new thread if it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold.

[0045] The processing submodule is configured to concurrently process the to-be-processed request according to the thread group processing strategy, the multiple threads in the thread group, and the new thread, to obtain target information corresponding to the to-be-processed request.

[0046] Further, the apparatus further comprises:

[0047] The interrupting submodule is configured to interrupt the thread in an idle state if it is determined that the channel queue is empty.

[0048] Further, the channel queue is obtained according to a preset channel component, the channel component has corresponding channel configuration information; the channel configuration information comprises a channel address, a protocol type corresponding to a channel processing strategy, and a preset channel timeout threshold corresponding to each channel.

[0049] Further, the apparatus further comprises:

[0050] The logging-off unit is configured to log off the channel if it is determined that the multiplexing switch is in an on state and the number of execution-failed requests in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel.

[0051] The destroying unit is configured to destroy the thread group corresponding to the channel if it is determined that the multiplexing switch is in an off state and the number of execution-failed threads in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel.

[0052] Further, the apparatus further comprises:

[0053] The polling unit is configured to poll the channel where the thread fails to execute until the channel recovers to normal by checking the manager.

[0054] In a third aspect, the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor implements the method of the first aspect when executing the computer program.

[0055] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are used to implement the method of the first aspect when executed by a processor.

[0056] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and the computer program is used to implement the method of the first aspect when executed by a processor.

[0057] The channel processing method, device and equipment provided by the present application are as follows: if it is determined that a to-be-processed request enters a preset channel queue, the running state of a multiplexing switch of a channel corresponding to the channel queue is determined; wherein the running state is obtained in response to a switching operation. According to the running state of the multiplexing switch, a channel processing strategy is determined; wherein the channel processing strategy represents processing rule information about the to-be-processed request. The to-be-processed request is processed according to the channel processing strategy, and target information corresponding to the to-be-processed request is obtained. In the present application, if it is determined that the to-be-processed request has entered the preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined, and the running state is obtained in response to the switching operation of the user. Then, according to the running state of the multiplexing switch, the corresponding channel processing strategy is determined, and then the to-be-processed request is processed according to the channel processing strategy, and target information corresponding to the to-be-processed request is obtained. Therefore, without affecting the service running, the seamless switching of the channel can be realized in response to the switching operation of the user, the influence of Input / Output (IO) blocking is reduced, the system resource use efficiency is improved, a dynamic, efficient, controllable, loosely coupled channel management mode is provided for the bank external system, and the technical problem of low utilization rate of network resources in processing channel requests is solved. BRIEF DESCRIPTION OF DRAWINGS

[0058] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, further serve to explain the principles of the present disclosure.

[0059] Figure 1 A flowchart of a channel processing method provided by an embodiment of the present application is shown in the figure;

[0060] Figure 2 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0061] Figure 3 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0062] Figure 4 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0063] Figure 5 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0064] Figure 6 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0065] Figure 7 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0066] Figure 8 Another channel processing method provided by an embodiment of the present application is shown in the flowchart of FIG. 6.

[0067] The specific embodiments of the present disclosure have been shown through the above-described drawings, and will be described in more detail hereinafter. These drawings and written descriptions are not intended to limit the scope of the concept of the present disclosure by any means, but to illustrate the concept of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0068] Exemplary embodiments will be described in detail herein below with reference to the drawings. In the following description, the same numbers refer to the same elements throughout the drawings, unless otherwise represented. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with the present disclosure.

[0069] In one example, in a bank external contact system, there is a large demand for access by external contact units, each of which has its own managed channel and various protocol messages, so the bank external contact system needs to uniformly receive information provided by each external contact unit. In the prior art, when the bank external contact system uniformly receives information provided by each external contact unit, it is usually deployed in a separate channel, with each wireless access point (AP) corresponding to a channel, using a message queue or thread pool to process requests in the channel to obtain the corresponding information. However, in the prior art, since the message queue or thread pool is used to process requests in the channel, for a channel that limits 1 AP connection, it needs to stop service and start polling check after network exception, and can only resume service after the network is normal, resulting in a large resource overhead when processing channel requests, which is not suitable for a bank external contact system with a large number of tenants and channels.

[0070] The channel processing method, device and equipment provided by the present application are aimed at solving the above technical problems of the prior art.

[0071] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the drawings.

[0072] Figure 1 A flowchart of a channel processing method provided by an embodiment of the present application is shown in FIG. 1, which includes the following steps. Figure 1

[0073] 101. If it is determined that the request to be processed enters a preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined; wherein the running state is obtained in response to a switching operation.

[0074] Exemplarily, the execution subject of the present embodiment can be an electronic device, or a terminal device, or a channel processing device or equipment, or other devices or equipment that can execute the present embodiment, and no limitation is made thereto. In the present embodiment, the execution subject is introduced as an electronic device.

[0075] Firstly, an operator creates a channel component through a configuration tool, and configures basic channel configuration information for the channel component, which includes a channel address, a protocol type corresponding to a channel processing strategy, and a preset channel timeout threshold corresponding to each channel, etc. Then the channel configuration information is published and the channel component is published synchronously. The channel component initializes to create a channel queue, and requests will enter the channel queue to wait for consumption channel.setQueueTask(). The channel queue of each channel component has a corresponding multiplexing switch, and the running state of the multiplexing switch is set by the user. If the user sets the multiplexing switch to an open state, the channel is registered to the work selector when the channel component is published; if the multiplexing switch is in a closed state, the maximum number of concurrent threads is set, and the corresponding thread group is created for the channel when the channel component is published. Moreover, after the channel component is published, the user can switch the running state of the multiplexing switch at any time. Therefore, if the electronic device determines that the request to be processed has entered the preset channel queue corresponding to the channel component, the running state of the multiplexing switch of the channel corresponding to the channel queue can be determined.

[0076] 102. The channel processing strategy is determined according to the running state of the multiplexing switch; wherein the channel processing strategy represents the processing rule information about the request to be processed.

[0077] ​Exemplarily, the electronic device determines, according to the on state of the multiplexing switch, that the channel processing strategy is a single-thread multiplexing strategy if the multiplexing switch is determined to be in the on state; wherein the channel processing strategy represents processing rule information about the to-be-processed request; and determines, according to the off state of the multiplexing switch, that the channel processing strategy is a thread group processing strategy if the multiplexing switch is determined to be in the off state.

[0078] 103. Process the to-be-processed request according to the channel processing strategy to obtain target information corresponding to the to-be-processed request.

[0079] Exemplarily, the electronic device can process the to-be-processed request in the channel queue according to the single-thread multiplexing strategy to obtain target information corresponding to the to-be-processed request. Or, the electronic device can process the to-be-processed request in the channel queue according to the thread group processing strategy to obtain target information corresponding to the to-be-processed request.

[0080] In the embodiment of the present application, if it is determined that the to-be-processed request enters the preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined; wherein the running state is obtained in response to the switching operation. The channel processing strategy is determined according to the running state of the multiplexing switch; wherein the channel processing strategy represents processing rule information about the to-be-processed request. The to-be-processed request is processed according to the channel processing strategy to obtain target information corresponding to the to-be-processed request. In the present scheme, if it is determined that the to-be-processed request has entered the preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined, and the running state is obtained in response to the switching operation of the user. Then the corresponding channel processing strategy is determined according to the running state of the multiplexing switch, and then the to-be-processed request is processed according to the channel processing strategy to obtain target information corresponding to the to-be-processed request. Therefore, without affecting the service running, the seamless switching of the channel can be realized in response to the switching operation of the user, the influence of Input / Output (IO) blocking is reduced, the system resource use efficiency is improved, a dynamic, efficient, controllable, loosely coupled channel management mode is provided for the bank external system, and the technical problem of low utilization rate of network resources in processing channel requests is solved.

[0081] Figure 2 Another flowchart of a channel processing method provided by the embodiment of the present application is shown in FIG. 2, and the method comprises the following steps. Figure 2

[0082] 201. If it is determined that the to-be-processed request enters the preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined; wherein the running state is obtained in response to the switching operation.

[0083] ​In an example, the channel queue is obtained according to a preset channel component, and the channel component has corresponding channel configuration information; the channel configuration information includes a channel address, a protocol type corresponding to a channel processing strategy, and a preset channel timeout threshold corresponding to each channel.

[0084] By way of example, this step can refer to step 101 in Figure 1 , and will not be described again.

[0085] 202. According to the opening state of the multiplexing switch, determine that the channel processing strategy is a single-thread multiplexing strategy.

[0086] By way of example, the electronic device can determine that the channel processing strategy is a single-thread multiplexing strategy according to the opening state of the multiplexing switch channel.setNIO(true).

[0087] 203. According to the closing state of the multiplexing switch, determine that the channel processing strategy is a thread group processing strategy.

[0088] By way of example, the electronic device can determine that the channel processing strategy is a thread group processing strategy according to the closing state of the multiplexing switch channel.setNIO(false).

[0089] 204. Process the request to be processed according to the channel processing strategy to obtain target information corresponding to the request to be processed.

[0090] Step 204 includes two ways:

[0091] The first way of step 204: if it is determined that the channel processing strategy is a single-thread multiplexing strategy, register the channel corresponding to the channel queue in a preset work selector; wherein the work selector includes a single thread corresponding to each channel; process the request to be processed according to the single-thread multiplexing strategy and the single thread in the work selector to obtain target information corresponding to the request to be processed.

[0092] The second way of step 204: if it is determined that the channel processing strategy is a thread group processing strategy, generate a thread group corresponding to the channel; process the request to be processed concurrently according to the thread group processing strategy and the multiple threads in the thread group to obtain target information corresponding to the request to be processed.

[0093] In one example, the concurrent processing of the to-be-processed request according to the thread group processing strategy and the multiple threads in the thread group to obtain the target information corresponding to the to-be-processed request includes: if it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold, a new thread is generated; and the to-be-processed request is processed concurrently according to the thread group processing strategy, the multiple threads in the thread group, and the new thread, to obtain the target information corresponding to the to-be-processed request.

[0094] In one example, if it is determined that the channel queue is empty, the thread in the idle state is interrupted.

[0095] By way of example, the electronic device can process the to-be-processed request according to the type of the channel processing strategy to obtain the target information corresponding to the to-be-processed request.

[0096] For example, in the first mode, if it is determined that the channel processing strategy is a single-threaded multiplexing strategy, the channel corresponding to the channel queue is registered in a preset work selector channel.register(selector), and a single thread corresponding to each channel is generated in the work selector. Then, the to-be-processed request in the preset queue is processed according to the single-threaded multiplexing strategy and the single thread in the work selector, to obtain the target information corresponding to each to-be-processed request.

[0097] In the second mode, if the electronic device determines that the channel processing strategy is a thread group processing strategy, a thread group corresponding to the channel is generated, that is, the channel is used to bind the thread group one by one channel.createThreadGroup(). Then, the to-be-processed request is processed concurrently according to the thread group processing strategy and the multiple threads in the thread group, to obtain the target information corresponding to the to-be-processed request. During the processing, if it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold, a new thread can be continuously generated to consume the to-be-processed request in the preset queue. Then, the to-be-processed request is processed concurrently according to the thread group processing strategy, the multiple threads in the thread group, and the new thread, and the request in the thread group processing is marked channel.setRunningTask(), to obtain the target information corresponding to the to-be-processed request. If the thread cannot consume the to-be-processed request in the preset queue, an uncaught exception uncaughtException is captured, and the thread is interrupted this.interrupt() in the thread group.

[0098] And, if the multiplex switch is in the open state, the single-thread multiplex strategy is used to process the pending request, and the user manually modifies the open state of the multiplex switch to the closed state, at this time the multiplex switch is closed channel.setNIO(false), the request of the current thread is waiting for processing, and the new request in the preset queue is processed by the thread group. Or, if the multiplex switch is in the closed state, the thread group processing strategy is used to process the pending request, and the user manually modifies the closed state of the multiplex switch to the open state, at this time the multiplex switch is opened channel.setNIO(true), the request of the current thread group is waiting for processing, and the new request in the preset queue is processed by the working selector.

[0099] 205、If it is determined that the multiplex switch is in the open state, and it is determined that the number of execution failed requests in the channel is greater than or equal to the preset channel timeout threshold corresponding to the channel, the channel is processed.

[0100] Exemplarily, the electronic device compares the channel with the preset channel timeout threshold corresponding to the channel, if it is determined that the multiplex switch is in the open state, and it is determined that the number of execution failed requests in the channel is greater than or equal to the preset channel timeout threshold corresponding to the channel, it is determined that the channel connection is timed out or lost, the data being processed is abandoned immediately, and a timeout transaction code is returned, the IO blocking is slowed down, and the system resource overhead is reduced. Further, the channel is cancelled SelectionKey.cancel(), so as to reduce the selector system resource occupation.

[0101] 206、If it is determined that the multiplex switch is in the closed state, and it is determined that the number of threads executing failed in the channel is greater than or equal to the preset channel timeout threshold corresponding to the channel, the thread group corresponding to the channel is destroyed.

[0102] Exemplarily, if the electronic device determines that the multiplex switch is in the closed state, and it is determined that the number of threads executing failed in the channel is greater than or equal to the preset channel timeout threshold corresponding to the channel, it indicates that the channel is unavailable, which may cause thread IO blocking, the active thread in the thread group is forcibly stopped threadGroup.stop(), the data being processed is abandoned immediately, and a timeout transaction code is returned, the IO blocking is slowed down, the system resource overhead is reduced, and the thread group is destroyed threadGroup.destroy().

[0103] 207, the channel where the thread executing failed is polled by the checking manager until the channel recovers to normal.

[0104] Exemplarily, the channel component has a corresponding preset queue, the preset queue has a corresponding channel, if single thread or thread group in the channel fails to execute, it is determined that the channel is timeout or loses connection, the channel component corresponding to the channel is marked as timeout close channel.setTimeOutClose(true), and all requests in the preset queue corresponding to the channel, marked requests and subsequent requests entering the preset queue are processed as timeout transactions. At the same time, the channel component informs the check manager to schedule the check thread pool, and starts a thread to poll the channel (heart beat detection or telnet command can be used) channel.runCheck(), one channel corresponds to one detection thread, when the channel network is stable, the channel component is informed to set the timeout close mark channel.setTimeOutClose(false), and the work selector is registered or the thread group is created again, the channel request can enter the queue for consumption, thereby improving the network resource utilization.

[0105] In the embodiment of the application, if it is determined that the to-be-processed request enters the preset channel queue, the running state of the multiplexing switch of the channel corresponding to the channel queue is determined. According to the open state of the multiplexing switch, the channel processing strategy is determined as a single-thread multiplexing strategy. According to the closed state of the multiplexing switch, the channel processing strategy is determined as a thread group processing strategy. The to-be-processed request is processed according to the channel processing strategy to obtain target information corresponding to the to-be-processed request. If it is determined that the multiplexing switch is in the open state and the number of requests that fail to execute in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the channel is unregistered. If it is determined that the multiplexing switch is in the closed state and the number of threads that fail to execute in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the thread group corresponding to the channel is destroyed. The channel where the thread that fails to execute is located is polled by the check manager until the channel recovers to normal. Therefore, without affecting the service running, the seamless switching of the channel can be realized in response to the switching operation of the user, the influence of Input / Output (IO) blocking is reduced, the system resource use efficiency is improved, a dynamic, efficient, controllable, loosely coupled channel management mode is provided for the bank external system, and the technical problem of low network resource utilization rate in processing channel requests is solved. Moreover, based on the separation of the configured channel component (i.e. the production end) and the channel (the consumption end), the operation and maintenance personnel are liberated from the tedious channel configuration by introducing the channel component configuration development mode, the dynamic configuration of the channel component realizes the loose coupling of the component and the channel, the multiplexing switch provides support for long and short connections and multiple protocols, the work selector and the thread group are used in combination, the fuse degradation mechanism is used, the IO efficiency is effectively improved, and the network connection anomaly detection is also supported.

[0106] Exemplarily, Figure 3 A method schematic diagram of still another channel processing method provided by an embodiment of the present application is shown in Figure 4 A method schematic diagram of still another channel processing method provided by an embodiment of the present application is shown in

[0107] Figure 5 A structure schematic diagram of a channel processing apparatus provided by an embodiment of the present application is shown in Figure 5 The apparatus comprises:

[0108] A first determining unit 31 is configured to determine a running state of a multiplexing switch of a channel corresponding to a channel queue if it is determined that a to-be-processed request enters the channel queue.

[0109] A second determining unit 32 is configured to determine a channel processing strategy according to the running state of the multiplexing switch; wherein the channel processing strategy represents processing rule information about the to-be-processed request.

[0110] A processing unit 33 is configured to process the to-be-processed request according to the channel processing strategy to obtain target information corresponding to the to-be-processed request.

[0111] The apparatus of the embodiment can execute the technical solutions in the above method, and the specific implementation process and technical principles are the same, which will not be repeated here.

[0112] Figure 6 A structure schematic diagram of another channel processing apparatus provided by an embodiment of the present application is shown in Figure 5 the embodiment based on Figure 6 The second determining unit 32 comprises:

[0113] A first determining module 321 is configured to determine that the channel processing strategy is a single-thread multiplexing strategy according to the open state of the multiplexing switch.

[0114] A second determining module 322 is configured to determine that the channel processing strategy is a thread group processing strategy according to the closed state of the multiplexing switch.

[0115] In one example, the processing unit 33 comprises:

[0116] A registration module 331 is configured to register the channel corresponding to the channel queue into a preset work selector if it is determined that the channel processing strategy is the single-thread multiplexing strategy; wherein the work selector comprises single threads corresponding to each channel.

[0117] A first processing module 332 is configured to process the to-be-processed request according to the single-thread multiplexing strategy and the single threads in the work selector to obtain the target information corresponding to the to-be-processed request.

[0118] In one example, the processing unit 33 comprises:

[0119] The generating module 333 is configured to generate a thread group corresponding to the channel if it is determined that the channel processing strategy is the thread group processing strategy.

[0120] The second processing module 334 is configured to perform concurrent processing on the to-be-processed requests according to the thread group processing strategy and the plurality of threads in the thread group, to obtain target information corresponding to the to-be-processed requests.

[0121] In one example, the second processing module 334 comprises:

[0122] The generating sub-module 3341 is configured to generate a new thread if it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold.

[0123] The processing sub-module 3342 is configured to perform concurrent processing on the to-be-processed requests according to the thread group processing strategy, the plurality of threads in the thread group, and the new thread, to obtain target information corresponding to the to-be-processed requests.

[0124] In one example, the apparatus further comprises:

[0125] The interrupting sub-module 41 is configured to interrupt the thread in the idle state if it is determined that the channel queue is empty.

[0126] In one example, the channel queue is obtained according to a preset channel component, and the channel component has corresponding channel configuration information; the channel configuration information comprises a channel address, a protocol type corresponding to the channel processing strategy, and a preset channel timeout threshold corresponding to each channel.

[0127] In one example, the apparatus further comprises:

[0128] The logging-off unit 42 is configured to log off the channel if it is determined that the multiplexing switch is in the open state and the number of execution-failed requests in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel.

[0129] The destroying unit 43 is configured to destroy the thread group corresponding to the channel if it is determined that the multiplexing switch is in the closed state and the number of execution-failed threads in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel.

[0130] In one example, the apparatus further comprises:

[0131] The polling unit 44 is configured to perform polling processing on the channel in which the execution-failed thread is located by the checking manager until the channel recovers to normal.

[0132] The device of the embodiment can execute the technical solutions in the above method, and the specific implementation process and technical principles are the same, which will not be repeated here.

[0133] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 1. The electronic device includes a memory 51 and a processor 52. Figure 7

[0134] The memory 51 stores a computer program that can run on the processor 52.

[0135] The processor 52 is configured to execute the method provided by the above embodiment.

[0136] The electronic device further includes a receiver 53 and a transmitter 54. The receiver 53 is configured to receive instructions and data sent by an external device, and the transmitter 54 is configured to send instructions and data to the external device.

[0137] Figure 8 FIG. 1 is a block diagram of an electronic device provided by an embodiment of the present application. The electronic device can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.

[0138] The device 600 can include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.

[0139] The processing component 602 usually controls overall operations of the device 600, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 602 can include one or more processors 620 to execute instructions to complete all or part of steps of the above methods. In addition, the processing component 602 can include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0140] ​The memory 604 is configured to store various types of data to support operations of the device 600. Examples of such data include instructions for any application or methods operating on the device 600, contact data, phonebook data, messages, pictures, videos, and so on. The memory 604 can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof 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 disk.

[0141] The power supply component 606 supplies electrical power for various components of the device 600. The power supply component 606 can include a power supply management system, one or more power supplies, and other components associated with generating, managing, and distributing electrical power for the device 600.

[0142] The multimedia component 608 includes a screen providing an output interface between the device 600 and a user. In some embodiments, the screen includes a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping, and gestures on the touch panel. The touch sensors can not only sense a boundary of a touch or swiping action, but also detect duration and pressure related to the touch or swiping action. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. The front and / or rear camera can receive external multimedia data when the device 600 is in an operation mode such as a shooting mode or a video mode. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0143] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is configured to receive external audio signals when the device 600 is in an operation mode such as a calling mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0144] The I / O interface 612 provides an interface between the processing component 602 and peripheral interface modules such as a keyboard, a click wheel, buttons, and so on. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0145] The sensor component 614 includes one or more sensors for providing status assessments for various aspects of the device 600. For example, the sensor component 614 can detect an open / closed position of the device 600, relative positioning of components, such as a display and keypad of the device 600, a change in position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600, and a temperature change of the device 600. The sensor component 614 can include proximity sensor(s) configured to detect the presence of objects in a proximity without any physical contact. The sensor component 614 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 614 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0146] The communication component 616 is configured to facilitate wired or wireless communication between the device 600 and another device. The device 600 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0147] In an exemplary embodiment, the device 600 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic elements, for performing the above-described methods.

[0148] In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 604 including instructions, is also provided, which can be executed by the processor 620 of the device 600 to complete the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.

[0149] The embodiments of the present application also provide a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method provided by the above-described embodiments.

[0150] The embodiment of the present application further provides a computer program product, which comprises a computer program stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to enable the electronic device to execute the scheme provided in any one of the above embodiments.

[0151] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present disclosure cover any and all variations of the application that come within the scope of the following claims and their equivalents. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the application indicated by the following claims.

[0152] It should be understood that the present disclosure is not limited to the precise structures as herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the claims that follow.

Claims

1. A channel processing method, characterized by, The method comprises the steps of: If it is determined that the to-be-processed request enters a preset channel queue, the running state of a multiplexing switch of a channel corresponding to the channel queue is determined; wherein the running state is obtained in response to a switching operation; the channel queue is obtained according to a preset channel component; the channel component has corresponding channel configuration information; the channel configuration information comprises a channel address, a protocol type corresponding to a channel processing strategy, and a preset channel timeout threshold corresponding to each channel; if the multiplexing switch is set to an open state, the channel is registered to a work selector when the channel component is published; if the multiplexing switch is set to a closed state, the maximum number of concurrent threads is set, and a corresponding thread group is created for the channel when the channel component is published; the multiplexing switch supports long and short connections and multiple protocols; According to the running state of the multiplexing switch, a channel processing strategy is determined; wherein the channel processing strategy represents processing rule information about the to-be-processed request; According to the channel processing strategy, the to-be-processed request is processed to obtain target information corresponding to the to-be-processed request; If it is determined that the multiplexing switch is in an open state and the number of requests that fail to be executed in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the channel is unregistered; If it is determined that the multiplexing switch is in a closed state and the number of threads that fail to be executed in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel, the thread group corresponding to the channel is destroyed.

2. The method of claim 1, wherein, According to the running state of the multiplexing switch, a channel processing strategy is determined, comprising: According to the open state of the multiplexing switch, the channel processing strategy is determined to be a single-thread multiplexing strategy; According to the closed state of the multiplexing switch, the channel processing strategy is determined to be a thread group processing strategy.

3. The method of claim 2, wherein, According to the channel processing strategy, the to-be-processed request is processed to obtain target information corresponding to the to-be-processed request, comprising: If it is determined that the channel processing strategy is a single-thread multiplexing strategy, the channel corresponding to the channel queue is registered to a preset work selector; wherein the work selector comprises a single thread corresponding to each channel; According to the single-thread multiplexing strategy and the single thread in the work selector, the to-be-processed request is processed to obtain target information corresponding to the to-be-processed request.

4. The method of claim 2, wherein, According to the channel processing strategy, the to-be-processed request is processed to obtain target information corresponding to the to-be-processed request, comprising: If it is determined that the channel processing strategy is a thread group processing strategy, a thread group corresponding to the channel is generated; According to the thread group processing strategy and the multiple threads in the thread group, the to-be-processed request is processed in parallel to obtain target information corresponding to the to-be-processed request.

5. The method of claim 4, wherein, According to the thread group processing strategy and the multiple threads in the thread group, the to-be-processed request is processed in parallel to obtain target information corresponding to the to-be-processed request, comprising: If it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold, a new thread is generated; According to the thread group processing strategy, the plurality of threads in the thread group, and the new thread, the to-be-processed request is processed concurrently to obtain target information corresponding to the to-be-processed request.

6. The method of claim 5, wherein, The method further includes: If it is determined that the channel queue is empty, the thread in an idle state is interrupted.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: The channel where the thread that fails to execute is located is polled by a check manager until the channel returns to normal.

8. A channel processing device, characterized by Comprise: The first determination unit is configured to determine a running state of a multiplexing switch of a channel corresponding to a preset channel queue if it is determined that a to-be-processed request enters the channel queue, wherein the running state is obtained in response to a switching operation; the channel queue is obtained according to a preset channel component, and the channel component has corresponding channel configuration information; the channel configuration information comprises a channel address, a protocol type corresponding to a channel processing strategy, and a preset channel timeout threshold corresponding to each channel; if a user sets the multiplexing switch to an open state, the channel is registered to a work selector when the channel component is published; if the multiplexing switch is in a closed state, a maximum number of concurrent threads is set, and a corresponding thread group is created for the channel when the channel component is published; the multiplexing switch supports long and short connections and multiple protocols; The second determination unit is configured to determine a channel processing strategy according to the running state of the multiplexing switch, wherein the channel processing strategy represents processing rule information about the to-be-processed request. The processing unit is configured to process the to-be-processed request according to the channel processing strategy to obtain target information corresponding to the to-be-processed request; and the device further comprises: The logout unit is configured to perform logout processing on the channel if it is determined that the multiplexing switch is in the open state and the number of requests that fail to execute in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel. The destruction unit is configured to perform destruction processing on a thread group corresponding to the channel if it is determined that the multiplexing switch is in the closed state and the number of threads that fail to execute in the channel is greater than or equal to a preset channel timeout threshold corresponding to the channel.

9. The apparatus of claim 8, wherein, The second determination unit comprises: The first determination module is configured to determine that the channel processing strategy is a single-thread multiplexing strategy according to the open state of the multiplexing switch. The second determination module is configured to determine that the channel processing strategy is a thread group processing strategy according to the closed state of the multiplexing switch.

10. The apparatus of claim 9, wherein, The processing unit comprises: The registration module is configured to register the channel corresponding to the channel queue in a preset work selector if it is determined that the channel processing strategy is the single-thread multiplexing strategy, wherein the work selector comprises a single thread corresponding to each channel. The first processing module is configured to process the to-be-processed request according to the single-thread multiplexing strategy and the single thread in the work selector to obtain target information corresponding to the to-be-processed request.

11. The apparatus of claim 9, wherein, The processing unit comprises: The generation module is configured to generate a thread group corresponding to the channel if it is determined that the channel processing strategy is the thread group processing strategy. The second processing module is configured to perform concurrent processing on the to-be-processed request according to the thread group processing strategy and the plurality of threads in the thread group, to obtain target information corresponding to the to-be-processed request.

12. The apparatus of claim 11, wherein, The second processing module comprises: The generating submodule is configured to generate a new thread if it is determined that there is a to-be-processed request waiting for processing in the channel queue and the number of threads in the thread group does not reach a preset maximum concurrent thread threshold. The processing submodule is configured to perform concurrent processing on the to-be-processed request according to the thread group processing strategy, the plurality of threads in the thread group, and the new thread, to obtain target information corresponding to the to-be-processed request.

13. The apparatus of claim 12, wherein, The device further comprises: The interrupting submodule is configured to interrupt the thread in the idle state if it is determined that the channel queue is empty.

14. The apparatus of any one of claims 8-13, wherein, The device further comprises: The polling unit is configured to perform polling processing on the channel where the thread fails to execute by checking the manager until the channel returns to normal.

15. An electronic device, comprising: The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method in any one of claims 1-7.

16. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method in any one of claims 1-7.

17. A computer program product, characterised in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method in any one of claims 1-7.

Citation Information

Patent Citations

  • File transfer method and device

    CN103237049A

  • Service processing method and device, equipment and computer readable storage medium

    CN109561133A

  • AIR-ROS communication method and AIR-ROS communication system based on NIO

    CN111722944A