CN110297666A - Hot restorative procedure, device, system and storage medium - Google Patents

Hot restorative procedure, device, system and storage medium Download PDF

Info

Publication number
CN110297666A
CN110297666A CN201910543859.XA CN201910543859A CN110297666A CN 110297666 A CN110297666 A CN 110297666A CN 201910543859 A CN201910543859 A CN 201910543859A CN 110297666 A CN110297666 A CN 110297666A
Authority
CN
China
Prior art keywords
class
blocker
patch
initial
initial method
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.)
Granted
Application number
CN201910543859.XA
Other languages
Chinese (zh)
Other versions
CN110297666B (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology 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

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 present invention provides a kind of hot restorative procedure, device, system and storage medium, this method, comprising: in class initialization, judges in class with the presence or absence of class initial method blocker;The class initial method blocker if it exists then executes the method in the class initial method blocker;The class initial method blocker if it does not exist, then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need to initialize the class of all modifications in startup stage yet, to effectively reduce influence of the Patch load to application starting speed, so that the starting speed of application is faster, user experience is good.

Description

Hot restorative procedure, device, system and storage medium
Technical field
The present invention relates to software systems technical fields more particularly to a kind of hot restorative procedure, device, system and storage to be situated between Matter.
Background technique
Hot-fixing is used to issue Patch by cloud, subtracts so as to problem in quick repair line without sending out version Few development cost.
Currently, common hot-fixing includes: that (1) passes through Native layers of replacement ArtMethod;(2) complete by what is issued Amount dex is added to the foremost of dex elements array;(3) pitching pile, the execution when there is Patch are carried out to the class after compiling Patch logic executes former logic in no Patch.However the first scheme needs to guarantee the data structure of Android bottom not It changes, and Android edition upgrading is not limited, therefore the risk of its failure is high.Second scheme uses The api strictly limited by Android new version, there is also the risks of failure.Therefore, the third scheme can be generally used at present.
But the third scheme can be inserted into a static variable in each class, when loading Patch, if it find that one A class has corresponding Patch class, will instantiate such corresponding Patch class, and by the object value after instantiation to class In static variable.Therefore, it when the third scheme is run, if it find that static variable is not sky, carries out in Patch Logic.And when giving the static variable assignment of a class, the load and initialization of Patch class can be directly executed, if be related to When Patch class is more, the starting speed of application can be slowed down, user experience is bad.
Summary of the invention
The present invention provides a kind of hot restorative procedure, device, system and storage medium, it is possible to reduce Patch is loaded to application Start the influence of speed, so that the starting speed of application is faster, user experience is good.
In a first aspect, the embodiment of the present invention provides a kind of hot restorative procedure, comprising:
In class initialization, judge in class with the presence or absence of class initial method blocker;
The class initial method blocker if it exists then executes the method in the class initial method blocker;
The class initial method blocker if it does not exist, then execute method original in class.
In a kind of possible design, in class initialization, judge in class with the presence or absence of class initial method blocker, packet It includes:
In class initialization, the initial method of class is called;
It detects in the initial method of the class with the presence or absence of the initial method blocker.
In a kind of possible design, the method in the class initial method blocker is executed, comprising:
Whether detection caller is the class modified;
If the class of modification, then Patch example is created, completes the load of Patch.
In a kind of possible design, after the load for completing Patch, further includes:
If there are restorative procedures in Patch, the restorative procedure is executed;
If restorative procedure is not present in Patch, method original in class is executed.
In a kind of possible design, further includes:
Determine the class of all modifications;
When loading the class of the modification for the first time, class is created in the class initial method corresponding to the class of the modification Initial method blocker.
In a kind of possible design, the class of the determining all modifications, comprising:
Class all in the installation kit of old edition and the installation kit of new version is subjected to differential ratio pair, obtains all modifications Class.
Second aspect, the embodiment of the present invention provide a kind of hot repair apparatus for coating, comprising:
Judgment module, for judging in class with the presence or absence of class initial method blocker in class initialization;
Processing module is blocked for when there are the class initial method blocker, then executing the class initial method Cut the method in device;
Processing module is also used to then execute method original in class when the class initial method blocker is not present.
In a kind of possible design, the judgment module is specifically used for:
In class initialization, the initial method of class is called;
It detects in the initial method of the class with the presence or absence of the initial method blocker.
In a kind of possible design, the processing module is specifically used for:
Whether detection caller is the class modified;
If the class of modification, then Patch example is created, completes the load of Patch.
In a kind of possible design, after the load for completing Patch, the processing module is also used to:
If there are restorative procedures in Patch, the restorative procedure is executed;
If restorative procedure is not present in Patch, method original in class is executed.
In a kind of possible design, further includes:
Determining module, for determining the class of all modifications;
Creation module, for when loading the class of the modification for the first time, the class corresponding to the class of the modification to be initial Class initial method blocker is created in change method.
In a kind of possible design, the determining module is specifically used for:
Class all in the installation kit of old edition and the installation kit of new version is subjected to differential ratio pair, obtains all modifications Class.
The third aspect, the embodiment of the present invention provide a kind of hot repair complex system, comprising: memory and processor, in memory It is stored with the executable instruction of the processor;Wherein, the processor is configured to hold via the executable instruction is executed Hot restorative procedure described in any one of row first aspect.
Fourth aspect, the embodiment of the present invention provide a kind of computer readable storage medium, are stored thereon with computer program, Hot restorative procedure described in any one of first aspect is realized when the program is executed by processor.
5th aspect, the embodiment of the present invention provide a kind of program product, and described program product includes: computer program, institute It states computer program to be stored in readable storage medium storing program for executing, at least one processor of server can be from the readable storage medium storing program for executing The computer program is read, at least one described processor executes the computer program and server is made to execute first aspect In any hot restorative procedure.
The present invention provides a kind of hot restorative procedure, device, system and storage medium, by judging class when class initializes In whether there is class initial method blocker;The class initial method blocker if it exists then executes the class initialization Method in method blocker;The class initial method blocker if it does not exist, then execute method original in class.This hair It is bright not need to instantiate all Patch classes in startup stage, it does not need to initialize the class of all modifications in startup stage yet, To effectively reduce influence of the Patch load to application starting speed, so that the starting speed of application is faster, user experience It is good.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair Bright some embodiments for those of ordinary skill in the art without any creative labor, can be with It obtains other drawings based on these drawings.
Fig. 1 is the schematic illustration of an application scenarios of the invention;
Fig. 2 is the flow chart for the hot restorative procedure that the embodiment of the present invention one provides;
Fig. 3 is the flow chart of hot restorative procedure provided by Embodiment 2 of the present invention;
Fig. 4 is the structural schematic diagram for the hot repair apparatus for coating that the embodiment of the present invention three provides;
Fig. 5 is the structural schematic diagram for the hot repair apparatus for coating that the embodiment of the present invention four provides;
Fig. 6 is the structural schematic diagram for the hot repair complex system that the embodiment of the present invention five provides.
Through the above attached drawings, it has been shown that the specific embodiment of the disclosure will be hereinafter described in more detail.These attached drawings It is not intended to limit the scope of this disclosure concept by any means with verbal description, but is by referring to specific embodiments Those skilled in the art illustrate the concept of the disclosure.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Description and claims of this specification and term " first ", " second ", " third ", " in above-mentioned attached drawing The (if present)s such as four " are to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should manage The data that solution uses in this way are interchangeable under appropriate circumstances, so that the embodiment of the present invention described herein for example can be to remove Sequence other than those of illustrating or describe herein is implemented.In addition, term " includes " and " having " and theirs is any Deformation, it is intended that cover it is non-exclusive include, for example, containing the process, method of a series of steps or units, system, production Product or equipment those of are not necessarily limited to be clearly listed step or unit, but may include be not clearly listed or for this A little process, methods, the other step or units of product or equipment inherently.
Technical solution of the present invention is described in detail with specifically embodiment below.These specific implementations below Example can be combined with each other, and the same or similar concept or process may be repeated no more in some embodiments.
Hot-fixing is used to issue Patch by cloud, subtracts so as to problem in quick repair line without sending out version Few development cost.Currently, common hot-fixing includes: that (1) passes through Native layers of replacement ArtMethod;(2) it will issue Full dose dex is added to the foremost of dex elements array;(3) pitching pile is carried out to the class after compiling, is there is Patch (patch) Shi Zhihang Patch logic executes former logic in no Patch.However the first scheme needs to guarantee the data of Android bottom Structure does not change, and Android edition upgrading is not limited, therefore the risk of its failure is high.Second scheme The api strictly limited by Android new version is used, there is also the risks of failure.Therefore, the third can be generally used at present Scheme.But the third scheme can be inserted into a static variable in each class, when loading Patch, if it find that a class There is corresponding Patch class, such corresponding Patch class will be instantiated, and by the object value after instantiation in class Static variable.Therefore, when the third scheme is run, if it find that static variable is not sky, patrolling in Patch is carried out Volume.And when giving the static variable assignment of a class, the load and initialization of Patch class can be directly executed, if the Patch being related to When class is more, the starting speed of application can be slowed down, user experience is bad.
In view of the above technical problems, the present invention provides a kind of hot restorative procedure, it is possible to reduce Patch load starts application The influence of speed, so that the starting speed of application is faster, user experience is good.Fig. 1 is the principle signal of an application scenarios of the invention Figure, as shown in Figure 1, reducing the influence to starting speed to optimize patch load, the present invention provides a kind of delay loading The technical solution of patch, modification class initial phase load patch, so there is no need in startup stage by all patch Class instantiation, also there is no need to initialize all classes modified in startup stage, but is modified using for the first time Class before, complete the load of patch.During realization, one class of addition in sdk can be answered in hot repair first ClinitInterceptorStorage, wherein only including a static variable ClinitInterceptable. $ ic.Class is initial Change method blocker is just stored in ClinitInterceptorStorage. $ ic.Then, hot repair is needed when modification occurs for class When multiple, class all in the installation kit of old edition and the installation kit of new version is subjected to differential ratio pair, obtains the class of all modifications.Tool Body, while generating patch, all classes in new and old apk are compared, have class initialization in case of the class of modification Method<clinit>, then being marked as its patch class can delay loading.After completing the comparison of all classes, if there is be marked as can The patch class of delay loading, then one class initial method blocker of creation, that is, create one The subclass of ClinitInterceptable class, in the method invokeClinit method of this subclass, the judgement of addition branch, If the caller for calling this method is the class A modified, the corresponding patch class of class A is created, and by its assignment into A Static variable in.Similarly, for other classes modified, same branch's decision logic can also be added, to realize All patch that modification class occurs.Then, the class initial method blocker of creation is also put into patch.In project initiation When, extra process is not needed, is started by normal flow.But in some class for the first time in use, if a class has initialization side Method<clinit>, then it is different from conventional method to the pitching pile of<clinit>method, it judges wherein ClinitInterceptorStorage. whether $ ic is sky, that is, judges whether there is class initial method blocker.Then, if ClinitInterceptorStorage. $ ic is sky, that is, class initial method blocker is not present, does not deposit then can determine It in patch, that is, does not need hot repair and answers, then execute method original in class, class can be initialized according to normal flow.If ClinitInterceptorStorage. $ ic is not empty, i.e., and determines that there are class initial method blockers.At this point it is possible to adjust With the method invokeClinit in class initial method blocker ClinitInterceptorStorage. $ ic, i.e., ClinitInterceptorStorage.$ic.invokeClinit.Method in class initial method blocker InvokeClinit, for detecting whether caller is the class modified;If the class of modification, then Patch example is created, completed The load of Patch, to complete in patch to the restorative procedure of class initial method<clinit>.Therefore, multiple entire of hot repair Process is exactly, and when project initiation normally starts, when the class A modified is initialised, can call the initial method of class A < Clinit >, at this moment since class initial method blocker ClinitInterceptorStorage. $ ic is not sky, can call ClinitInterceptorStorage. $ ic.invokeClinit method finds caller in invokeClinit method For the class A modified, the corresponding patch class example of class A, and the static variable being assigned in class A will create, complete class The load of the corresponding patch of A.Similarly, other classes modified, also can the corresponding patch class reality of loading classes in initialization Example.Finally, after the load for completing Patch, further includes: if there are restorative procedures in Patch, execute restorative procedure;If Restorative procedure is not present in Patch, then executes method original in class.For example, being deposited in the corresponding patch of class A modified In restorative procedure, then restorative procedure is executed after load, so that it is multiple to realize hot repair.
It does not need to instantiate all Patch classes in startup stage using the above method, not need in startup stage yet The class of all modifications is initialized, so that influence of the Patch load to application starting speed is effectively reduced, so that the starting of application Faster, user experience is good for speed.
How to be solved with technical solution of the specifically embodiment to technical solution of the present invention and the application below above-mentioned Technical problem is described in detail.These specific embodiments can be combined with each other below, for the same or similar concept Or process may repeat no more in certain embodiments.Below in conjunction with attached drawing, the embodiment of the present invention is described.
Fig. 2 is the flow chart for the hot restorative procedure that the embodiment of the present invention one provides, as shown in Fig. 2, the side in the present embodiment Method may include:
S101, in class initialization, judge in class with the presence or absence of class initial method blocker.
In the present embodiment, in class initialization, judge in class with the presence or absence of class initial method blocker, comprising: in class When initialization, the initial method of class is called;It detects and whether there is initial method blocker in the initial method of class.
Specifically, a correspondence is generated for each class modified using the hot recovery scenario of pitching pile scheme at present Patch class, applying startup stage, when loading patch, this patch class instantiated, and is assigned to the class modified A static variable, need the class that will be modified to load in this process and initialize.The class modified is more, right The influence for starting speed is also bigger.In order to optimize patch load, the influence to starting speed is reduced, the present invention provides one kind and prolongs The technical solution of load patch late, modification class initial phase load patch, and so there is no need to will own in startup stage Patch class instantiation, also there is no need to initialize all classes modified in startup stage, but using hair for the first time Before the class of raw modification, the load of patch is completed.It is possible, firstly, to answer one class of addition in sdk in hot repair ClinitInterceptorStorage, wherein only including a static variable ClinitInterceptable. $ ic.Class is initial Change method blocker is just stored in ClinitInterceptorStorage. $ ic.In project initiation, do not need additionally to locate Reason is started by normal flow.But in some class for the first time in use, if a class has initial method<clinit>, to< Clinit > method pitching pile is different from conventional method, whether judges ClinitInterceptorStorage. $ ic wherein For sky, that is, judge whether there is class initial method blocker.
S102, if it exists class initial method blocker then execute the method in class initial method blocker.
In the present embodiment, whether class initial method blocker, detection caller are the class modified if it exists;If modification Class, then create Patch example, complete the load of Patch.
Specifically, in S101 when some class initial method, judge ClinitInterceptorStorage. $ ic It is not sky, i.e., and determines that there are class initial method blockers.At this point it is possible to call class initial method blocker ClinitInterceptorStorage. the method invokeClinit in $ ic, i.e. ClinitInterceptorStorage. $ ic.invokeClinit.Method invokeClinit in class initial method blocker, for detecting whether caller is to repair The class changed;If the class of modification, then Patch example is created, complete the load of Patch, to complete to initialize class in patch The restorative procedure of method<clinit>.For example, adding branch in method invokeClinit in class initial method blocker Judgement creates the corresponding patch class of class A if the caller for calling this method is the class A modified, and by its assignment In static variable into A.Similarly, for other classes modified, same branch's decision logic can also be added, thus Realize all patch loads that modification class occurs.Therefore, the multiple whole process of hot repair is exactly, and when project initiation normally starts, when When the class A modified is initialised, the initial method<clinit>of class A can be called, at this moment since class initial method blocks Cutting device ClinitInterceptorStorage. $ ic is not sky, can call ClinitInterceptorStorage. $ Ic.invokeClinit method finds that caller is the class A modified in invokeClinit method, will create A pairs of class The patch class example answered, and the static variable being assigned in class A complete the load of the corresponding patch of class A.Similarly, The class that he modifies, also can the corresponding patch class example of loading classes in initialization.
Optionally, after the load for completing Patch, further includes: if there are restorative procedures in Patch, execute reparation Method;If restorative procedure is not present in Patch, method original in class is executed.For example, the class A modified is corresponding There are restorative procedures in patch, then restorative procedure is executed after load, so that it is multiple to realize hot repair.
S103, if it does not exist class initial method blocker, then execute method original in class.
In the present embodiment, if ClinitInterceptorStorage. $ ic is sky, i.e., blocked there is no class initial method Device is cut, then can determine that there is no patch, that is, hot repair is not needed and answers, then execute method original in class, it can be according to normal Process initializes class.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need yet Startup stage initializes the class of all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that answering Faster, user experience is good for starting speed.
Fig. 3 is the flow chart of hot restorative procedure provided by Embodiment 2 of the present invention, as shown in figure 3, the side in the present embodiment Method may include:
S201, the class for determining all modifications.
It, will be in the installation kit of old edition and the installation kit of new version when modification, which occurs, for class needs hot repair multiple in the present embodiment All classes carry out differential ratio pair, obtain the class of all modifications.Specifically, while generating patch, in new and old apk All classes compare, and have class initial method<clinit>in case of the class of modification, are then marked as to prolong by its patch class Load late.After completing the comparison of all classes, if there is be marked as can delay loading patch class, then one class of creation is initial Change method blocker creates the subclass of a ClinitInterceptable class, in the method for this subclass In invokeClinit method, the judgement of addition branch creates if the caller for calling this method is the class A modified The corresponding patch class of class A, and by its assignment in the static variable into A.It similarly, can also be with for other classes modified Same branch's decision logic is added, to realize all patch that modification class occurs.To other classes modified, addition Same branch decision logic.Then, the class initial method blocker of creation is also put into patch.
S202, when the class of first time load modification, at the beginning of creating class in the class initial method corresponding to the class of modification Beginning method blocker.
In the present embodiment, when loading patch on end, creates and create class initial method blocker example in S201, it will It is assigned to ClinitInterceptorStorage. $ ic.
S203, in class initialization, judge in class with the presence or absence of class initial method blocker.
S204, if it exists class initial method blocker then execute the method in class initial method blocker.
S205, if it does not exist class initial method blocker, then execute method original in class.
In the present embodiment, step S203~step S205 specific implementation process and technical principle are shown in Figure 2 Associated description in method in step S101~step S103, details are not described herein again.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need opening yet The class of dynamic stage initialization all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that using Starting speed faster, user experience is good.
In addition, the present embodiment can also determine the class of all modifications;When the class of first time load modification, in the class of modification Class initial method blocker is created in corresponding class initial method.Without will be all in startup stage The instantiation of Patch class does not need to initialize the class of all modifications in startup stage yet, to effectively reduce Patch load pair Using the influence of starting speed, so that the starting speed of application is faster, user experience is good.
Fig. 4 is the structural schematic diagram for the hot repair apparatus for coating that the embodiment of the present invention three provides, as shown in figure 4, the present embodiment Hot repair apparatus for coating may include:
Judgment module 31, for judging in class with the presence or absence of class initial method blocker in class initialization;
Processing module 32, for when there are class initial method blocker, then executing in class initial method blocker Method;
Processing module 32 is also used to then execute method original in class when class initial method blocker is not present.
In a kind of possible design, judgment module 31 is specifically used for:
In class initialization, the initial method of class is called;
It detects and whether there is initial method blocker in the initial method of class.
In a kind of possible design, processing module is specifically used for:
Whether detection caller is the class modified;
If the class of modification, then Patch example is created, completes the load of Patch.
In a kind of possible design, after the load for completing Patch, processing module is also used to:
If there are restorative procedures in Patch, restorative procedure is executed;
If restorative procedure is not present in Patch, method original in class is executed.
The hot repair apparatus for coating of the present embodiment, can execute the technical solution in method shown in Fig. 2, specific implementation process and Associated description in technical principle method shown in Figure 2, details are not described herein again.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need yet Startup stage initializes the class of all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that answering Faster, user experience is good for starting speed.
Fig. 5 is the structural schematic diagram for the hot repair apparatus for coating that the embodiment of the present invention four provides, as shown in figure 5, the present embodiment On the basis of hot repair apparatus for coating device shown in Fig. 4, can also include:
Determining module 33, for determining the class of all modifications;
Creation module 34, when for loading the class of modification when first time, the class initial method corresponding to the class of modification Middle creation class initial method blocker.
In a kind of possible design, determining module 33 is specifically used for:
Class all in the installation kit of old edition and the installation kit of new version is subjected to differential ratio pair, obtains all modifications Class.
The hot repair apparatus for coating of the present embodiment, can execute the technical solution in method shown in Fig. 2, Fig. 3, implement The associated description of journey and technical principle referring to fig. 2, in method shown in Fig. 3, details are not described herein again.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need yet Startup stage initializes the class of all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that answering Faster, user experience is good for starting speed.
In addition, the present embodiment can also determine the class of all modifications;When the class of first time load modification, in the class of modification Class initial method blocker is created in corresponding class initial method.Without will be all in startup stage The instantiation of Patch class does not need to initialize the class of all modifications in startup stage yet, to effectively reduce Patch load pair Using the influence of starting speed, so that the starting speed of application is faster, user experience is good.
Fig. 6 is the structural schematic diagram for the hot repair complex system that the embodiment of the present invention five provides, as shown in fig. 6, the present embodiment Hot repair complex system 40 may include: processor 41 and memory 42.
Memory 42, for storing program;Memory 42 may include volatile memory (English: volatile Memory), for example, random access memory (English: random-access memory, abbreviation: RAM), such as static random-access Memory (English: static random-access memory, abbreviation: SRAM), double data rate synchronous dynamic random-access Memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviation: DDR SDRAM) etc.;Memory also may include nonvolatile memory (English: non-volatile memory), such as fastly Flash memory (English: flash memory).Memory 42 is used to store computer program (the application journey as realized the above method Sequence, functional module etc.), computer instruction etc., above-mentioned computer program, computer instruction etc. can with partitioned storage at one or In multiple memories 42.And above-mentioned computer program, computer instruction, data etc. can be called with device 41 processed.
Above-mentioned computer program, computer instruction etc. can be with partitioned storages in one or more memories 42.And Above-mentioned computer program, computer instruction, data etc. can be called with device 41 processed.
Processor 41, for executing the computer program of the storage of memory 42, to realize method that above-described embodiment is related to In each step.
It specifically may refer to the associated description in previous methods embodiment.
Processor 41 and memory 42 can be absolute construction, be also possible to the integrated morphology integrated.Work as processing When device 41 and memory 42 are absolute construction, memory 42, processor 41 can be of coupled connections by bus 43.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need yet Startup stage initializes the class of all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that answering Faster, user experience is good for starting speed.
The hot repair complex system of the present embodiment can execute the technical solution in method shown in Fig. 2, Fig. 3, implement The associated description of journey and technical principle referring to fig. 2, in method shown in Fig. 3, details are not described herein again.
In addition, the embodiment of the present application also provides a kind of computer readable storage medium, deposited in computer readable storage medium Computer executed instructions are contained, when at least one processor of user equipment executes the computer executed instructions, user equipment Execute above-mentioned various possible methods.
The present embodiment, by when class initializes, judging in class with the presence or absence of class initial method blocker;Class if it exists Initial method blocker then executes the method in class initial method blocker;Class initial method blocker if it does not exist, Then execute method original in class.The present invention does not need to instantiate all Patch classes in startup stage, does not need yet Startup stage initializes the class of all modifications, so that influence of the Patch load to application starting speed is effectively reduced, so that answering Faster, user experience is good for starting speed.
Wherein, computer-readable medium includes computer storage media and communication media, and wherein communication media includes being convenient for From a place to any medium of another place transmission computer program.Storage medium can be general or specialized computer Any usable medium that can be accessed.A kind of illustrative storage medium is coupled to processor, to enable a processor to from this Read information, and information can be written to the storage medium.Certainly, storage medium is also possible to the composition portion of processor Point.Pocessor and storage media can be located in ASIC.In addition, the ASIC can be located in user equipment.Certainly, processor and Storage medium can also be used as discrete assembly and be present in communication equipment.
The application also provides a kind of program product, and program product includes computer program, and computer program is stored in readable In storage medium, at least one processor of server can read computer program from readable storage medium storing program for executing, at least one Reason device executes the hot restorative procedure that computer program makes the server implementation embodiments of the present invention any.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above-mentioned each method embodiment can lead to The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer readable storage medium.The journey When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned include: ROM, RAM, magnetic disk or The various media that can store program code such as person's CD.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or part of or all technical features are carried out etc. With replacement;And these modifications or substitutions, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution Range.

