CN113703820A - Method and device for hot loading source code, electronic equipment and storage medium - Google Patents

Method and device for hot loading source code, electronic equipment and storage medium Download PDF

Info

Publication number
CN113703820A
CN113703820A CN202111113416.0A CN202111113416A CN113703820A CN 113703820 A CN113703820 A CN 113703820A CN 202111113416 A CN202111113416 A CN 202111113416A CN 113703820 A CN113703820 A CN 113703820A
Authority
CN
China
Prior art keywords
source code
application program
target application
target
code content
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.)
Pending
Application number
CN202111113416.0A
Other languages
Chinese (zh)
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202111113416.0A priority Critical patent/CN113703820A/en
Publication of CN113703820A publication Critical patent/CN113703820A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Abstract

The application discloses a method, a device, electronic equipment and a storage medium for hot loading source codes, which can be applied to the distributed field or the financial field, wherein the method for hot loading the source codes comprises the following steps: when a target application program is started, reading source code content of the target application program from a target source code library, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes; monitoring whether the source code content of the target application program in the target source code library changes in real time; if the source code content of the target application program in the target source code library is monitored to be changed, the changed source code content of the target application program is read from the target source code library, and the read changed source code content of the target application program is compiled into the current latest byte code in real time so as to execute the current latest byte code.

Description

Method and device for hot loading source code, electronic equipment and storage medium
Technical Field
The present application relates to the field of program modification technologies, and in particular, to a method and an apparatus for hot loading source codes, an electronic device, and a storage medium.
Background
Currently, with the increasing business service demand, a plurality of applications are generally required to be run under a distributed micro-service architecture to meet the service demand.
In order to provide the corresponding service, Java program source code is compiled to generate executable bytecode, and then the bytecode program is deployed on a target computer to run, so as to provide the corresponding service. When the program on the target computer needs to be modified, the bytecode program running on the target computer needs to be stopped, then the source code of the Java program is modified, then compiled to obtain the bytecode, and the bytecode is deployed on the computer again and finally restarted.
However, currently, more and more production systems need to be continuously serviced, so that running programs cannot be stopped, redeployed and restarted. In addition, the number of due programs is large, and if the modification needs to be stopped, the operation needs to be stopped, so that the normal service provision of the production system is influenced.
Disclosure of Invention
Based on the defects of the prior art, the application provides a method, a device, an electronic device and a storage medium for hot loading source codes, so as to solve the problem that the normal service provision of a production system is influenced because the program operation needs to be stopped in the conventional program modification mode.
In order to achieve the above object, the present application provides the following technical solutions:
a first aspect of the present application provides a method for hot loading source code, including:
when a target application program is started, reading source code content of the target application program from a target source code library, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes;
monitoring whether the source code content of the target application program in the target source code library changes in real time;
if the source code content of the target application program in the target source code library is monitored to be changed, the changed source code content of the target application program is read from the target source code library, and the read changed source code content of the target application program is compiled into the current latest byte code in real time so as to execute the current latest byte code.
Optionally, in the method for hot loading source code, the monitoring whether the source code content of the target application in the target source code library is changed in real time includes:
monitoring whether a source code content change notice of the application program is received in real time; the source code content change notification of the application program is issued when the source code content of the application program in the target source code library changes, and is used for triggering execution of reading changed source code content of the target application program from the target source code library, and compiling the read changed source code content of the target application program into current latest byte codes in real time so as to execute the current latest byte codes.
Optionally, in the method for hot loading source code, after compiling the read changed source code content of the target application program into the current latest bytecode in real time, the method further includes:
and replacing the byte code obtained by compiling previously with the current latest byte code.
Optionally, in the method for hot loading source code described above, the reading the source code content of the target application from the target source code library includes:
reading a ciphertext of the source code content of the target application program from the target source code library;
and decrypting the read ciphertext of the source code content of the target application program to obtain the source code content of the target application program.
Optionally, in the method for hot loading source code, the method further includes:
judging whether the currently read execution operation corresponding to the source code content of the target application program contains a preset limiting operation or not;
if the execution operation corresponding to the currently read source code content of the target application program does not contain the preset limit operation, determining that the currently read source code content of the target application program is allowed to be compiled;
and if the execution operation corresponding to the source code content of the target application program is judged to contain the preset limit operation, the currently read source code content of the target application program is limited to be compiled, and prompt information is fed back.
A second aspect of the present application provides an apparatus for hot loading source code, comprising:
the device comprises a first loading unit, a second loading unit and a third loading unit, wherein the first loading unit is used for reading the source code content of a target application program from a target source code library when the target application program is started, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes;
the monitoring unit is used for monitoring whether the source code content of the target application program in the target source code library changes in real time;
and the second loading unit is used for reading the changed source code content of the target application program from the target source code library and compiling the read changed source code content of the target application program into the current latest byte code in real time so as to execute the current latest byte code if the source code content of the target application program in the target source code library is monitored to be changed.
Optionally, in the apparatus for hot loading source code described above, the monitoring unit includes:
the monitoring subunit is used for monitoring whether a source code content change notification of the application program is received in real time; the source code content change notification of the application program is issued when the source code content of the application program in the target source code library changes, and is used for triggering execution of reading changed source code content of the target application program from the target source code library, and compiling the read changed source code content of the target application program into current latest byte codes in real time so as to execute the current latest byte codes.
Optionally, in the apparatus for hot loading source code, the apparatus further includes:
a replacing unit, configured to replace the previously compiled bytecode with the current latest bytecode.
Optionally, in the above apparatus for hot loading source code, when the first loading unit executes the reading of the source code content of the target application program from the target source code library, the first loading unit is configured to:
reading a ciphertext of the source code content of the target application program from the target source code library;
and decrypting the read ciphertext of the source code content of the target application program to obtain the source code content of the target application program.
Optionally, in the apparatus for hot loading source code, the apparatus further includes:
the judging unit is used for judging whether the execution operation corresponding to the currently read source code content of the target application program contains a preset limiting operation;
the determining unit is used for determining that the currently read source code content of the target application program is allowed to be compiled if the executing operation corresponding to the currently read source code content of the target application program does not contain a preset limiting operation;
and the limiting unit is used for limiting the compiling of the currently read source code content of the target application program and feeding back prompt information if the execution operation corresponding to the source code content of the target application program is judged to contain a preset limiting operation.
A third aspect of the present application provides an electronic device comprising:
a memory and a processor;
wherein the memory is used for storing programs;
the processor is configured to execute the program, and when the program is executed, the program is specifically configured to implement the method for hot loading source code according to any one of the above.
A fourth aspect of the present application provides a computer storage medium for storing a computer program which, when executed, is configured to implement a method of hot loading source code as claimed in any one of the preceding claims.
According to the method for hot loading of the source code, provided by the embodiment of the application, the source code content of the target application program is read from the target source code library when the target application program is started, and the read source code content of the target application program is compiled into the byte code in real time so as to execute the compiled byte code, so that the byte code does not need to be deployed and can be executed. And monitoring whether the source code content of the target application program in the target source code library changes in real time, and reading the changed source code content of the target application program from the target source code library when monitoring that the source code content of the target application program in the target source code library changes, and compiling the read changed source code content of the target application program into the current latest bytecode in real time to execute the current latest bytecode, so that the running of the bytecode program does not need to be stopped, the hot loading of the program is realized, and the production system can be ensured to normally provide services all the time.
Drawings
In order to more clearly illustrate the embodiments of the present application 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, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic diagram of an architecture of a source code loading system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for hot loading source code according to another embodiment of the present application;
fig. 3 is a flowchart of a method for reading source code content according to another embodiment of the present application;
FIG. 4 is a schematic structural diagram of an apparatus for hot loading source code according to another embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. 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 application.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The method, the device, the electronic equipment and the storage medium for hot loading of the source code can be used in the distributed field or the financial field, for example, can be used in a code loading application scenario in the distributed field. Other fields are any fields other than the financial field, for example, the field of computer technology. The foregoing is merely an example, and does not limit the application fields of the method, the apparatus, the electronic device, and the storage medium for hot loading source code provided in the present invention.
The application provides a method for hot loading source codes, which aims to solve the problem that the normal service provision of a production system is influenced because the program operation needs to be stopped in the conventional program modification mode.
Optionally, in order to implement the method for hot loading the source code provided by the present application, an embodiment of the present application provides a source code loading system.
As shown in fig. 1, a source code loading system provided in an embodiment of the present application specifically includes:
a target source code library 101, a dynamic compiling module 102, a configuration center 103 and a configuration monitoring module 104.
The source code library is mainly used for maintaining source code content of an application program that needs to be hot-loaded, that is, the source code content of the application program, whether the source code content is initial or modified later, needs to be stored in the target source code library 101.
The dynamic compiling module 102 is mainly used for performing a hot loading operation, that is, reading the source code content of the application program from the target source code library 101, and compiling the read source code content of the application program into an executable bytecode in real time, so as to execute the bytecode and provide a corresponding service.
The configuration center 103 is a software system that performs centralized management on configuration of corresponding programs, and is mainly used for managing changes of source code contents of application programs in the target source code library 101 during program loading, and when the source code contents of the application programs change, a change notification is issued to notify all monitored application programs.
The configuration monitoring module 104 is mainly used for monitoring a source code content change notification issued by the configuration center 103, and when receiving the notification, calling the dynamic compiling module 102 to perform a hot loading operation.
Based on the source code loading system provided above, an embodiment of the present application provides a method for hot loading source codes, as shown in fig. 2, including the following steps:
s201, when the target application program is started, reading the source code content of the target application program from the target source code library, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes.
A target application may refer to any application that may require a source code hot load. Typically an application that may be frequently changed.
The target source code library refers to a database for storing source code content of the target application program.
It should be noted that, in the embodiment of the present application, the source code content of the target application needs to be stored in the target source code library in advance. Therefore, when the target application program is started, the source code content of the target application program is read from the target source code library, the read source code content of the target application program is compiled into byte codes in real time, and then the compiled executable byte codes are directly executed, so that the executable byte codes do not need to be deployed into a target computer and then started and executed.
Optionally, in order to ensure the security of the source code content of the target application, in another embodiment of the present application, a specific implementation manner of reading the source code content of the target application from the target source code library in step S201, as shown in fig. 3, includes:
s301, reading the ciphertext of the source code content of the target application program from the target source code library.
It should be noted that, for the security of the source code content, in the embodiment of the present application, the source code content of the target application program in the target source code library is encrypted through an encryption algorithm, so as to obtain a ciphertext of the source code content of the target application program, that is, the source code content of the target application program is stored in the target source code library in a ciphertext manner.
S302, decrypting the read ciphertext of the source code content of the target application program to obtain the source code content of the target application program.
In the embodiment of the present application, the same manner as that shown in fig. 3 is adopted for reading the source code content of the changed target application program from the target source code library in step S203.
Optionally, to ensure the security of the system, in another embodiment of the present application, after reading the source code content of the target application from the target source code library, before compiling the read source code content of the target application into bytecode in real time, the method may further include:
and judging whether the execution operation corresponding to the source code content of the currently read target application program contains preset limit operation.
The preset limiting operation may specifically be to prohibit the use of a loop statement, prohibit the reading and writing of a certain specific file, and the like, thereby realizing the limitation on certain specific operations and improving the system security. And compiling the read source code content when the execution operation corresponding to the read source code content does not comprise the preset limit operation.
Therefore, if it is determined that the execution operation corresponding to the currently read source code content of the target application program does not include the preset limit operation, it is determined that the currently read source code content of the target application program is allowed to be compiled, that is, the currently read source code content of the target application program is compiled into the bytecode in real time, so as to execute the compiled bytecode.
And if the execution operation corresponding to the source code content of the target application program is judged to contain the preset limit operation, the source code content of the currently read target application program is limited to be compiled, and prompt information is fed back.
Optionally, the prompt message may prompt which preset restriction operations are included in the target source code content, so as to enable the user to make corresponding adjustments.
S202, monitoring whether the source code content of the target application program in the target source code library changes in real time.
Alternatively, step S202 may be executed from the start of starting the target application, so that even if the source code content of the target application is changed when the target application is just started, the changed source code content of the target application can be reloaded in time.
It should be noted that, in the present application, the modified post-source code content of the target application also needs to be stored in the target source code library. Specifically, the source code content of the target application program in the target source code library may be directly modified, or the source code content of the target application program stored in the target source code library may be replaced with the modified source code content of the target application program.
Of course, the source code content of the target application is usually not modified at the stage of starting the target application, so that the execution may be started after a certain period of time.
Optionally, in another embodiment of the present application, an implementation manner of step S202 includes:
and monitoring whether a source code content change notice of the application program is received in real time.
The notification of the change of the source code content of the application program is issued when the source code content of the application program in the target source code library is changed, and is used for triggering the execution of the step S201. When the source code content change notification of the application program is monitored to be received, the source code content of the target application program in the target source code library is monitored to be changed.
It should be noted that, if it is monitored that the source code content of the target application program in the target source code library changes, step S203 is executed. After step S203 is executed once, if it is monitored that the source code content of the target application program in the target source code library changes again, step S203 is executed again, that is, in the process of real-time monitoring, step S203 needs to be executed once every time the source code content of the target application program in the target source code library changes.
S203, reading the source code content of the changed target application program from the target source code library, and compiling the read source code content of the changed target application program into the current latest byte code in real time so as to execute the current latest byte code.
It should be noted that after the current latest bytecode is executed, the previously compiled bytecode is not executed.
Optionally, in another embodiment of the present application, after compiling the read changed source code content of the target application into the current latest bytecode in real time, further performing:
and replacing the byte code obtained by the previous compilation with the byte code which is latest at present.
So that the currently up-to-date bytecode can be executed while avoiding the execution of previously compiled bytecodes.
Also optionally, in order to ensure the security of the system, in another embodiment of the present application, after reading the source code content of the modified target application from the target source code library, before compiling the read source code content of the modified target application into the current latest bytecode in real time, the method may further include:
and judging whether the execution operation corresponding to the source code content of the currently read target application program contains preset limit operation.
The currently read source code content of the target application program is the source code content of the changed target application program, that is, no matter the read source code content of the target application program before the change or the source code content after the change is read, as long as the source code content of the target application program is read, whether the corresponding execution operation includes the preset limit operation or not is judged according to the currently read source code content of the target application program.
Similarly, if it is determined that the execution operation corresponding to the currently read source code content of the target application program does not include the preset limit operation, it is determined that the currently read source code content of the target application program is allowed to be compiled, that is, the read changed source code content of the target application program is compiled into the current latest byte code in real time.
And if the execution operation corresponding to the source code content of the target application program is judged to contain the preset limit operation, the currently read source code content of the target application program is limited to be compiled, and prompt information is fed back, namely the changed source code content of the target application program is limited to be compiled.
According to the method for hot loading of the source code, provided by the embodiment of the application, the source code content of the target application program is read from the target source code library when the target application program is started, and the read source code content of the target application program is compiled into the byte code in real time so as to execute the compiled byte code, so that the byte code does not need to be deployed and can be executed. And monitoring whether the source code content of the target application program in the target source code library changes in real time, and reading the changed source code content of the target application program from the target source code library when monitoring that the source code content of the target application program in the target source code library changes, and compiling the read changed source code content of the target application program into the current latest bytecode in real time to execute the current latest bytecode, so that the running of the bytecode program does not need to be stopped, the hot loading of the program is realized, and the production system can be ensured to normally provide services all the time.
It is to be noted that the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Although the operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous.
Another embodiment of the present application provides an apparatus for hot loading source code, as shown in fig. 4, including the following units:
the first loading unit 401 is configured to, when a target application is started, read source code content of the target application from a target source code library, and compile the read source code content of the target application into a bytecode in real time to execute the compiled bytecode.
A monitoring unit 402, configured to monitor whether the source code content of the target application in the target source code library changes in real time.
A second loading unit 403, configured to, if it is monitored that the source code content of the target application program in the target source code library changes, read the changed source code content of the target application program from the target source code library, and compile the read changed source code content of the target application program into a current latest bytecode in real time, so as to execute the current latest bytecode.
Optionally, in an apparatus for hot loading source code provided in another embodiment of the present application, a monitoring unit includes:
and the monitoring subunit is used for monitoring whether the source code content change notification of the application program is received in real time.
The source code content change notification of the application program is issued when the source code content of the application program in the target source code library changes, and is used for triggering execution of reading changed source code content of the target application program from the target source code library, and compiling the read changed source code content of the target application program into current latest byte codes in real time so as to execute the current latest byte codes.
Optionally, in an apparatus for hot loading source code provided in another embodiment of the present application, the apparatus further includes:
a replacing unit, configured to replace the previously compiled bytecode with the current latest bytecode.
Optionally, in the apparatus for hot loading source code provided in another embodiment of the present application, when the first loading unit executes the reading of the source code content of the target application program from the target source code library, the first loading unit is configured to:
and reading the ciphertext of the source code content of the target application program from the target source code library.
And decrypting the read ciphertext of the source code content of the target application program to obtain the source code content of the target application program.
Optionally, in an apparatus for hot loading source code provided in another embodiment of the present application, the apparatus further includes:
and the judging unit is used for judging whether the execution operation corresponding to the currently read source code content of the target application program contains a preset limiting operation.
And the determining unit is used for determining that the currently read source code content of the target application program is allowed to be compiled if the executing operation corresponding to the currently read source code content of the target application program does not contain the preset limiting operation.
And the limiting unit is used for limiting the compiling of the currently read source code content of the target application program and feeding back prompt information if the execution operation corresponding to the source code content of the target application program is judged to contain a preset limiting operation.
It should be noted that each unit provided in the foregoing embodiment of the present application may specifically be a component of each module in the source code loading system shown in fig. 1, and a specific working process of each unit may refer to corresponding steps in the foregoing method embodiment accordingly, which is not described herein again.
Another embodiment of the present application provides an electronic device, as shown in fig. 5, including:
a memory 501 and a processor 502.
The memory 501 is used for storing programs.
The processor 502 is configured to execute the program stored in the memory 501, and when the program is executed, the program is specifically configured to implement the method for hot loading source code as provided in any of the above embodiments.
A fourth aspect of the present application provides a computer storage medium for storing a computer program, which when executed, is configured to implement a method for hot loading source code as provided in any one of the above embodiments.
Computer storage media, including permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should be noted that the method and apparatus for hot loading source code, the electronic device, and the storage medium provided by the present invention may be used in the distributed field or the financial field. The above description is only an example, and does not limit the application field of the name of the invention provided by the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for hot loading source code, comprising:
when a target application program is started, reading source code content of the target application program from a target source code library, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes;
monitoring whether the source code content of the target application program in the target source code library changes in real time;
if the source code content of the target application program in the target source code library is monitored to be changed, the changed source code content of the target application program is read from the target source code library, and the read changed source code content of the target application program is compiled into the current latest byte code in real time so as to execute the current latest byte code.
2. The method of claim 1, wherein the real-time monitoring whether the source code content of the target application in the target source code library changes comprises:
monitoring whether a source code content change notice of the application program is received in real time; the source code content change notification of the application program is issued when the source code content of the application program in the target source code library changes, and is used for triggering execution of reading changed source code content of the target application program from the target source code library, and compiling the read changed source code content of the target application program into current latest byte codes in real time so as to execute the current latest byte codes.
3. The method according to claim 1, wherein after compiling the read source code content of the target application program after changing into the current latest byte code in real time, further comprising:
and replacing the byte code obtained by compiling previously with the current latest byte code.
4. The method of claim 1, wherein reading the source code content of the target application from a target source code library comprises:
reading a ciphertext of the source code content of the target application program from the target source code library;
and decrypting the read ciphertext of the source code content of the target application program to obtain the source code content of the target application program.
5. The method of claim 1, further comprising:
judging whether the currently read execution operation corresponding to the source code content of the target application program contains a preset limiting operation or not;
if the execution operation corresponding to the currently read source code content of the target application program does not contain the preset limit operation, determining that the currently read source code content of the target application program is allowed to be compiled;
and if the execution operation corresponding to the source code content of the target application program is judged to contain the preset limit operation, the currently read source code content of the target application program is limited to be compiled, and prompt information is fed back.
6. An apparatus for hot loading source code, comprising:
the device comprises a first loading unit, a second loading unit and a third loading unit, wherein the first loading unit is used for reading the source code content of a target application program from a target source code library when the target application program is started, and compiling the read source code content of the target application program into byte codes in real time so as to execute the compiled byte codes;
the monitoring unit is used for monitoring whether the source code content of the target application program in the target source code library changes in real time;
and the second loading unit is used for reading the changed source code content of the target application program from the target source code library and compiling the read changed source code content of the target application program into the current latest byte code in real time so as to execute the current latest byte code if the source code content of the target application program in the target source code library is monitored to be changed.
7. The apparatus of claim 6, wherein the monitoring unit comprises:
the monitoring subunit is used for monitoring whether a source code content change notification of the application program is received in real time; the source code content change notification of the application program is issued when the source code content of the application program in the target source code library changes, and is used for triggering execution of reading changed source code content of the target application program from the target source code library, and compiling the read changed source code content of the target application program into current latest byte codes in real time so as to execute the current latest byte codes.
8. The apparatus of claim 6, further comprising:
the judging unit is used for judging whether the execution operation corresponding to the currently read source code content of the target application program contains a preset limiting operation;
the determining unit is used for determining that the currently read source code content of the target application program is allowed to be compiled if the executing operation corresponding to the currently read source code content of the target application program does not contain a preset limiting operation;
and the limiting unit is used for limiting the compiling of the currently read source code content of the target application program and feeding back prompt information if the execution operation corresponding to the source code content of the target application program is judged to contain a preset limiting operation.
9. An electronic device, comprising:
a memory and a processor;
wherein the memory is used for storing programs;
the processor is configured to execute the program, which when executed is particularly configured to implement the method of hot loading source code as claimed in any one of claims 1 to 5.
10. A computer storage medium storing a computer program which, when executed, implements a method of hot loading source code as claimed in any one of claims 1 to 5.
CN202111113416.0A 2021-09-23 2021-09-23 Method and device for hot loading source code, electronic equipment and storage medium Pending CN113703820A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111113416.0A CN113703820A (en) 2021-09-23 2021-09-23 Method and device for hot loading source code, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111113416.0A CN113703820A (en) 2021-09-23 2021-09-23 Method and device for hot loading source code, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113703820A true CN113703820A (en) 2021-11-26

