Abnormality processing method and device, equipment, medium and product
By adding custom annotations and aspect-oriented programming (AOP) listeners to downstream interfaces on the insurance rights platform, downstream interface exceptions are automatically handled, solving the problem of low efficiency in manual processing in existing technologies and achieving efficient exception handling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD
- Filing Date
- 2024-11-18
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, when the downstream interface of the distributed system between the insurance rights platform and the client is abnormal, manual intervention is required, resulting in low efficiency and high communication costs.
By adding custom annotations to downstream interfaces on the insurance rights platform, using aspect-oriented programming (AOP) to listen for exceptions, and automatically determining the handling scheme based on the exception type, the system can automatically process downstream interfaces.
It can automatically handle downstream interface anomalies without human intervention, improving anomaly handling efficiency and reducing manpower and communication costs.
Smart Images

Figure CN122064428A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to an exception handling method, apparatus, device, medium and product. Background Technology
[0002] Currently, in the application of insurance rights platforms, it is usually necessary to form a distributed system between the insurance rights platform and the client. The client's communication interface serves as the upstream interface, while the communication interfaces of various functions on the insurance rights platform serve as the downstream interfaces.
[0003] In existing technologies, when connecting to a downstream interface through an upstream interface, if the downstream interface experiences program errors or network problems, the downstream interface will report the abnormality to the upstream interface. After the downstream interface's program is repaired or the network is restored, the upstream interface will be manually requested to re-initiate the request. This can easily lead to low efficiency in handling abnormal interfaces.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this application is to provide an exception handling method, apparatus, device, medium, and product, which aims to improve the efficiency of exception interface handling.
[0006] To achieve the above objectives, this application provides an exception handling method, the method comprising:
[0007] In response to the detection of an anomaly at at least one downstream interface, the anomaly type corresponding to the at least one downstream interface is determined;
[0008] Based on the exception type, an exception handling scheme corresponding to the at least one downstream interface is determined, and exception handling is performed on the at least one downstream interface according to the exception handling scheme.
[0009] In one embodiment, the step of determining the exception type corresponding to the at least one downstream interface in response to identifying an exception at the at least one downstream interface further includes:
[0010] Get the setting command;
[0011] Custom annotations are applied to each downstream interface on the target platform according to the set instructions to obtain the annotated downstream interfaces.
[0012] Anomaly monitoring is performed on the annotated downstream interfaces to identify any abnormal downstream interfaces among them.
[0013] In one embodiment, the step of adding custom annotations to each downstream interface on the target platform according to the set instructions to obtain the annotated downstream interfaces includes:
[0014] Select or determine the custom annotation according to the set instructions;
[0015] The custom annotation is associated with the implementation class of each downstream interface on the target platform to determine the interface method of each downstream interface;
[0016] By writing a custom annotation processor, the business logic before and after the execution of the interface method is determined, and the downstream interface marked with the annotation is obtained.
[0017] In one embodiment, the step of abnormally monitoring the annotated downstream interface includes:
[0018] Define the first aspect class and the first pointcut to obtain the first aspect-oriented programming;
[0019] The downstream interface marked with annotations is monitored for exceptions through the first aspect-oriented programming.
[0020] The first aspect class is used to determine the method execution point for exception monitoring, and the first pointcut is used to determine the downstream interface being monitored.
[0021] In one embodiment, the step of determining the exception handling scheme corresponding to the at least one downstream interface based on the exception type includes:
[0022] Store the interface information and exception type corresponding to the at least one downstream interface in a preset interface exception table;
[0023] The pre-built exception handling strategy library is invoked based on the exception types stored in the interface exception table;
[0024] Select the exception handling scheme corresponding to the exception type from the exception handling strategy library.
[0025] In one embodiment, after the step of performing exception handling on the at least one downstream interface according to the exception handling scheme, the method further includes:
[0026] Define the second aspect class and the second pointcut to obtain the second aspect-oriented programming;
[0027] The second aspect-oriented programming is used to monitor the downstream interfaces in the interface exception table to determine whether the exception of at least one downstream interface has been eliminated.
[0028] If it is determined that the exception of at least one downstream interface has not been resolved, the exception handling failure message is stored in the interface exception table.
[0029] If it is determined that the anomaly of the at least one downstream interface has been eliminated, then the anomaly record of the at least one downstream interface is deleted from the interface anomaly table, and / or the at least one downstream interface is provided to the upstream interface corresponding to the at least one downstream interface.
[0030] Furthermore, to achieve the above objectives, this application also proposes an anomaly handling device, which includes:
[0031] A response module is used to determine the type of exception corresponding to at least one downstream interface in response to the detection of an exception at least one downstream interface.
[0032] The processing module is used to determine the exception handling scheme corresponding to the at least one downstream interface based on the exception type, and to perform exception handling on the at least one downstream interface according to the exception handling scheme.
[0033] In addition, to achieve the above objectives, this application also proposes an exception handling device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the exception handling method as described above.
[0034] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the exception handling method described above.
[0035] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the exception handling method described above.
[0036] One or more technical solutions proposed in this application have at least the following technical effects:
[0037] In response to the detection of an anomaly in at least one downstream interface, the anomaly type corresponding to the at least one downstream interface is determined; based on the anomaly type, an anomaly handling scheme corresponding to the at least one downstream interface is determined, and the at least one downstream interface is handled according to the anomaly handling scheme. When an anomaly occurs in at least one downstream interface, by determining the anomaly type, the corresponding anomaly handling scheme is determined, and the anomaly handling scheme is performed, the anomaly handling of the downstream interface is realized automatically without the need for manual communication and handling, thereby improving the processing efficiency of the anomaly interface. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart illustrating an embodiment of the exception handling method of this application.
[0041] Figure 2 This is a schematic diagram of the display interface of the client according to the first embodiment of this application;
[0042] Figure 3 This is a flowchart illustrating Embodiment 2 of the exception handling method of this application;
[0043] Figure 4 This is a schematic diagram of the overall process according to the second embodiment of this application;
[0044] Figure 5 This is a flowchart illustrating Embodiment 3 of the exception handling method of this application;
[0045] Figure 6 This is a schematic diagram of the module structure of the exception handling device according to an embodiment of this application;
[0046] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the exception handling method in the embodiments of this application.
[0047] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0048] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0049] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0050] The main solution of this application embodiment is: in response to the identification of an anomaly in at least one downstream interface, the anomaly type corresponding to the at least one downstream interface is determined; based on the anomaly type, an anomaly handling scheme corresponding to the at least one downstream interface is determined, and the at least one downstream interface is anomaly handled according to the anomaly handling scheme. When an anomaly occurs in at least one downstream interface, by determining the anomaly type, the corresponding anomaly handling scheme is determined, and the anomaly handling is performed according to the anomaly handling scheme, the automatic handling of the abnormal downstream interface is realized without the need for manual communication and handling, thereby improving the processing efficiency of the abnormal interface.
[0051] In this embodiment, for ease of description, the exception handling device will be used as the execution subject in the following description.
[0052] Technical terms used in this application:
[0053] Aspect-Oriented Programming (AOP)
[0054] Aspect;
[0055] Joinpoint;
[0056] Pointcut;
[0057] Introduction.
[0058] Currently, in the application of insurance rights platforms, it is usually necessary to form a distributed system between the insurance rights platform and the client. The client's communication interface serves as the upstream interface, while the communication interfaces of various functions on the insurance rights platform serve as the downstream interfaces.
[0059] In existing technologies, when connecting to a downstream interface through an upstream interface, if the downstream interface experiences program errors or network problems, the downstream interface will report the abnormality to the upstream interface. Once the downstream interface's program is repaired or the network is restored, the upstream interface will be manually requested to re-initiate the request.
[0060] The existing technical solutions have the following drawbacks:
[0061] 1. Every time a downstream interface malfunctions, manual intervention is required to communicate with the downstream interface to confirm the cause of the problem and wait for it to be fixed before re-initiating the request. This method wastes a lot of manpower and communication costs.
[0062] 2. When downstream interface anomalies occur frequently, developers need to spend a lot of time searching logs to obtain parameter information when the anomaly occurs, in order to analyze the problem and retry.
[0063] This application provides a method for handling exceptions at downstream interfaces. This method annotates and marks all downstream interfaces on an insurance rights platform that connect to upstream interfaces, enabling exception capture at these downstream interfaces. The insurance rights platform uses AOP to monitor all annotated downstream interfaces, recording the anomalies and their corresponding exception types. Based on the exception handling scheme corresponding to each exception type, the platform processes the anomaly at the downstream interface. Therefore, when a downstream interface malfunctions, the insurance rights platform can automatically handle it without manual intervention, improving the efficiency of exception handling.
[0064] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or exception handling device capable of performing the above functions. The following description uses an exception handling device as an example to illustrate this embodiment and the subsequent embodiments.
[0065] Based on this, the embodiments of this application provide an exception handling method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the exception handling method of this application.
[0066] In this embodiment, the exception handling method includes steps S10 to S30:
[0067] Step S10: In response to the detection of an anomaly at least one downstream interface, determine the anomaly type corresponding to the at least one downstream interface;
[0068] Specifically, the exception handling method in this application is applicable to various application platforms (i.e., target platforms), such as insurance rights platforms and warehousing platforms. This embodiment uses an insurance rights platform as an example. In the application of the insurance rights platform, the platform and the client constitute a distributed system, with the client's communication interface serving as the upstream interface and the communication interfaces of various functions on the insurance rights platform serving as the downstream interface.
[0069] For example, in this embodiment of the application, all downstream interfaces that connect to the upstream interface on the insurance rights platform can be annotated and marked, and anomalies of the downstream interfaces can be captured through the annotation marking.
[0070] For example, in the insurance rights platform, AOP is set to listen to all downstream interfaces marked with annotations, record the downstream interfaces with exceptions and the corresponding exception types, store the interface information and exception types of the downstream interfaces with exceptions in the interface exception table, and then process the corresponding abnormal downstream interfaces according to the exception handling scheme corresponding to the exception type.
[0071] Step S20: Determine the exception handling scheme corresponding to the at least one downstream interface based on the exception type, and perform exception handling on the at least one downstream interface according to the exception handling scheme;
[0072] Furthermore, once an anomaly is identified at least one downstream interface and the anomaly type corresponding to the at least one downstream interface is determined, an anomaly handling scheme corresponding to the at least one downstream interface can be determined based on the anomaly type, and the at least one downstream interface can be anomaly handled according to the anomaly handling scheme.
[0073] For example, in this embodiment of the application, a first AOP is used to monitor all annotated downstream interfaces. When an anomaly is determined in a downstream interface, the ID information and anomaly type of the downstream interface are saved to the interface anomaly table in the database. This includes defining a first aspect class and a first pointcut to obtain the first AOP. The first AOP is used to monitor whether there are any anomalies in the downstream interfaces annotated with the interface annotation.
[0074] For example, after determining that a downstream interface is abnormal, relevant information about the downstream interface is obtained and saved to an interface abnormality table. The interface abnormality table in this embodiment can be shown in Table 1 below:
[0075] Table 1. Examples of Interface Exceptions
[0076] Interface Name Exception types Abnormal time Interface address Business type 001 Data loss 2024 / 8 / 8 / 15:52 … … 005 Network fluctuations 2024 / 8 / 8 / 16:00 … … 009 Communication error 2024 / 8 / 8 / 16:35 … …
[0077] For example, the step of determining the exception handling scheme corresponding to the exception type based on the interface exception table includes:
[0078] The pre-built exception handling strategy library is invoked based on the exception types stored in the interface exception table;
[0079] Select the exception handling scheme corresponding to the exception type from the exception handling strategy library.
[0080] For example, in this application embodiment, an exception handling strategy library is pre-built, which includes standard handling procedures and alternative solutions for various exception types. When the solutions cannot handle the exception, when there is a new exception handling solution for a certain exception type, or when a new exception type occurs, the exception handling strategy library can be dynamically updated by receiving a setting instruction sent by the client.
[0081] For example, based on the exception type of each downstream interface in the interface exception table, an exception handling scheme is determined for that downstream interface, and then executed. Since some exceptions cannot be recovered through retry operations, different exception handling schemes need to be adopted for downstream interfaces with different exception types, thereby improving the efficiency and success rate of exception handling.
[0082] For example, after the step of performing exception handling on the at least one downstream interface according to the exception handling scheme, the method further includes:
[0083] Define the second aspect class and the second pointcut to obtain the second aspect-oriented programming;
[0084] The second aspect-oriented programming is used to monitor the downstream interfaces in the interface exception table to determine whether the exception of at least one downstream interface has been eliminated.
[0085] If it is determined that the exception of at least one downstream interface has not been resolved, the exception handling failure message is stored in the interface exception table.
[0086] If it is determined that the anomaly of the at least one downstream interface has been eliminated, then the anomaly record of the at least one downstream interface is deleted from the interface anomaly table, and / or the at least one downstream interface is provided to the upstream interface corresponding to the at least one downstream interface.
[0087] For example, in this embodiment of the application, by defining a second aspect class, it is possible to specify which join points (i.e., method execution points) are used to capture whether the exceptions of downstream interfaces in the interface exception table are excluded. By defining a second pointcut, it is possible to specify which downstream interfaces need to be listened to (in this embodiment of the application, all downstream interfaces in the interface exception table).
[0088] For example, by using the downstream interface in the second AOP listening interface exception table, after determining that the exception of the downstream interface has been eliminated, the downstream interface that has eliminated the exception is provided to the client to remind the user to perform relevant operations.
[0089] For example, in this embodiment of the application, by using the second aspect-oriented programming to listen to the downstream interface in the exception table, and after determining that the exception of the downstream interface has been eliminated, the downstream interface that has eliminated the exception is sent to the client. There is no need for the user to communicate with the downstream interface to confirm the cause of the problem. The user only needs to perform the relevant operations after receiving the notification of the exception elimination, thereby reducing the waste of manpower and communication costs in handling the exception downstream interface.
[0090] Reference Figure 2 , Figure 2 This is a schematic diagram of the display interface of the client according to the first embodiment of this application, as shown below. Figure 2As shown, after determining the interface exception table, it can be sent to the client of the upstream interface so that the upstream interface client can display the interface exception table and provide users with the function of performing related operations on the downstream interfaces with exceptions. It receives and executes retry operations sent by the client of the upstream interface. If the retry operation fails, the failed asynchronous message is stored in the interface exception table. If the retry operation succeeds, the exception record of the downstream interface that succeeded in the retry operation is deleted from the interface exception table.
[0091] For example, the retry operation sent by the client can be sent manually by the user or sent by the client at set intervals.
[0092] For example, by having the client send retry operations to the abnormal downstream interface at set intervals, users can avoid continuously monitoring the interface, and the relevant requests can be executed in a timely manner after the abnormality of the downstream interface is resolved.
[0093] For example, after an exception in a downstream interface is resolved by executing an exception handling scheme, the record for that downstream interface is deleted from the interface exception table.
[0094] For example, the correspondence between some exception types and exception handling schemes is shown in Table 2 below:
[0095] Table 2. Examples of Exception Types and Corresponding Exception Handling Solutions
[0096]
[0097]
[0098] For example, business exceptions include BusinessException (defined in the project), runtime exceptions include RuntimeException, and network exceptions include ConnectException, SocketTimeoutException, SocketException, and EOFException.
[0099] This embodiment, through the above-described scheme, specifically, in response to the identification of an anomaly in at least one downstream interface, determines the anomaly type corresponding to the at least one downstream interface; based on the anomaly type, determines the anomaly handling scheme corresponding to the at least one downstream interface, and performs anomaly handling on the at least one downstream interface according to the anomaly handling scheme. When an anomaly occurs in at least one downstream interface, by determining the anomaly type, then determining the corresponding anomaly handling scheme, and performing anomaly handling according to the anomaly handling scheme, the automatic handling of the abnormal downstream interface is achieved without the need for manual communication and processing, thereby improving the processing efficiency of abnormal interfaces.
[0100] Based on the first embodiment of this application, a second embodiment of this application is proposed. In this second embodiment, content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter. Based on this, please refer to... Figure 3 Before step S10, the exception handling method further includes steps S01 to S03:
[0101] Step S01: Obtain the setting command;
[0102] Reference Figure 4 , Figure 4 This is a schematic diagram of the overall process according to the second embodiment of this application, as shown below. Figure 4 As shown in the embodiment of this application, the custom annotation mark for each downstream interface is achieved by adding @YourCustomAnnotation before the declaration of the interface method of the downstream interface, where YourCustomAnnotation is the name of the custom annotation mark.
[0103] For example, by adding custom annotations to downstream interfaces on the insurance benefits platform, it is easier to manage and maintain all downstream interfaces that connect to upstream interfaces in a unified manner. This facilitates the addition of additional processing logic to each downstream interface, such as logging, performance monitoring, and exception handling.
[0104] Step S02: According to the set instructions, perform custom annotation marking on each downstream interface on the target platform to obtain the annotated downstream interface;
[0105] For example, when marking downstream interfaces with custom annotations, the timing of defining the pointcut expression can ensure that the marked downstream interfaces can be caught for exceptions.
[0106] For example, to handle exceptions on a downstream interface, exception handling logic needs to be added to the interface methods of the downstream interface. This logic can be implemented using a try-catch block. Within the try block, the normal logic code for the interface is written; within the catch block, the exception handling logic is added to catch any possible exceptions. If the exception is caught, a "success" message can be returned to the upstream interface to notify it of the exception handling status.
[0107] Step S03: Monitor the downstream interfaces that are annotated to identify any abnormal downstream interfaces among the annotated downstream interfaces.
[0108] For example, the step of monitoring for anomalies in the annotated downstream interface includes:
[0109] Define the first aspect class and the first pointcut to obtain the first aspect-oriented programming;
[0110] The downstream interface marked with annotations is monitored for exceptions through the first aspect-oriented programming.
[0111] The first aspect class is used to determine the method execution point for exception monitoring, and the first pointcut is used to determine the downstream interface being monitored.
[0112] For example, by defining a first aspect class, it is possible to specify which join points (i.e., method execution points) are used to catch the existence of exceptions in downstream interfaces. By defining a first pointcut, it is possible to specify which downstream interfaces need to be listened to (in this embodiment, the downstream interfaces marked with annotations in the insurance rights platform).
[0113] For example, the ID information and exception type of the downstream interface with an exception can be obtained through reflection to determine whether there is an exception in the downstream interface marked with the annotation of the first AOP listening interface.
[0114] This embodiment, through the above-described scheme, specifically involves obtaining a setting instruction; marking each downstream interface on the target platform with custom annotations according to the setting instruction to obtain the annotated downstream interfaces; and performing anomaly monitoring on the annotated downstream interfaces to identify those with anomalies. This is achieved by annotating all downstream interfaces on the target platform that connect to upstream interfaces, and capturing anomalies through these annotations. By configuring AOP to monitor all annotated downstream interfaces on the target platform and recording all anomalies, an interface anomaly table is obtained. This allows staff to monitor anomaly-prone downstream interfaces based on the interface anomaly table, achieving automated handling of anomaly-prone downstream interfaces without manual communication or intervention, thereby improving the efficiency of handling anomaly interfaces.
[0115] Based on any of the foregoing embodiments of this application, a third embodiment of this application is proposed. In this third embodiment, any content that is the same as or similar to any of the foregoing embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 5 Step S02 further includes steps S021 to S023:
[0116] Step S021: Select or determine the custom annotation according to the setting instruction;
[0117] For example, in this embodiment of the application, it is first necessary to customize the meta-annotations and attribute list of the downstream interface. For example, the defined meta-annotations include:
[0118] @Target: Specifies the Java element type to which the custom annotation can be applied, such as a method (ElementType.METHOD).
[0119] @Retention: Specifies the execution strategy for custom annotations. The execution strategy is usually set to RUNTIME so that information about custom annotations can be read at runtime via reflection.
[0120] For example, the attributes of the defined custom annotations are related to the business that the downstream interface is responsible for. For instance, for downstream interfaces of service business types, the defined attributes include service code (serviceCode), permission level (permissionLevel), etc.
[0121] Step S022: Associate the custom annotation with the implementation class of each downstream interface on the target platform to determine the interface method of each downstream interface;
[0122] For example, custom annotations can be used in the interface methods of a downstream interface by associating them with the implementation class of the downstream interface.
[0123] For example, the code that associates a custom annotation with the implementation class of a downstream interface is shown below:
[0124] @Service
[0125] public class DownstreamServiceImpl implements DownstreamService{
[0126] @ApiAccess(serviceCode="INSURANCE_QUERY",permissionLevel=2)
[0127] public Response queryInsuranceInfo(Request request){
[0128] / / Interface implementation logic
[0129] return new Response( / *...* / );
[0130] }
[0131] Step S023: Determine the business logic before and after the execution of the interface method by writing a custom annotation processor, and obtain the downstream interface marked with annotation.
[0132] For example, a custom annotation processor is an aspect class (AOP) or an interceptor that can execute specific business logic before and after the interface method is executed, such as exception handling, permission verification, logging, etc.
[0133] For example, taking aspect classes as a custom annotation processor, the steps to write a custom annotation processor are as follows:
[0134] Step 1: Define an aspect class and mark it with the custom annotation defined above.
[0135] Step 2: Define the pointcut expression, specifying the content that needs to be captured.
[0136] Specifically, the pointcut expression can be defined using @Pointcut.
[0137] The information that needs to be captured includes: abnormal information such as program errors, communication performance, and network fluctuations.
[0138] Step 3: Define when the pointcut expression is executed in the interface method.
[0139] For example, the timing of the pointcut expression execution in the interface method can be defined using methods such as @Before, @After, and @Around.
[0140] For example, pointcut expressions can be executed in interface methods at times including before, after, or around the interface method.
[0141] For example, taking an interceptor as a custom annotation processor as an example, the steps to write a custom annotation processor are as follows:
[0142] Step 1: Write the interceptor class for the downstream interface.
[0143] Step 2: Adjust the exception handling logic in the preHandle method of the interceptor class.
[0144] Step 3: Register the above-mentioned interceptor in the configuration of the insurance rights platform and specify the path or mode to be intercepted.
[0145] For example, the interception path represents the downstream interface to be intercepted, and the interception mode represents interception before, after, or around the interface method of the downstream interface.
[0146] This embodiment, through the above scheme, specifically selects or determines custom annotations according to the set instructions; associates the custom annotations with the implementation classes of each downstream interface on the target platform to determine the interface methods of each downstream interface; determines the business logic before and after the execution of the interface methods by writing a custom annotation processor, and obtains the annotated downstream interfaces. This achieves annotation marking of all downstream interfaces that connect to upstream interfaces on the target platform, and then uses annotation marking to capture exceptions in downstream interfaces, realizing automatic processing of abnormal downstream interfaces without manual communication and processing, thereby improving the processing efficiency of abnormal interfaces.
[0147] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the exception handling method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0148] This application also provides an anomaly handling device, please refer to... Figure 6 The anomaly handling device includes:
[0149] A response module is used to determine the type of exception corresponding to at least one downstream interface in response to the detection of an exception at least one downstream interface.
[0150] The processing module is used to determine the exception handling scheme corresponding to the at least one downstream interface based on the exception type, and to perform exception handling on the at least one downstream interface according to the exception handling scheme.
[0151] The exception handling apparatus provided in this application, employing the exception handling method in the above embodiments, can solve the technical problem of exception handling. Compared with the prior art, the beneficial effects of the exception handling apparatus provided in this application are the same as those of the exception handling method provided in the above embodiments, and other technical features in the exception handling apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0152] This application provides an exception handling device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the exception handling method in Embodiment 1 above.
[0153] The following is for reference. Figure 7The diagram illustrates a structural schematic suitable for implementing an exception handling device according to embodiments of this application. The exception handling device in embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The exception handling device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0154] like Figure 7 As shown, the exception handling device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the exception handling device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the exception handling device to communicate wirelessly or wiredly with other devices to exchange data. While the figures show exception handling devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0155] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0156] The anomaly handling device provided in this application, employing the anomaly handling method in the above embodiments, can solve the technical problem of anomaly handling. Compared with the prior art, the beneficial effects of the anomaly handling device provided in this application are the same as those of the anomaly handling method provided in the above embodiments, and other technical features of the anomaly handling device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0157] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0158] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0159] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the exception handling method in the above embodiments.
[0160] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0161] The aforementioned computer-readable storage medium may be included in the exception handling device; or it may exist independently and not assembled into the exception handling device.
[0162] The aforementioned computer-readable storage medium carries one or more programs. When the one or more programs are executed by the exception handling device, the exception handling device: in response to recognizing an exception in at least one downstream interface, determines the exception type corresponding to the at least one downstream interface; determines an exception handling scheme corresponding to the at least one downstream interface based on the exception type, and performs exception handling on the at least one downstream interface according to the exception handling scheme. When an exception occurs in at least one downstream interface, by determining the exception type, the corresponding exception handling scheme is determined, and exception handling is performed according to the exception handling scheme, thereby realizing automatic handling of the abnormal downstream interface without the need for manual communication and handling, thus improving the processing efficiency of the abnormal interface.
[0163] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0164] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0165] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0166] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described exception handling method, thereby solving the technical problem of exception handling. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the exception handling method provided in the above embodiments, and will not be repeated here.
[0167] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the exception handling method described above.
[0168] The computer program product provided in this application can solve the technical problem of exception handling. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the exception handling method provided in the above embodiments, and will not be repeated here.
[0169] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. An exception handling method, characterized in that, The method includes: In response to the detection of an anomaly at at least one downstream interface, the anomaly type corresponding to the at least one downstream interface is determined; Based on the exception type, an exception handling scheme corresponding to the at least one downstream interface is determined, and exception handling is performed on the at least one downstream interface according to the exception handling scheme.
2. The method as described in claim 1, characterized in that, Before the step of determining the exception type corresponding to the at least one downstream interface in response to identifying an exception at least one downstream interface, the method further includes: Get the setting command; Custom annotations are applied to each downstream interface on the target platform according to the set instructions to obtain the annotated downstream interfaces. Anomaly monitoring is performed on the annotated downstream interfaces to identify any abnormal downstream interfaces among them.
3. The method as described in claim 2, characterized in that, The step of adding custom annotations to each downstream interface on the target platform according to the set instructions to obtain the annotated downstream interfaces includes: Select or determine the custom annotation according to the set instructions; The custom annotation is associated with the implementation class of each downstream interface on the target platform to determine the interface method of each downstream interface; By writing a custom annotation processor, the business logic before and after the execution of the interface method is determined, and the downstream interface marked with the annotation is obtained.
4. The method as described in claim 2, characterized in that, The step of monitoring for anomalies in the annotated downstream interface includes: Define the first aspect class and the first pointcut to obtain the first aspect-oriented programming; The downstream interface marked with annotations is monitored for exceptions through the first aspect-oriented programming. The first aspect class is used to determine the method execution point for exception monitoring, and the first pointcut is used to determine the downstream interface being monitored.
5. The method as described in claim 1, characterized in that, The step of determining the exception handling scheme corresponding to the at least one downstream interface based on the exception type includes: Store the interface information and exception type corresponding to the at least one downstream interface in a preset interface exception table; The pre-built exception handling strategy library is invoked based on the exception types stored in the interface exception table; Select the exception handling scheme corresponding to the exception type from the exception handling strategy library.
6. The method as described in claim 5, characterized in that, After the step of performing exception handling on the at least one downstream interface according to the exception handling scheme, the method further includes: Define the second aspect class and the second pointcut to obtain the second aspect-oriented programming; The second aspect-oriented programming is used to monitor the downstream interfaces in the interface exception table to determine whether the exception of at least one downstream interface has been eliminated. If it is determined that the exception of at least one downstream interface has not been resolved, the exception handling failure message is stored in the interface exception table. If it is determined that the anomaly of the at least one downstream interface has been eliminated, then the anomaly record of the at least one downstream interface is deleted from the interface anomaly table, and / or the at least one downstream interface is provided to the upstream interface corresponding to the at least one downstream interface.
7. An anomaly handling device, characterized in that, The device includes: A response module is used to determine the type of exception corresponding to at least one downstream interface in response to the detection of an exception at least one downstream interface. The processing module is used to determine the exception handling scheme corresponding to the at least one downstream interface based on the exception type, and to perform exception handling on the at least one downstream interface according to the exception handling scheme.
8. An anomaly handling device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the exception handling method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the exception handling method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the exception handling method as described in any one of claims 1 to 6.