Claims (10)

1. a kind of hot restorative procedure characterized by comprising
In class initialization, judge in class with the presence or absence of class initial method blocker;
The class initial method blocker if it exists then executes the method in the class initial method blocker;
The class initial method blocker if it does not exist, then execute method original in class.
2. the method according to claim 1, wherein judging initial with the presence or absence of class in class in class initialization Change method blocker, comprising:
In class initialization, the initial method of class is called;
It detects in the initial method of the class with the presence or absence of the initial method blocker.
3. the method according to claim 1, wherein execute the method in the class initial method blocker, Include:
Whether detection caller is the class modified;
If the class of modification, then Patch example is created, completes the load of Patch.
4. according to the method described in claim 3, it is characterized in that, after the load for completing Patch, further includes:
If there are restorative procedures in Patch, the restorative procedure is executed;
If restorative procedure is not present in Patch, method original in class is executed.
5. method according to any of claims 1-4, which is characterized in that further include:
Determine the class of all modifications;
It is initial that class is created when loading the class of the modification for the first time, in the class initial method corresponding to the class of the modification Change method blocker.
6. according to the method described in claim 5, it is characterized in that, the class of the determining all modifications, comprising:
Class all in the installation kit of old edition and the installation kit of new version is subjected to differential ratio pair, obtains the class of all modifications.
7. a kind of hot repair apparatus for coating characterized by comprising
Judgment module, for judging in class with the presence or absence of class initial method blocker in class initialization;
Processing module, for when there are the class initial method blocker, then executing the class initial method blocker In method;
Processing module is also used to then execute method original in class when the class initial method blocker is not present.
8. device according to claim 7, which is characterized in that the judgment module is specifically used for:
In class initialization, the initial method of class is called;
It detects in the initial method of the class with the presence or absence of the initial method blocker.
9. a kind of hot repair complex system characterized by comprising memory and processor are stored with the processor in memory Executable instruction;Wherein, the processor is configured to come described in perform claim requirement 1-6 via the execution executable instruction Hot restorative procedure.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor Hot restorative procedure described in any one of claims 1-6 is realized when execution.
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 true CN110297666A (en) 2019-10-01
CN110297666B 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)

Cited By (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

Citations (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
US20100199259A1 (en) * 2009-01-30 2010-08-05 Quinn Timothy J Methods and Apparatus for Dynamic Class Reloading and Versioning
CN103345412A (en) * 2013-07-10 2013-10-09 华为技术有限公司 Patching method and device
CN107346252A (en) * 2016-05-07 2017-11-14 腾讯科技(深圳)有限公司 Using update method and device
CN107391107A (en) * 2017-06-12 2017-11-24 北京明朝万达科技股份有限公司 The restorative procedure and device of a kind of application program
CN108241500A (en) * 2018-01-15 2018-07-03 腾讯科技(深圳)有限公司 A kind of restorative procedure of hardware component, device, system and storage medium
CN108829436A (en) * 2018-06-15 2018-11-16 北京京东尚科信息技术有限公司 Hot restorative procedure, device, system, electronic equipment and computer-readable medium
CN108920170A (en) * 2018-05-15 2018-11-30 玩咖欢聚文化传媒(北京)有限公司 Dynamic restoring method, terminal, medium and the system of Android product installation kit

Patent Citations (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
US20100199259A1 (en) * 2009-01-30 2010-08-05 Quinn Timothy J Methods and Apparatus for Dynamic Class Reloading and Versioning
CN103345412A (en) * 2013-07-10 2013-10-09 华为技术有限公司 Patching method and device
CN107346252A (en) * 2016-05-07 2017-11-14 腾讯科技(深圳)有限公司 Using update method and device
CN107391107A (en) * 2017-06-12 2017-11-24 北京明朝万达科技股份有限公司 The restorative procedure and device of a kind of application program
CN108241500A (en) * 2018-01-15 2018-07-03 腾讯科技(深圳)有限公司 A kind of restorative procedure of hardware component, device, system 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

Cited By (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

Also Published As

Publication number Publication date
CN110297666B (en) 2022-06-17

Similar Documents

Publication Publication Date Title
AU2008279001B2 (en) Transactional graph-based computation with error handling
US9495286B2 (en) Method and arrangement for completion or recovery of data transactions in a flash type memory device using a commit process
CN108874372B (en) Scale-based block chain contract implementation method and system
CN104025047A (en) Information Processing Device, Information Processing Method, And Computer Program
CN104156279B (en) A kind of backup method of router configuration data
CN107329792B (en) Docker container starting method and device
CN113238819B (en) Dynamic loading method and system of drive file suitable for U-Boot
EP4080358A1 (en) Virtual machine deployment and hot-migration methods, vmm upgrade method, and server
CN111625546A (en) Data writing method, device, equipment and medium
CN110297666A (en) Hot restorative procedure, device, system and storage medium
CN108984270B (en) Memory allocation method and device for virtual machine
CN110399168A (en) Majority according to disk storage server system start method, device and equipment
CN111913742B (en) Program processing method and related equipment
CN103970507B (en) 64 virtual machines process the method and device of access instruction
CN102799536B (en) The adaptive method and device of capacity of memory device in a kind of embedded system
US20190213042A1 (en) Java card application memory footprint optimization
CN109375953A (en) A kind of os starting method and device
CN110941516B (en) Operating system restoration method, device, equipment and storage medium
CN113051071A (en) Command submitting method and device, command reading method and device, and electronic equipment
CN112564956A (en) Remote upgrading method, equipment and device for client and storage medium
CN109240702A (en) Quick segmentation addressing configuration and access method under a kind of multithread mode
US20070204099A1 (en) Methods for programming NAND flash memory and memory system
CN114780230A (en) Memory allocation method, memory deployment method and related device
US20150347042A1 (en) Apparatus and method for controlling memory
US6950916B2 (en) Dynamically setting the optimal base addresses of process components

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