CN110297666B - Thermal restoration method, device, system and storage medium - Google Patents

Thermal restoration method, device, system and storage medium Download PDF

Info

Publication number
CN110297666B
CN110297666B CN201910543859.XA CN201910543859A CN110297666B CN 110297666 B CN110297666 B CN 110297666B CN 201910543859 A CN201910543859 A CN 201910543859A CN 110297666 B CN110297666 B CN 110297666B
Authority
CN
China
Prior art keywords
class
interceptor
modified
initialization
patch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910543859.XA
Other languages
Chinese (zh)
Other versions
CN110297666A (en
Inventor
张迪
尚会波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201910543859.XA priority Critical patent/CN110297666B/en
Publication of CN110297666A publication Critical patent/CN110297666A/en
Application granted granted Critical
Publication of CN110297666B publication Critical patent/CN110297666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1417Boot up procedures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4403Processor initialisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The invention provides a thermal restoration method, a device, a system and a storage medium, wherein the method comprises the following steps: when class initialization is carried out, judging whether a class initialization method interceptor exists in the class; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.

Description

Thermal restoration method, device, system and storage medium
Technical Field
The present invention relates to the field of software system technologies, and in particular, to a thermal repair method, apparatus, system, and storage medium.
Background
The heat restoration technology is used for issuing the Patch through the cloud, so that online problems can be quickly restored, edition sending is not needed, and development cost is reduced.
Currently, common thermal repair techniques include: (1) replacing ArtMethod by Native layer; (2) adding the issued full dex to the forefront of a dex elements array; (3) and (4) performing instrumentation on the compiled class, executing the Patch logic when the Patch exists, and executing the original logic when the Patch does not exist. However, in the first scheme, it is required to ensure that the data structure of the Android bottom layer does not change, and the Android version is not limited by upgrading, so that the risk of failure is high. The second approach uses api that is strictly limited by the new version of Android and also risks failure. Therefore, the third scheme is generally adopted at present.
However, in the third scheme, a static variable is inserted into each class, and when a batch is loaded, if a class is found to have a corresponding batch class, the corresponding batch class of the class is instantiated, and the instantiated object is assigned to the static variable in the class. Thus, when the third scheme is running, if the static variable is found not to be empty, the logic in Patch is executed. And when a value is assigned to a static variable of a class, the loading and initialization of the Patch class can be directly executed, and if more Patch classes are involved, the starting speed of the application can be reduced, and the user experience is poor.
Disclosure of Invention
The invention provides a hot repair method, a hot repair device, a hot repair system and a storage medium, which can reduce the influence of Patch loading on the starting speed of an application, so that the starting speed of the application is higher and the user experience is better.
In a first aspect, an embodiment of the present invention provides a thermal repair method, including:
when class initialization is carried out, judging whether a class initialization method interceptor exists in the class;
if the class initialization method interceptor exists, executing a method in the class initialization method interceptor;
and if the class initialization method interceptor does not exist, executing the original method in the class.
In one possible design, when class initialization is performed, determining whether a class initialization method interceptor exists in a class includes:
when the class is initialized, calling an initialization method of the class;
and detecting whether the initialization method interceptor exists in the initialization methods of the classes.
In one possible design, executing the method in the class initialization method interceptor includes:
detecting whether the caller is a modified class;
if the class is modified, a Patch instance is created, completing the loading of the Patch.
In one possible design, after the loading of the Patch is completed, the method further includes:
if the Patch has the repair method, executing the repair method;
if there are no repair methods in Patch, then the original methods in the class are executed.
In one possible design, further comprising:
determining all modified classes;
and when the modified class is loaded for the first time, creating a class initialization method interceptor in the class initialization method corresponding to the modified class.
In one possible design, the determining all modified classes includes:
and carrying out differential comparison on all classes in the old installation package and the new installation package to obtain all modified classes.
In a second aspect, an embodiment of the present invention provides a thermal repair device, including:
the judging module is used for judging whether a class initialization method interceptor exists in the class when the class is initialized;
the processing module is used for executing the method in the class initialization method interceptor when the class initialization method interceptor exists;
and the processing module is also used for executing the original method in the class when the class initialization method interceptor does not exist.
In a possible design, the determining module is specifically configured to:
when the class is initialized, calling an initialization method of the class;
and detecting whether the initialization method interceptor exists in the initialization methods of the classes.
In one possible design, the processing module is specifically configured to:
detecting whether the caller is a modified class;
if it is a modified class, a Patch instance is created, completing the load of Patch.
In one possible design, after completing the loading of the batch, the processing module is further configured to:
if the Patch has the repair method, executing the repair method;
if there are no repair methods in Patch, then the original methods in the class are executed.
In one possible design, further comprising:
a determining module for determining all modified classes;
and the creating module is used for creating a class initialization method interceptor in the class initialization method corresponding to the modified class when the modified class is loaded for the first time.
In one possible design, the determining module is specifically configured to:
and carrying out differential comparison on all classes in the old installation package and the new installation package to obtain all modified classes.
In a third aspect, an embodiment of the present invention provides a thermal repair system, including: the device comprises a memory and a processor, wherein the memory stores executable instructions of the processor; wherein the processor is configured to perform the thermal remediation method of any of the first aspects via execution of the executable instructions.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the thermal remediation method of any one of the first aspects.
In a fifth aspect, an embodiment of the present invention provides a program product, where the program product includes: a computer program stored in a readable storage medium, the computer program being readable from the readable storage medium by at least one processor of a server, execution of the computer program by the at least one processor causing the server to perform the thermal remediation method of any one of the first aspects.
The invention provides a thermal restoration method, a device, a system and a storage medium, wherein when class initialization is carried out, whether a class initialization method interceptor exists in a class is judged; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of an application scenario of the present invention;
FIG. 2 is a flowchart of a thermal remediation method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a thermal remediation method according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of a thermal repair apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a thermal repair apparatus according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a thermal repair system according to a fifth embodiment of the present invention.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
The heat restoration technology is used for issuing the Patch through the cloud, so that online problems can be quickly restored, edition sending is not needed, and development cost is reduced. Currently, common thermal repair techniques include: (1) replacing ArtMethod by Native layer; (2) adding the issued full dex to the forefront of a dex elements array; (3) the compiled class is instrumented to execute Patch logic in the presence of a Patch, and to execute the original logic in the absence of a Patch. However, in the first scheme, it is required to ensure that the data structure of the Android bottom layer does not change, and the Android version is not limited by upgrading, so that the risk of failure is high. The second approach uses api that is strictly limited by the new version of Android and also risks failure. Therefore, the third scheme is generally adopted at present. However, in the third scheme, a static variable is inserted into each class, and when a batch is loaded, if a class is found to have a corresponding batch class, the corresponding batch class of the class is instantiated, and the instantiated object is assigned to the static variable in the class. Thus, when the third scheme is running, if the static variable is found not to be empty, the logic in Patch is executed. And when a value is assigned to a static variable of a class, the loading and initialization of the Patch class can be directly executed, and if more Patch classes are involved, the starting speed of the application can be reduced, and the user experience is poor.
Aiming at the technical problems, the invention provides a hot repair method which can reduce the influence of Patch loading on the application starting speed, so that the application starting speed is higher and the user experience is good. Fig. 1 is a schematic diagram of an application scenario of the present invention, and as shown in fig. 1, in order to optimize the patch loading and reduce the impact on the start-up speed, the present invention provides a technical solution of delaying loading of the patch, and loads the patch in a modified class initialization stage, so that it is not necessary to instantiate all the patch classes in the start-up stage, and it is not necessary to initialize all the modified classes in the start-up stage, but the loading of the patch is completed before the modified classes are used for the first time. In implementation, a class ClinitInterceptorStorage, which contains only one static variable clinitmtectable. $ ic, may be added to the hot repair sdk first. The class initialization method interceptor is stored in clinitmtepiptorstorage $ ic. And then, when the classes are modified and need to be subjected to hot repair, carrying out differential comparison on all the classes in the installation package of the old version and the installation package of the new version to obtain all the modified classes. Specifically, while generating the patch, all classes in the new and old apks are compared, and if the modified class has the class initialization method < clinit >, the patch class is marked as deferrable loading. After all class comparison is completed, if a batch class marked as delay-loadable is available, a class initialization method interceptor is created, namely, a subclass of the ClinitInterceptible class is created, branch judgment is added in the method invokeClinit method of the subclass, if the caller calling the method is the class A which is modified, the batch class corresponding to the class A is created and assigned to the static variable in the class A. Similarly, the same branch judgment logic can be added for other classes which are modified, so that the patch of all classes which are modified is realized. Then, the created class initialization method interceptor is also put into patch. When the project is started, the project is started according to a normal flow without additional processing. When a certain class is used for the first time, if one class has an initialization method < clinit >, the instrumentation of the < clinit > method is different from the general method, and whether the ClinitIntercaptorage $ ic is empty or not is judged, that is, whether a class initialization method interceptor exists or not is judged. Then, if the clinitintercaptorage $ ic is null, that is, there is no class initialization method interceptor, it may be determined that there is no patch, that is, no hot repair is needed, the original method in the class is executed, and the class may be initialized according to a normal flow. If the ClinitIntercaptorage $ ic is not empty, it is determined that a class initialization method interceptor exists. At this time, a method invokeClinit in the class initialization method interceptor Clinitorstorage. $ ic, that is, ClinitIntercaptorstorage. $ ic. A method invokeClinit in the class initialization method interceptor is used for detecting whether a caller is a modified class; if the class is modified, a Patch instance is created, and the load of the Patch is completed, so that the repair method of the class initialization method < clinit > in the Patch is completed. Therefore, the whole process of the hot repair is that the project is normally started when being started, when the modified class a is initialized, the initialization method < clinit > of the class a is called, at this time, since the class initialization method interceptor clinictorstorage $ ic is not null, the clinictorstorage $ ic. invokeClinit method is called, the caller is found in the invokeClinit method as the modified class a, a patch class instance corresponding to the class a is created and assigned to a static variable in the class a, and the loading of the patch corresponding to the class a is completed. Similarly, other classes that are modified may also load the patch class instance corresponding to the class when initialized. Finally, after the load of the Patch is completed, the method further comprises the following steps: if the Patch has the repair method, executing the repair method; if there are no repair methods in Patch, then the original methods in the class are executed. For example, if there is a repair method in the patch corresponding to the class a that has been modified, the repair method is executed after the load, thereby implementing hot repair.
By applying the method, all Patch classes do not need to be instantiated in the starting stage, and all modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of a thermal repair method according to an embodiment of the present invention, and as shown in fig. 2, the method in this embodiment may include:
s101, judging whether a class initialization method interceptor exists in the class when the class is initialized.
In this embodiment, when initializing a class, determining whether a class initialization method interceptor exists in the class includes: calling an initialization method of the class when the class is initialized; and detecting whether an initialization method interceptor exists in the initialization method of the class.
Specifically, in the existing thermal repair scheme using the instrumentation scheme, a corresponding patch class is generated for each modified class, and when a patch is loaded in an application start phase, the patch class is instantiated and assigned to a static variable of the modified class, and in this process, the modified class needs to be loaded and initialized. The more classes that are modified, the greater the impact on the startup speed. In order to optimize the patch loading and reduce the influence on the starting speed, the invention provides a technical scheme for delaying the loading of the patch, and the patch is loaded in the initialization stage of the modified class, so that all the patch classes do not need to be instantiated in the starting stage, all the modified classes do not need to be initialized in the starting stage, and the loading of the patch is completed before the modified classes are used for the first time. First, a class ClinitIntercaptorage, which contains only one static variable ClinitIntercaptable $ ic, may be added to the hot fix sdk. The class initialization method interceptor is stored in clinitmtepiptorstorage $ ic. When the project is started, the project is started according to a normal flow without additional processing. When a certain class is used for the first time, if one class has an initialization method < clinit >, the instrumentation of the < clinit > method is different from the general method, and whether the ClinitIntercaptorage $ ic is empty or not is judged, that is, whether a class initialization method interceptor exists or not is judged.
And S102, if the class initialization method interceptor exists, executing the method in the class initialization method interceptor.
In this embodiment, if a class initialization method interceptor exists, it is detected whether a caller is a modified class; if the class is modified, a Patch instance is created, completing the loading of the Patch.
Specifically, in S101, when a certain class initialization method is performed, it is determined that the cliniterceptorstorage $ ic is not empty, that is, it is determined that a class initialization method interceptor exists. At this time, a method invokeClinit in the class initialization method interceptor Clinitorstorage. $ ic, that is, ClinitIntercaptorstorage. $ ic. A method invokeClinit in the class initialization method interceptor is used for detecting whether a caller is a modified class; if the class is modified, a Patch instance is created, and the load of the Patch is completed, so that the repair method of the class initialization method < clinit > in the Patch is completed. For example, in the method invokeClinit in the class initialization method interceptor, a branch judgment is added, and if the caller calling the method is the modified class A, the patch class corresponding to the class A is created and assigned to the static variable in A. Similarly, the same branch judgment logic can be added to other classes which are modified, so that the patch loading of all classes which are modified is realized. Therefore, the whole process of the hot repair is that the project is normally started when being started, when the modified class a is initialized, the initialization method < clinit > of the class a is called, at this time, since the class initialization method interceptor clinictorstorage $ ic is not null, the clinictorstorage $ ic. invokeClinit method is called, the caller is found in the invokeClinit method as the modified class a, a patch class instance corresponding to the class a is created and assigned to a static variable in the class a, and the loading of the patch corresponding to the class a is completed. Similarly, other classes that are modified may also load the patch class instance corresponding to the class when initialized.
Optionally, after the loading of the Patch is completed, the method further includes: if the Patch has a repair method, executing the repair method; if there is no repair method in Patch, then the original method in the class is executed. For example, if there is a repair method in the patch corresponding to the class a that has been modified, the repair method is executed after the load, thereby implementing hot repair.
S103, if the class initialization method interceptor does not exist, executing the original method in the class.
In this embodiment, if the clinitintercaptorage $ ic is null, that is, there is no class initialization method interceptor, it may be determined that there is no patch, that is, no hot repair is needed, the original method in the class is executed, and the class may be initialized according to a normal flow.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. . According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Fig. 3 is a flowchart of a thermal repair method according to a second embodiment of the present invention, and as shown in fig. 3, the method in this embodiment may include:
s201, determining all modified classes.
In this embodiment, when a class is modified and needs to be repaired by heat, all classes in the old version installation package and the new version installation package are differentially compared to obtain all modified classes. Specifically, while generating the patch, all classes in the new and old apks are compared, and if the modified class has the class initialization method < clinit >, the patch class is marked as deferrable loading. After all class comparison is completed, if a batch class marked as delay-loadable is available, a class initialization method interceptor is created, namely, a subclass of the ClinitInterceptible class is created, branch judgment is added in the method invokeClinit method of the subclass, if the caller calling the method is the class A which is modified, the batch class corresponding to the class A is created and assigned to the static variable in the class A. Similarly, the same branch judgment logic can be added for other classes which are modified, so that the patch of all classes which are modified is realized. The same branch decision logic is added for other classes that are modified. Then, the created class initialization method interceptor is also put into patch.
S202, when the modified class is loaded for the first time, a class initialization method interceptor is created in the class initialization method corresponding to the modified class.
In this embodiment, when a patch is loaded on a client, a class initialization method interceptor instance is created in S201 and assigned to clinitntercaptorstorage $ ic.
S203, judging whether a class initialization method interceptor exists in the class when the class is initialized.
And S204, if the class initialization method interceptor exists, executing the method in the class initialization method interceptor.
S205, if the class initialization method interceptor does not exist, executing the original method in the class.
In this embodiment, please refer to the relevant description in steps S101 to S103 in the method shown in fig. 2 for the specific implementation process and technical principle of steps S203 to S205, which is not described herein again.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
In addition, the present embodiment may also determine all modified classes; when the modified class is loaded for the first time, a class initialization method interceptor is created in the class initialization method corresponding to the modified class. Therefore, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Fig. 4 is a schematic structural diagram of a thermal repair apparatus provided in a third embodiment of the present invention, and as shown in fig. 4, the thermal repair apparatus of this embodiment may include:
the judging module 31 is configured to judge whether a class initialization method interceptor exists in a class when the class is initialized;
a processing module 32, configured to, when a class initialization method interceptor exists, execute a method in the class initialization method interceptor;
the processing module 32 is further configured to execute the original method in the class when the class initialization method interceptor does not exist.
In one possible design, the determining module 31 is specifically configured to:
when the class is initialized, calling an initialization method of the class;
and detecting whether an initialization method interceptor exists in the initialization method of the class.
In one possible design, the processing module is specifically configured to:
detecting whether the caller is a modified class;
if the class is modified, a Patch instance is created, completing the loading of the Patch.
In one possible design, after completing the loading of Patch, the processing module is further configured to:
if the Patch has a repair method, executing the repair method;
if there are no repair methods in Patch, then the original methods in the class are executed.
The thermal repair apparatus of this embodiment may execute the technical solution in the method shown in fig. 2, and for the specific implementation process and the technical principle, reference is made to the relevant description in the method shown in fig. 2, which is not described herein again.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Fig. 5 is a schematic structural diagram of a thermal repair apparatus according to a fourth embodiment of the present invention, and as shown in fig. 5, the thermal repair apparatus according to this embodiment may further include, on the basis of the apparatus shown in fig. 4:
a determining module 33 for determining all modified classes;
a creating module 34, configured to create a class initialization method interceptor in the class initialization method corresponding to the modified class when the modified class is loaded for the first time.
In one possible design, the determining module 33 is specifically configured to:
and carrying out differential comparison on all classes in the old installation package and the new installation package to obtain all modified classes.
The thermal repair apparatus of this embodiment may execute the technical solutions in the methods shown in fig. 2 and fig. 3, and the specific implementation process and technical principle of the thermal repair apparatus refer to the related descriptions in the methods shown in fig. 2 and fig. 3, which are not described herein again.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
In addition, the present embodiment may also determine all modified classes; when the modified class is loaded for the first time, a class initialization method interceptor is created in the class initialization method corresponding to the modified class. Therefore, all Patch classes do not need to be instantiated in the starting stage, and all modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Fig. 6 is a schematic structural diagram of a thermal repair system according to a fifth embodiment of the present invention, and as shown in fig. 6, the thermal repair system 40 of this embodiment may include: a processor 41 and a memory 42.
A memory 42 for storing programs; the Memory 42 may include a volatile Memory (RAM), such as a Static Random Access Memory (SRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), and the like; the memory may also comprise a non-volatile memory, such as a flash memory. The memory 42 is used to store computer programs (e.g., applications, functional modules, etc. that implement the above-described methods), computer instructions, etc., which may be stored in one or more of the memories 42 in a partitioned manner. And the above-mentioned computer program, computer instructions, data, etc. can be called by the processor 41.
The computer programs, computer instructions, etc. described above may be stored in one or more memories 42 in partitions. And the above-mentioned computer program, computer instructions, data, etc. can be called by the processor 41.
A processor 41 for executing the computer program stored in the memory 42 to implement the steps of the method according to the above embodiments.
Reference may be made in particular to the description relating to the preceding method embodiment.
The processor 41 and the memory 42 may be separate structures or may be integrated structures integrated together. When the processor 41 and the memory 42 are separate structures, the memory 42 and the processor 41 may be coupled by a bus 43.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
The thermal repair system of this embodiment may execute the technical solutions in the methods shown in fig. 2 and fig. 3, and the specific implementation process and technical principle of the thermal repair system refer to the related descriptions in the methods shown in fig. 2 and fig. 3, which are not described herein again.
In addition, embodiments of the present application further provide a computer-readable storage medium, in which computer-executable instructions are stored, and when at least one processor of the user equipment executes the computer-executable instructions, the user equipment performs the above-mentioned various possible methods.
In this embodiment, when class initialization is performed, whether a class initialization method interceptor exists in a class is determined; if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; and if the class initialization method interceptor does not exist, executing the original method in the class. According to the method, all the Patch classes do not need to be instantiated in the starting stage, and all the modified classes do not need to be initialized in the starting stage, so that the influence of Patch loading on the starting speed of the application is effectively reduced, the starting speed of the application is higher, and the user experience is good.
Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. Additionally, the ASIC may reside in user equipment. Of course, the processor and the storage medium may reside as discrete components in a communication device.
The present application further provides a program product comprising a computer program stored in a readable storage medium, from which the computer program can be read by at least one processor of a server, the computer program being executed by the at least one processor to cause the server to implement the thermal remediation method of any one of the embodiments of the invention described above.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A method of thermal remediation, comprising:
when a class is first used after application launch:
judging whether a class initialization method interceptor exists in the class initialization stage;
if the class initialization method interceptor exists, executing the method in the class initialization method interceptor; the method in the class initialization method interceptor comprises the following steps: detecting whether the caller is a modified class; if the class is the modified class, creating a Patch instance and finishing the loading of the Patch; the modified class is provided with a first mark, and the first mark indicates that the class is a class of which the loading opportunity is delayed until the application is started;
and if the class initialization method interceptor does not exist, executing the original method in the class.
2. The method of claim 1, wherein determining whether a class initialization method interceptor exists in a class at class initialization comprises:
when the class is initialized, calling an initialization method of the class;
and detecting whether the initialization method interceptor exists in the initialization methods of the classes.
3. The method of claim 1, after completing the loading of the batch, further comprising:
if the Patch has the repair method, executing the repair method;
if there are no repair methods in Patch, then the original methods in the class are executed.
4. The method according to any one of claims 1-3, further comprising:
determining all modified classes;
and when the modified class is loaded for the first time, creating a class initialization method interceptor in the class initialization method corresponding to the modified class.
5. The method of claim 4, wherein determining all modified classes comprises:
and carrying out differential comparison on all classes in the old version installation package and the new version installation package to obtain all modified classes.
6. A thermal remediation device, comprising:
the judging module is used for judging whether the class is used for the first time after the application is started:
in the class initialization stage, judging whether a class initialization method interceptor exists in the class;
the processing module is used for executing the method in the class initialization method interceptor when the class initialization method interceptor exists; the method in the class initialization method interceptor comprises the following steps: detecting whether the caller is a modified class; if the class is the modified class, creating a Patch instance and finishing the loading of the Patch; the modified class is provided with a first mark, and the first mark indicates that the class is a class of which the loading opportunity is delayed until the application is started;
and the processing module is also used for executing the original method in the class when the class initialization method interceptor does not exist.
7. The apparatus of claim 6, wherein the determining module is specifically configured to:
when the class is initialized, calling an initialization method of the class;
and detecting whether the initialization method interceptor exists in the initialization methods of the classes.
8. A thermal remediation system, comprising: the device comprises a memory and a processor, wherein the memory stores executable instructions of the processor; wherein the processor is configured to perform the thermal remediation method of claims 1-5 via execution of the executable instructions.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the thermal remediation method of any one of claims 1 to 5.
CN201910543859.XA 2019-06-21 2019-06-21 Thermal restoration method, device, system and storage medium Active CN110297666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910543859.XA CN110297666B (en) 2019-06-21 2019-06-21 Thermal restoration method, device, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910543859.XA CN110297666B (en) 2019-06-21 2019-06-21 Thermal restoration method, device, system and storage medium

Publications (2)

Publication Number Publication Date
CN110297666A CN110297666A (en) 2019-10-01
CN110297666B true CN110297666B (en) 2022-06-17

Family

ID=68028526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910543859.XA Active CN110297666B (en) 2019-06-21 2019-06-21 Thermal restoration method, device, system and storage medium

Country Status (1)

Country Link
CN (1) CN110297666B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780864A (en) * 2019-10-30 2020-02-11 网易(杭州)网络有限公司 Control method and device for class method replacement, storage medium and electronic equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6061520A (en) * 1998-04-07 2000-05-09 Sun Microsystems, Inc. Method and system for performing static initialization
US8612930B2 (en) * 2009-01-30 2013-12-17 Oracle America, Inc. Methods and apparatus for dynamic class reloading and versioning
CN103345412B (en) * 2013-07-10 2016-08-24 华为技术有限公司 The method and device of patch installing
CN107346252B (en) * 2016-05-07 2021-05-25 腾讯科技(深圳)有限公司 Application updating method and device
CN107391107A (en) * 2017-06-12 2017-11-24 北京明朝万达科技股份有限公司 The restorative procedure and device of a kind of application program
CN108241500B (en) * 2018-01-15 2022-02-01 腾讯科技(深圳)有限公司 Method, device and system for repairing hardware component and storage medium
CN108920170A (en) * 2018-05-15 2018-11-30 玩咖欢聚文化传媒(北京)有限公司 Dynamic restoring method, terminal, medium and the system of Android product installation kit
CN108829436A (en) * 2018-06-15 2018-11-16 北京京东尚科信息技术有限公司 Hot restorative procedure, device, system, electronic equipment and computer-readable medium

Also Published As

Publication number Publication date
CN110297666A (en) 2019-10-01

Similar Documents

Publication Publication Date Title
US8489922B2 (en) Networked recovery system
CN111492347A (en) System and method for updating containers
CN111782302B (en) Process updating method and device, storage medium and electronic equipment
CN107807839B (en) Method and device for modifying memory data of virtual machine and electronic equipment
US20160328227A1 (en) Dynamically Applying A Software Patch To A Computer Program
CN113238819B (en) Dynamic loading method and system of drive file suitable for U-Boot
CN108228077B (en) Storage area management method, operation method, device, equipment and readable medium
JP5225071B2 (en) Method for verifying pseudo code loaded on embedded systems, especially smart cards
CN104731622A (en) Application program loading method and device and mobile terminal
CN110297666B (en) Thermal restoration method, device, system and storage medium
WO2016068845A1 (en) Dynamically applying a patch to a shared library
CN109688472A (en) Upgrading TV system method, apparatus, equipment and storage medium
CN111142922B (en) Application program updating method, device, terminal and server
CN103455750B (en) The high peace verification method of a kind of embedded device and device
US10922682B2 (en) Java card application memory footprint optimization
CN112799778A (en) Container application starting method, device and medium
CN107943544B (en) Kernel patch loading method and device
CN111694580A (en) Method and device for upgrading and initializing storage device and electronic device
CN111258617B (en) Electronic equipment
CN108829460A (en) The method, apparatus and car-mounted terminal of car-mounted terminal quick start
CN102473090B (en) Can be used for multiple interface documents of accessing BIOS
CN111722866B (en) OpenStack code repairing method, device, equipment and storage medium
CN115794260B (en) Simple dynamic loading method for DSP software library
US20220108003A1 (en) Apparatus and method for kernel runtime randomization
CN107015827A (en) The method of embedded system and its automatic running third party&#39;s extender

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant