Application running method, device and equipment
By integrating multiple script execution engines in the application and dynamically determining the target engine, the application operation stability problem caused by a single script execution engine is solved, and higher script processing stability and flexibility are achieved.
Patent Information
- Application Number
- CN202411734956.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, applications are usually only configured with a single script execution engine, resulting in the operational stability of the application being affected in the case of poor script processing stability.
It provides an application operation method, by integrating the first script execution engine and the second script execution engine in the application, dynamically determine the target script execution engine, and detect exceptions during processing, and execute corresponding exception repair strategies.
Improves the determination flexibility and script processing stability of the target script execution engine, thereby improving the operation stability of the application.
Smart Images

Figure CN119718738A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic device applications, and in particular to an application operation method, device and equipment. Background Art
[0002] At present, with the development of application development frameworks, application development frameworks can provide multiple script execution engines, so that applications developed through the application development framework can use corresponding script execution engines to process application scripts. However, in the related art, applications are generally only configured with a single script execution engine. If the script processing stability of the script execution engine configured in the application is poor, it is easy to have an adverse impact on the running stability of the application. Summary of the invention
[0003] The main purpose of the present application is to provide an application running method, device and equipment, aiming to improve the flexibility of determining the target script execution engine of the application, and improve the script processing stability of the target script execution engine, thereby improving the running stability of the application.
[0004] In a first aspect, the present application provides a method for running an application, wherein the application integrates a first script execution engine and a second script execution engine, and the method comprises the following steps:
[0005] When the application is in a running state, determining a target script execution engine of the application from the first script execution engine and the second script execution engine;
[0006] Processing the application script of the application according to the target script execution engine;
[0007] When it is detected that an exception occurs in the processing of the application script by the target script execution engine, an exception repair strategy corresponding to the target script execution engine is executed.
[0008] In a second aspect, the present application further provides an application running device, wherein the application integrates a first script execution engine and a second script execution engine, and the running device includes:
[0009] an engine determination module, configured to determine a target script execution engine for the application from the first script execution engine and the second script execution engine when the application is in a running state;
[0010] A script processing module, used for processing the application script of the application according to the target script execution engine;
[0011] The exception repair module is used to execute the exception repair strategy corresponding to the target script execution engine when it is detected that the target script execution engine has an exception in the processing process of the application script.
[0012] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;
[0013] The memory is used to store computer programs;
[0014] The processor is used to execute the computer program and implement the above-mentioned application running method when executing the computer program.
[0015] The present application provides an application operation method, apparatus and device, wherein a first script execution engine and a second script execution engine are integrated in the application, and the operation method comprises: when the application is in operation, determining a target script execution engine of the application from the first script execution engine and the second script execution engine; processing an application script of the application according to the target script execution engine; when it is detected that an exception occurs in the processing process of the application script by the target script execution engine, executing an exception repair strategy corresponding to the target script execution engine, so as to improve the flexibility of determining the target script execution engine of the application, and improve the script processing stability of the target script execution engine, thereby improving the operation stability of the application.
[0016] For example, during the operation of the application, the computer device can determine the target script execution engine of the application from the first script execution engine and the second script execution engine integrated in the application according to the running state of the application, which is conducive to improving the flexibility of determining the target script execution engine. In the case of determining the target script execution engine of the application, the computer device can process the application script of the application according to the target script execution engine, and when an exception occurs in the processing process of the application script, execute the exception repair strategy corresponding to the target script execution engine for subsequent recovery and processing of the application script of the application, which is conducive to improving the script processing stability of the target script execution engine, thereby helping to improve the running stability of the application. The running method of the application can be applied to applications in different scenarios to run applications in different scenarios, thereby improving the running stability of applications in different scenarios. Applications in different scenarios include, for example, financial applications, social applications, shopping applications, etc., which are not limited here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 It is a flowchart of an application operation method provided in an embodiment of the present application;
[0019] Figure 2 It is an integrated schematic diagram of a script execution engine of an application involved in the related technology;
[0020] Figure 3 It is an integrated schematic diagram of a script execution engine of an application involved in an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of a process for determining a target script execution engine involved in an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the switching process of the target script execution engine involved in an embodiment of the present application;
[0023] Figure 6 is a schematic block diagram of an application running device provided in an embodiment of the present application;
[0024] Figure 7 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0027] The embodiments of the present application provide a method, device and equipment for running an application. The method for running the application can be applied to a computer device, which can be a mobile phone, a tablet computer, a laptop computer, a desktop computer and the like. The method can also be applied to a server, which can be a separate server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0028] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0029] See also Figure 1 , Figure 1 It is a flowchart of a method for running an application provided in an embodiment of the present application. It should be noted that the method for running an application provided in an embodiment of the present application can be used in a computer device, and of course can also be used in a server.
[0030] In specific implementation, computer devices include but are not limited to: any one of mobile phones, tablet computers, laptop computers, and desktop computers; the server can be a single server or a server cluster, or a cloud server that provides cloud computing services.
[0031] like Figure 1 As shown, the running method of the application includes steps S101 to S103.
[0032] Exemplarily, a first script execution engine and a second script execution engine are integrated into the application.
[0033] In some embodiments, the application may include applications in different scenarios, such as financial applications, social applications, shopping applications, etc., which are not limited here. The first script execution engine and the second script execution engine may be collectively referred to as a script execution engine. The script execution engine may include a programming engine for executing application scripts. The script execution engine may have functions such as script parsing and execution, performance optimization, memory management, security assurance, interaction with the environment, language feature support, and error handling and debugging, which are not limited here.
[0034] For example, the development time of the first script execution engine and the second script execution engine are different. The first script execution engine can be used to indicate a script execution engine with a shorter development time. The second script execution engine can be used to indicate a script execution engine with a longer development time. Since the development time of the first script execution engine is shorter than that of the second script execution engine, the script processing stability of the first script execution engine still needs to be verified over time, while the script processing stability of the second script execution engine has been verified for a longer time, the script processing stability of the second script execution engine is generally better than the script processing stability of the first script execution engine. However, since the development time of the first script execution engine is shorter than that of the second script execution engine, the first script execution engine can be developed with advanced script execution technology, and the script processing efficiency of the first script execution engine is generally better than that of the second script execution engine.
[0035] Take the example that the script execution engine of the application includes a Javascript (JS) execution engine. The first script execution engine may include a Hermes engine, and the second script execution engine may include a JavascriptCore engine. Compared with the Javascript engine, the Hermes engine can convert the JS script into a binary intermediate code in advance, such as Huffman Binary Code (HBC), which can speed up the loading speed and execution speed of the JS script, and optimize the occupancy of computing resources. However, the script processing stability of the Hermes engine still lacks the test of time. The script processing stability of the JavascriptCore engine has withstood the test of time. The computer device can determine that the script processing stability of the JavascriptCore engine is better than that of the Hermes engine, and the script processing efficiency of the Hermes engine is better than that of the JavascriptCore engine. Of course, the first script execution engine and the second script execution engine are not limited to this, and are not limited here.
[0036] In the related art, an application generally integrates only a single script execution engine.
[0037] For example, the script execution engine of the application includes a JS execution engine, and the JS execution engine may include a JavascriptCore engine and a Hermes engine. For example, the application integrates any one of the JavascriptCore engine and the Hermes engine. Figure 2 As shown, when the computer device only sets the dependency relationship between the application development framework and the Hermes engine in the dependency configuration information corresponding to the application development framework where the application is located, if an exception occurs in the subsequent application when processing the application script through the Hermes engine, the script execution engine of the application cannot be switched to the JavascriptCore engine, resulting in poor application operation stability. Accordingly, when the computer device only sets the dependency relationship between the application development framework and the JavascriptCore engine in the dependency configuration information corresponding to the application development framework where the application is located, the subsequent application cannot switch the script execution engine from the JavascriptCore engine to the Hermes engine, resulting in poor processing efficiency of the application script, thereby resulting in poor application operation stability.
[0038] Based on this, during the process of developing an application, the computer device can integrate the first script execution engine and the second script execution engine into the application to combine the advantages of the first script execution engine and the second script execution engine, and improve the running stability of the application by improving the script processing stability of the script execution engine and improving the script processing efficiency of the script execution engine.
[0039] In some implementations, a first dependency relationship between the application development framework and the first script execution engine, and a second dependency relationship between the application development framework and the second script execution engine are set in dependency configuration information corresponding to the application development framework in which the application is located.
[0040] The application development framework can be used to indicate an open source framework for an application. Relevant personnel can use the application development framework to build applications for computer devices to run applications. Application development frameworks may include ReactNative, Flutter, Android Jetpack, etc., without limitation. Applications developed through the application development framework may include applications for different scenarios, such as financial applications, social applications, shopping applications, etc., without limitation.
[0041] The application development framework in which the application is located may be provided with corresponding dependency configuration information. The computer device may set a first dependency relationship between the application development framework and the first script execution engine, and a second dependency relationship between the application development framework and the second script execution engine in the dependency configuration information corresponding to the application development framework, so as to integrate the first script execution engine and the second script execution engine in the application.
[0042] For example, the computer device can modify the dependency configuration information corresponding to the application development framework, and fully introduce the first engine script corresponding to the first script execution engine and the second engine script corresponding to the second script execution engine, so as to establish a first dependency relationship between the application development framework and the first script execution engine, and establish a second dependency relationship between the application development framework and the second script execution engine. Accordingly, in the case where the application is developed through the application development framework, the application and the first script execution engine and the second script execution engine can also establish corresponding dependency relationships, so as to integrate the first script execution engine and the second script execution engine into the application.
[0043] For example, the application development framework in which the application is located is ReactNative, the first script execution engine is the Hermes engine, and the second script execution engine is the JavascriptCore engine. The computer device can set the first dependency relationship between ReactNative and the Hermes engine, and the second dependency relationship between ReactNative and the JavascriptCore engine in the dependency configuration information corresponding to ReactNative. Figure 3 As shown, when the first dependency relationship and the second dependency relationship are set in the dependency configuration information corresponding to ReactNative, the script execution engine for processing the application script can be switched to any one of the Hermes engine and the JavascriptCore engine during the running of the application.
[0044] In an exemplary embodiment, the dependency configuration information corresponding to the application development framework in which the application is located may be pre-set with any one of a first dependency relationship between the application development framework and the first script execution engine and a second dependency relationship between the application development framework and the second script execution engine. In the process of integrating the first script execution engine and the second script execution engine, the computer device only needs to add the first dependency relationship or the second dependency relationship that has not been pre-set in the dependency configuration information.
[0045] Take the application development framework in which the application is located as ReactNative, the first script execution engine is the Hermes engine, and the second script execution engine is the JavascriptCore engine as an example. The dependency configuration information corresponding to ReactNative, for example, pre-sets the second dependency relationship between ReactNative and the JavascriptCore engine, then the computer device can add the first dependency relationship between ReactNative and the Hermes engine to the dependency configuration information corresponding to ReactNative. For example, in the case of adding the first dependency relationship between ReactNative and the Hermes engine, the script involved in the dependency configuration information corresponding to ReactNative may include "hermes_enabled=true". Of course, it is not limited to this, and no limitation is made here.
[0046] In this way, when the first script execution engine and the second script execution engine are integrated in the application, the first script execution engine and the second script execution engine can be used by the computer device to determine the target script execution engine for the application script of the application, and / or switch the target script execution engine for the application script of the application, which is conducive to improving the flexibility of determining the target script execution engine.
[0047] Step S101: when the application is in a running state, determining a target script execution engine of the application from a first script execution engine and a second script execution engine.
[0048] When the application is in the running state, the computer device needs to process the application script of the application. In the case where the first script execution engine and the second script execution engine are integrated in the application, in order to avoid conflicts between the processing processes of the application script of the same application by different script execution engines, the computer device needs to determine the target script execution engine of the application from the first script execution engine and the second script execution engine, so as to process the application script of the application according to the target script execution engine.
[0049] Exemplarily, the computer device may determine the target script execution engine of the application according to the proxy mode corresponding to the first script execution engine, so as to dynamically control the determination process of the target script execution engine through the proxy mode corresponding to the first script execution engine.
[0050] In some implementations, the proxy mode corresponding to the first script execution engine is called to obtain a return parameter of the proxy mode; and according to the return parameter, a target script execution engine of the application is determined from the first script execution engine and the second script execution engine.
[0051] The proxy mode can also be called a proxy method or a proxy strategy. The proxy mode can be used to indicate that a proxy or placeholder is provided for the first script execution engine to control access to the first script execution engine. The proxy mode can be called through a preset calling strategy corresponding to the proxy mode.
[0052] When the computer device calls the proxy mode corresponding to the first script execution engine, the proxy mode can output the corresponding return parameter. When the return parameters of the proxy mode are different, the computer device may have different strategies for determining the target script execution engine. For example, the computer device may determine whether the proxy mode allows the computer device to access or call the first script execution engine through the return parameters of the proxy mode corresponding to the first script execution engine. For example, when it is determined that the computer device is not allowed to access or call the first script execution engine according to the return parameters of the proxy mode, the computer device may determine the second script execution engine as the target script execution engine of the application. For another example, when it is determined that the computer device is allowed to access or call the first script execution engine according to the return parameters of the proxy mode, the computer device may determine the first script execution engine as the target script execution engine of the application.
[0053] Exemplarily, the return parameter of the proxy mode may include a first return value and a second return value. The first return value is different from the second return value.
[0054] For example, when the return parameter is the first return value, the target script execution engine of the application is determined to be the first script execution engine.
[0055] The first return value can be used to indicate that the proxy mode allows the computer device to access or call the first script execution engine. When the return parameter is the first return value, the computer device can determine that the target script execution engine of the application is the first script execution engine. Accordingly, the computer device can initialize the first script execution engine so that the application script of the application can be processed by the first script execution engine later.
[0056] For example, when the return parameter is the second return value, the target script execution engine of the application is determined to be the second script execution engine.
[0057] The second return value can be used to indicate that the proxy mode does not allow the computer device to access or call the first script execution engine. When the return parameter is the second return value, the computer device can determine that the target script execution engine of the application is the second script execution engine. Accordingly, the computer device can initialize the second script execution engine so that the application script of the application can be processed by the second script execution engine later.
[0058] like Figure 4 As shown, the process of determining the target script execution engine may include steps S201 to S205.
[0059] Step S201: calling the proxy mode corresponding to the first script execution engine to obtain the return parameter of the proxy mode.
[0060] Take the case where the first script execution engine is the Hermes engine, the second script execution engine is the JavascriptCore engine, and the proxy mode corresponding to the first script execution engine can be expressed as the useHermes proxy method. The computer device can call the useHermes proxy method to obtain the corresponding return parameters. Of course, it is not limited to this. The first script execution engine can also include script execution engines other than the Hermes engine, such as the JavascriptCore engine, and so on. The second script execution engine can also include engines other than the JavascriptCore engine, such as the Hermes engine, and so on. The proxy mode corresponding to the first script execution engine can also include proxy modes other than the useHermes proxy method, such as the proxy mode useJavascriptCore proxy method corresponding to the JavascriptCore engine, and so on, which are not limited here.
[0061] Step S202, determine whether the return parameter is the first return value; if so, jump to step S203; if not, jump to step S204.
[0062] Taking the proxy mode as the useHermes proxy method as an example, the first return value is used to indicate that the useHermes proxy method allows the computer device to access or call the Hermes engine, and the first return value can be expressed as yes, for example. When the return parameter is not the first return value, the return parameter can be the second return value, and the second return value is used to indicate that the useHermes proxy method does not allow the computer device to access or call the Hermes engine, and the second return value can be expressed as no, for example. Of course, the first return value and the second return value are not limited to this, and are not limited here.
[0063] Step S203: determine the first script execution engine as the target script execution engine, and initialize the first script execution engine.
[0064] Taking the first script execution engine as the Hermes engine as an example, when the return parameter is the first return value, the computer device may determine that the Hermes engine is the target script execution engine, and initialize the Hermes engine so that the application script of the application is subsequently processed through the Hermes engine.
[0065] Step S204: determine the second script execution engine as the target script execution engine, and initialize the second script execution engine.
[0066] For example, if the second script execution engine is a JavascriptCore engine, when the return parameter is not the first return value, the computer device may determine that the JavascriptCore engine is the target script execution engine, and initialize the JavascriptCore engine so that the application script of the application can be processed by the JavascriptCore engine later.
[0067] Step S205: Load the application script of the application, and process the application script through the target script execution engine.
[0068] When the target script execution engine is determined, the computer device can load the application script of the application and process the application script through the target script execution engine.
[0069] In this way, the computer device can obtain the return parameters of the proxy mode by calling the proxy mode corresponding to the first script execution engine, and determine the target script execution engine of the application from the first script execution engine and the second script execution engine based on the return parameters. The proxy mode can be used to dynamically control the determination of the target script execution engine, which is conducive to improving the flexibility of determining the target script execution engine.
[0070] Exemplarily, a proxy mode corresponding to the first script execution engine is set in the application development framework where the application is located. Before calling the proxy mode corresponding to the first script execution engine, the computer device needs to set the proxy mode corresponding to the first script execution engine in the application development framework where the application is located, so that the computer device has the calling authority to the proxy mode corresponding to the first script execution engine during the process of running the application. For example, the computer device can set the proxy mode corresponding to the first script execution engine in the application development framework where the application is located by modifying the protocol related to the method of interacting with the script execution environment.
[0071] Take the application development framework where the application is located as ReactNative, and the proxy mode corresponding to the first script execution engine is the useHermes proxy method as an example. The computer device can modify the CxxBridgeDelegate of ReactNative and add the useHermes proxy method to set the proxy mode corresponding to the first script execution engine in the application development framework where the application is located. CxxBridgeDelegate can be used to indicate the protocol of the method of interacting with the JS script execution environment. Of course, it is not limited to this and is not limited here.
[0072] In some implementations, the proxy mode is invoked according to a preset invocation strategy corresponding to the proxy mode in the application development framework.
[0073] In the case where a proxy mode corresponding to the first script execution engine is set in the application development framework where the application is located, the computer device can call the corresponding proxy mode according to the preset calling strategy corresponding to the proxy mode in the application development framework. For example, the computer device can implement the preset calling strategy corresponding to the proxy mode set in the application development framework by modifying the tool responsible for initializing the script execution environment and processing script message transmission.
[0074] Take the application development framework in which the application is located as ReactNative, and the proxy mode corresponding to the first script execution engine is the useHermes proxy method as an example. The computer device can set the preset call strategy corresponding to the useHermes proxy method by modifying the start method involved in the RCTCxxBridge implementation class of ReactNative. The RCTCxxBridge implementation class can be used to initialize the JS script execution environment and process the message transmission between the JS script and the native script. Of course, it is not limited to this and is not limited here.
[0075] If a preset calling strategy corresponding to the proxy mode is preset in the application development framework where the application is located, the computer device can call the proxy mode according to the preset calling strategy. For example, the computer device can call the useHermes proxy method added in CxxBridgeDelegate through the preset calling strategy corresponding to the useHermes proxy method set in the start method involved in the RCTCxxBridge implementation class in ReactNative.
[0076] In an exemplary implementation, taking the first script execution engine as the Hermes engine, the second script execution engine as the JavascriptCore engine, and the proxy mode as useHermes as an example, the scripts involved in calling the proxy mode include, for example:
[0077] if(useHermes){
[0078] executorFactory=
[0079] std::make_shared <hermesexecutoryfactory>(installBindings);
[0080] }else{
[0081] executorFactory=
[0082] std::make_shared <jscexecutoryfactory>(installBindings);
[0083] }
[0084] Based on this, when the proxy mode corresponding to the first execution engine is called, the target script execution engine of the application can be determined from the first script execution engine and the second script execution engine according to the return parameter of the proxy mode.
[0085] In this way, based on the setting of the proxy mode corresponding to the first script execution engine in the application development framework in which the application is located, and the setting of the preset calling strategy corresponding to the proxy mode, the computer device can call the proxy mode corresponding to the first script execution engine, and then determine the target script execution engine based on the return parameters of the proxy mode, which is conducive to improving the convenience of determining the return parameters of the proxy mode, and then improving the convenience of determining the target script execution engine.
[0086] Step S102: Process the application script of the application according to the target script execution engine.
[0087] When the target script execution engine is determined, the computer device may initialize the target script execution engine and process the application script of the application according to the target script execution engine.
[0088] like Figure 2 As shown, when the computer device determines that the target script execution engine is the Hermes engine, the computer device can initialize the Hermes engine and process the application script of the application through the Hermes engine. When the computer device determines that the target script execution engine is the JavascriptCore engine, the computer device can initialize the JavascriptCore engine and process the application script of the application through the JavascriptCore engine. Of course, it is not limited to this and is not limited here.
[0089] In this way, when the target script execution engine is determined, the target script execution engine can be used as a basis for the computer device to process the application script of the application, which is conducive to improving the convenience of processing the application script of the application.
[0090] Step S103: When it is detected that an exception occurs in the processing of the application script by the target script execution engine, an exception repair strategy corresponding to the target script execution engine is executed.
[0091] In the process of processing the application script of the application according to the target script execution engine, the computer device can detect whether the processing process of the application script by the target script execution engine is abnormal. In some embodiments, an exception monitoring strategy can be set in the application development framework where the application is located. In response to the processing process of the application script by the target script execution engine, the computer device can call the exception monitoring strategy to monitor and detect whether the processing process is abnormal. Taking the application development framework as ReactNative as an example, the exception monitoring strategy set in ReactNative can include RCTSetFatalHandler(). Of course, it is not limited to this and is not limited here.
[0092] When the computer device detects that the target script execution engine has an exception in the processing of the application script, the computer device needs to interrupt the processing of the application script. Accordingly, the computer device needs to repair the exception to restore the processing of the application script. For example, the computer device can be provided with an exception repair strategy corresponding to different target script execution engines, so that when the target script execution engine is different, such as when the target script execution engine is any one of the first script execution engine and the second script execution engine, the exception repair strategy adapted to the target script execution engine can be used to repair the current exception, thereby restoring the processing of the application script.
[0093] Based on this, the computer device can execute the exception repair strategy corresponding to the target script execution engine in response to an exception in the processing process of the application script by the target script execution engine, so that the computer device can subsequently resume the processing process of the application script of the application.
[0094] In this way, the computer device can detect whether the target script execution engine has an abnormality in processing the application script, which is conducive to improving the convenience of script processing detection of the target script execution engine, thereby improving the convenience of application operation detection. Accordingly, when an abnormality occurs in the processing of the application script, the computer device can execute the abnormality repair strategy corresponding to the target script execution engine to repair the current abnormality, which is conducive to improving the subsequent script processing stability of the target script execution engine, thereby improving the operation stability of the application.
[0095] Exemplarily, when the target script execution engine where the exception occurs is the first script execution engine, the target script execution engine is switched from the first script execution engine to the second script execution engine, so as to restore the application script of the application through the second script execution engine.
[0096] For example, since the development time of the first script execution engine is earlier than that of the second script execution engine, the script processing stability of the first script execution engine still needs to be verified over time, and the script processing stability of the second script execution engine has been verified for a long time, then the script processing stability of the second script execution engine is temporarily better than the script processing stability of the first script execution engine. Based on this, when the target script execution engine with an exception is the first script execution engine, the exception may be caused by the poor script processing stability of the first script execution engine, then the computer device can switch the target script execution engine from the first script execution engine to the second script execution engine, so as to restore the application script of the application through the second script execution engine with better script processing stability.
[0097] In some implementations, the computer device may switch the target script execution engine of the application according to the proxy mode corresponding to the first script execution engine, so as to dynamically control the switching process of the target script execution engine through the proxy mode corresponding to the first script execution engine.
[0098] For example, the return parameter of the proxy mode corresponding to the first script execution engine is changed to the second return value; in response to the return parameter being changed to the second return value, the target script execution engine is switched from the first script execution engine to the second script execution engine.
[0099] Since the second return value can be used to indicate that the proxy mode does not allow the computer device to access or call the first script execution engine, when the return parameter is changed to the second return value, the computer device can redetermine the target script execution engine as the second script execution engine based on the return parameter being the second return value, thereby switching the target script execution engine from the first script execution engine to the second script execution engine. Accordingly, when the target script execution engine is switched from the first script execution engine to the second script execution engine, the computer device can resume processing the application script according to the second script execution engine.
[0100] In this way, when the target script execution engine that has an exception is the first script execution engine, the computer device can change the return parameter of the proxy mode corresponding to the first script execution engine to the second return value, and switch the target script execution engine from the first script execution engine to the second script execution engine according to the change of the return parameter. Then, the proxy mode can be used to dynamically control the switching of the target script execution engine, which is conducive to improving the switching flexibility of the target script execution engine. Accordingly, in response to the target script execution engine switching from the first script execution engine to the second script execution engine, the application script can be resumed for processing, which is conducive to improving the script processing stability of the target script execution engine. In response to the target script execution engine resuming processing of the application script, the application can also resume running, which is conducive to improving the running stability of the application.
[0101] Exemplarily, when the target script execution engine where the exception occurs is the second script execution engine, the running error information corresponding to the application is output.
[0102] When the target script execution engine where the exception occurs is the second script execution engine, since the script processing stability of the second script execution engine is better than that of the first script execution engine, it is temporarily impossible to fix the exception by switching the target script execution engine to the first script execution engine. Based on this, when the target script execution engine where the exception occurs is the second script execution engine, the computer device can output corresponding operation error information. The operation error information can be used to prompt relevant personnel to check and determine the exception that occurs in the processing process of the application script, so that the relevant personnel can repair the exception, so that the computer device can resume processing the application script. Among them, when the computer device resumes processing the application script, it can continue to re-determine the target script execution engine, or it can continue to resume processing the application script through the first script execution engine, without limitation here.
[0103] In this way, when the target script execution engine where the exception occurs is the second script execution engine, the computer device can output corresponding operation error information to prompt relevant personnel to repair the exception, and then the target script execution engine can resume the processing of the application script, which is beneficial to improving the script processing stability of the target script execution engine and improving the operation stability of the application.
[0104] like Figure 5 As shown, the switching process of the target script execution engine may include steps S301 to S306.
[0105] Step S301: monitor the processing progress of the target script execution engine on the application script.
[0106] Take the application development framework of the application as ReactNative as an example. The computer device can monitor the processing process of the application script corresponding to the target script execution engine through RCTSetFatalHandler().
[0107] Step S302, determine whether an abnormality is detected in the processing process; if so, jump to step S303.
[0108] Taking the application development framework of the application as ReactNative as an example, when RCTSetFatalHandler() detects an exception in the processing process of the application script corresponding to the target script execution engine, it can throw an exception so that the computer device can determine that an exception has been detected in the processing process. Correspondingly, if RCTSetFatalHandler() does not throw an exception, the computer device can determine that no exception has been detected in the processing process.
[0109] Step S303, determine whether the target script execution engine is the first script execution engine; if so, jump to step S304; if not, jump to step S306.
[0110] The computer device may determine whether the target script execution engine is the first script execution engine to determine and execute the exception repair strategy corresponding to the target script execution engine. For example, if the target script execution engine is the first script execution engine, the subsequent computer device may execute the exception repair strategy corresponding to the first script execution engine. If the target script execution engine is the second script execution engine, the subsequent computer device may execute the exception repair strategy corresponding to the second script execution engine.
[0111] Step S304: Change the return parameter of the proxy mode corresponding to the first script execution engine to a second return value.
[0112] Take the case where the first script execution engine is a Hermes engine and the proxy mode corresponding to the first script execution engine is a useHermes proxy method as an example. The computer device may change the return parameter of the useHermes proxy method to a second return value to deny the computer device from continuing to access or call the Hermes engine. For example, the return parameter may be changed to the second return value through a preset return parameter change strategy, such as RCTBridge_reload(). Of course, this is not limited to this and is not limited here.
[0113] Step S305 : In response to the return parameter being changed to the second return value, the target script execution engine is switched from the first script execution engine to the second script execution engine.
[0114] For example, the first script execution engine is the Hermes engine, the second script execution engine is the JavascriptCore engine, and the proxy mode corresponding to the first script execution engine is the useHermes proxy method. The computer device can change the return parameter of the useHermes proxy method to the second return value, and switch the target script execution engine from the Hermes engine to the JavascriptCore engine to resume processing the application script of the application through the JavascriptCore engine.
[0115] Step S306: Output the running error information corresponding to the application.
[0116] Take the case where the first script execution engine is the Hermes engine and the second script execution engine is the JavascriptCore engine. When the target script execution engine is the JavascriptCore engine, the computer device is temporarily unable to fix the exception by switching the target script execution engine to the Hermes engine. Based on this, when the target script execution engine where the exception occurs is the JavascriptCore engine, the computer device can output the corresponding operation error information. The operation error information can be used to prompt relevant personnel to check and determine the exception that occurs in the processing process of the application script, so that the relevant personnel can repair the exception, and then the computer device can resume processing the application script. Among them, when the computer device resumes processing the application script, it can continue to re-determine the target script execution engine, or it can continue to resume processing the application script through the JavascriptCore engine, without limitation here.
[0117] The above-mentioned embodiment provides an application running method, in which a first script execution engine and a second script execution engine are integrated, and the running method includes: when the application is in a running state, determining a target script execution engine of the application from the first script execution engine and the second script execution engine; processing the application script of the application according to the target script execution engine; when it is detected that an exception occurs in the processing process of the application script by the target script execution engine, executing an exception repair strategy corresponding to the target script execution engine, so as to improve the flexibility of determining the target script execution engine of the application, and improve the script processing stability of the target script execution engine, thereby improving the running stability of the application.
[0118] For example, during the operation of the application, the computer device can determine the target script execution engine of the application from the first script execution engine and the second script execution engine integrated in the application according to the running state of the application, which is conducive to improving the flexibility of determining the target script execution engine. In the case of determining the target script execution engine of the application, the computer device can process the application script of the application according to the target script execution engine, and when an exception occurs in the processing process of the application script, execute the exception repair strategy corresponding to the target script execution engine for subsequent recovery and processing of the application script of the application, which is conducive to improving the script processing stability of the target script execution engine, thereby helping to improve the running stability of the application. The running method of the application can be applied to applications in different scenarios to run applications in different scenarios, thereby improving the running stability of applications in different scenarios. Applications in different scenarios include, for example, financial applications, social applications, shopping applications, etc., which are not limited here.
[0119] See also Figure 6 , Figure 6 1 is a schematic block diagram of an application running device provided in an embodiment of the present application. The application running device can be configured in a server or an electronic device to execute the aforementioned application running method.
[0120] Exemplarily, a first script execution engine and a second script execution engine are integrated into the application.
[0121] like Figure 6 As shown, the running device of the application includes: an engine determination module 110, a script processing module 120 and an abnormality repair module 130.
[0122] An engine determination module 110, configured to determine a target script execution engine for the application from the first script execution engine and the second script execution engine when the application is in a running state;
[0123] A script processing module 120, configured to process the application script of the application according to the target script execution engine;
[0124] The exception repair module 130 is used to execute the exception repair strategy corresponding to the target script execution engine when it is detected that the target script execution engine has an exception in processing the application script.
[0125] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0126] The method of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0127] Exemplarily, the above method and apparatus may be implemented in the form of a computer program, which may be run on a computer device.
[0128] See also Figure 7 , Figure 7 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or an electronic device.
[0129] like Figure 7 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.
[0130] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any application operation method.
[0131] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0132] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute the operation method of any application.
[0133] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0135] In one embodiment, the processor is used to execute a computer program and implement the following steps when executing the computer program:
[0136] When the application is in a running state, determining a target script execution engine of the application from the first script execution engine and the second script execution engine;
[0137] Processing the application script of the application according to the target script execution engine;
[0138] When it is detected that an exception occurs in the processing of the application script by the target script execution engine, an exception repair strategy corresponding to the target script execution engine is executed.
[0139] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described application operation can refer to the corresponding process in the aforementioned application operation method embodiment, and will not be repeated here.
[0140] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The method implemented when the computer program is executed by a processor can refer to the various embodiments of the operating method of the application of the present application.
[0141] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0142] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms.
[0143] It should also be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0144] It should also be understood that the non-Company software tools or components appearing in the embodiments of the present application are merely examples and do not represent actual use.
[0145] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.< / jscexecutoryfactory> < / hermesexecutoryfactory>
Claims
1. A method for running an application, characterized in that: The application integrates a first script execution engine and a second script execution engine, and the operation method includes: When the application is in a running state, determining a target script execution engine of the application from the first script execution engine and the second script execution engine; Processing the application script of the application according to the target script execution engine; When it is detected that an exception occurs in the processing of the application script by the target script execution engine, an exception repair strategy corresponding to the target script execution engine is executed.
2. The operating method according to claim 1, characterized in that: The determining a target script execution engine of the application from the first script execution engine and the second script execution engine includes: Calling the proxy mode corresponding to the first script execution engine to obtain a return parameter of the proxy mode; According to the return parameter, a target script execution engine of the application is determined from the first script execution engine and the second script execution engine.
3. The operating method according to claim 2, characterized in that: The step of determining the target script execution engine of the application from the first script execution engine and the second script execution engine according to the returned parameter includes: When the return parameter is the first return value, determining that the target script execution engine of the application is the first script execution engine; When the return parameter is the second return value, it is determined that the target script execution engine of the application is the second script execution engine.
4. The operating method according to claim 2, characterized in that: Before calling the proxy mode corresponding to the first script execution engine, the method further includes: Setting a proxy mode corresponding to the first script execution engine in an application development framework in which the application is located; The calling of the proxy mode corresponding to the first script execution engine includes: The proxy mode is called according to a preset calling strategy corresponding to the proxy mode in the application development framework.
5. The operating method according to claim 1, characterized in that: The executing the exception repair strategy corresponding to the target script execution engine includes: When the target script execution engine where the exception occurs is the first script execution engine, the target script execution engine is switched from the first script execution engine to the second script execution engine, so as to resume processing the application script of the application through the second script execution engine.
6. The operating method according to claim 5, characterized in that: The switching the target script execution engine from the first script execution engine to the second script execution engine includes: Changing the return parameter of the proxy mode corresponding to the first script execution engine to a second return value; In response to the return parameter being changed to a second return value, the target script execution engine is switched from the first script execution engine to a second script execution engine.
7. The operating method according to claim 1, characterized in that: The executing the exception repair strategy corresponding to the target script execution engine includes: When the target script execution engine where the exception occurs is the second script execution engine, the running error information corresponding to the application is output.
8. The operating method according to any one of claims 1 to 7, characterized in that: The first script execution engine and the second script execution engine are integrated into the application through the following steps: A first dependency relationship between the application development framework and the first script execution engine, and a second dependency relationship between the application development framework and the second script execution engine are set in dependency configuration information corresponding to the application development framework where the application is located.
9. An application running device, characterized in that: The application integrates a first script execution engine and a second script execution engine, and the running device includes: an engine determination module, configured to determine a target script execution engine for the application from the first script execution engine and the second script execution engine when the application is in a running state; A script processing module, used for processing the application script of the application according to the target script execution engine; The exception repair module is used to execute the exception repair strategy corresponding to the target script execution engine when it is detected that the target script execution engine has an exception in the processing process of the application script.
10. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the operating method of the application according to any one of claims 1 to 8 when executing the computer program.