Family

ID=78661506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111113416.0A Pending CN113703820A (en) 2021-09-23 2021-09-23 Method and device for hot loading source code, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113703820A (en)

Similar Documents

Publication Publication Date Title
CN110032880B (en) Screen recording evidence obtaining method and system based on block chain and electronic equipment
CN110995825B (en) Intelligent contract issuing method, intelligent node equipment and storage medium
CN111143093A (en) Asynchronous message distributed processing method, device, equipment and storage medium
CN110619227A (en) Audit log management method, device, equipment and readable storage medium
CN112069468A (en) Method and equipment for dynamic watermarking of page
CN111680052A (en) Method and device for generating identity identification number
CN114297630A (en) Malicious data detection method and device, storage medium and processor
CN113703820A (en) Method and device for hot loading source code, electronic equipment and storage medium
CN112559565A (en) Abnormity detection method, system and device
CN115080309A (en) Data backup system, method, storage medium, and electronic device
CN115659045A (en) User operation identification method and device, storage medium and electronic equipment
CN105790975A (en) Service processing operation execution method and device
CN114510495B (en) Database service data consistency processing method and system
CN114661432A (en) Task scheduling method, device, equipment and storage medium
CN111736895A (en) Method, equipment and storage medium for merging and upgrading version numbers of software products
CN111045812A (en) Block chain intelligent contract reverse calling method, equipment and medium
CN117112047B (en) USB equipment management and control method, equipment and storage medium
CN112231757B (en) Privacy protection method, device and equipment for embedded application
CN113554498B (en) Processing method and device for user account request
CN111241116B (en) Data synchronization method and device based on big data and electronic equipment
CN111488282B (en) Service function processing method and device, electronic equipment and storage medium
CN113687973A (en) Method, device and medium for controlling dynamic output of logs
CN116451670A (en) Document data write-back method, device, equipment and medium
CN116755759A (en) Calling method, system and storage medium of multi-version intelligent contract
CN107515780B (en) Method for determining call relation between applications, method and device for generating call rule

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