CN113253990A - Method, device, equipment and computer readable medium for updating software - Google Patents

Method, device, equipment and computer readable medium for updating software Download PDF

Info

Publication number
CN113253990A
CN113253990A CN202010090987.6A CN202010090987A CN113253990A CN 113253990 A CN113253990 A CN 113253990A CN 202010090987 A CN202010090987 A CN 202010090987A CN 113253990 A CN113253990 A CN 113253990A
Authority
CN
China
Prior art keywords
instrumentation
package
temporary
existing
updated
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
CN202010090987.6A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010090987.6A priority Critical patent/CN113253990A/en
Publication of CN113253990A publication Critical patent/CN113253990A/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method, a device, equipment and a computer readable medium for updating software, and relates to the technical field of computers. One embodiment of the method comprises: clearing an existing instrumentation service code, and closing a temporary instrumentation class loader for loading an existing instrumentation package, wherein the instrumentation package comprises the existing instrumentation service code; newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader; and implanting the instrumentation service code in the updated instrumentation package into target software through a reflection mechanism, and finishing the updating of the target software. The embodiment can realize software updating without software restarting.

Description

Method, device, equipment and computer readable medium for updating software
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer-readable medium for updating software.
Background
The bytecode instrumentation is a technology for realizing specific functions by inserting bytecode at a JAVA runtime or a compilation time. Specific application scenarios, such as: aspect Oriented Programming, monitoring, debugging (debug), security (security), and the like.
The bytecode instrumentation can achieve the purpose of enhancing the function without modifying the source code. It is from this that the key reason why bytecode instrumentation has become more and more widely used.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: in the case where software is involved in an application scenario that needs to be updated, the involved software needs to be restarted. Since the software itself cannot meet the restart requirement, the update cannot be completed.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a computer-readable medium for updating software, which can update software without restarting the software.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of updating software, including:
clearing the existing instrumentation service codes, and closing a temporary instrumentation class loader for loading existing instrumentation packages, wherein the instrumentation comprises the existing instrumentation service codes;
newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader;
and implanting the instrumentation service code in the updated instrumentation package into target software through a reflection mechanism, and finishing the updating of the target software.
The clearing of the existing instrumentation service code and the closing of the temporary instrumentation loader for loading the existing instrumentation package comprise the following steps:
and executing the pile inserting reduction action on the existing pile inserting package to clear the existing pile inserting service codes, and closing the temporary pile inserting type loader for loading the existing pile inserting package.
After the temporary pile-inserting type loader for loading the existing pile-inserting bags is closed, the method further comprises the following steps:
and informing a Java virtual machine, recovering the existing instrumentation package, and loading a temporary instrumentation class loader of the existing instrumentation package, wherein the instrumentation package comprises an instrumentation jar package.
Newly-built interim stake class loader, newly-built interim stake class loader loads and updates the stake package, includes:
newly building a temporary pile inserting type loader;
and loading the updated pile inserting package to the newly-built temporary pile inserting type loader so as to enable the newly-built temporary pile inserting type loader to load the updated pile inserting package.
The step of implanting the instrumentation service code in the updated instrumentation package into the target software through a reflection mechanism comprises the following steps:
and calling the attribute and the method of the class to which the instrumentation service code in the updated instrumentation package belongs through a reflection mechanism, and implanting the instrumentation service code in the updated instrumentation package into target software.
The target software comprises target software of a server side or target software of an android system client side.
The target software comprises sub-threads subordinate to the main thread.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for updating software, including:
the clearing module is used for clearing the existing instrumentation service codes and closing the temporary instrumentation loader for loading the existing instrumentation packages, and the instrumentation comprises the existing instrumentation service codes;
the new building module is used for building a new temporary pile inserting type loader, and the new temporary pile inserting type loader loads an updated pile inserting package;
and the updating module is used for implanting the instrumentation business code in the updated instrumentation package into target software through a reflection mechanism, and the target software completes updating.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for updating software, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method as described above.
One embodiment of the above invention has the following advantages or benefits: clearing the existing pile inserting service codes, and closing a temporary pile inserting type loader for loading an existing pile inserting package, wherein the pile inserting package comprises the existing pile inserting service codes; newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader; and (4) implanting the instrumentation service code in the updated instrumentation package into the target software through a reflection mechanism, and finishing the updating of the target software. The target software is implanted by utilizing the instrumentation service code of the updated instrumentation package in the temporary instrumentation class loader, so that the software can be updated without restarting the software.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of updating software according to an embodiment of the invention;
FIG. 2 is a flow diagram illustrating loading of an updated instrumented jar package according to an embodiment of the invention;
FIG. 3 is a flow chart illustrating a method for updating software according to an embodiment of the present invention;
fig. 4 is a schematic diagram of the main structure of an apparatus for updating software according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Generally, to implement the business functions of code instrumentation, the target software package and the instrumentation package are developed separately. Illustratively, the instrumented package may be an instrumented jar package. jar file is a JAVA package file format that is commonly used to aggregate bytecode files, associated metadata, and resource files into one file.
The pile inserting jar package is divided into two parts. One part is as follows: the instrumentation frame package is realized by having instrumentation capability and bytecode editing capability, and the instrumentation frame can be a java agent mode or a jvmti native agent mode. The other part is that: and (3) instrumentation service codes to be implanted into the target software are needed, wherein the instrumentation service codes can be instrumentation service code jar packages.
Typically, a instrumentation framework package adds the instrumentation framework package to the system class loader (classloader) path of a Java Virtual Machine (JVM) through the agenlib or agentpath parameters of the JVM. The instrumentation service code is added to the system classloader of the JVM or the path of the application classloader of the target software at the latest before the instrumentation action is completed. Only then can the inserted bytecode be successfully recognized by the JVM and loaded for execution.
If a instrumented package needs to be updated, it cannot be cleared from a single instrumented package due to the characteristics of the JVM System classloader. The only way is to restart the target software and then restart the instrumentation using the updated instrumentation package.
However, in a scenario where the instrumentation service code needs to be updated frequently and the target software cannot be restarted, the above method for updating the target software is no longer applicable.
In order to solve the problem that the target software is updated under the condition that the target software cannot be restarted, the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 1, fig. 1 is a schematic diagram of a main flow of a method for updating software according to an embodiment of the present invention, an update instrumentation package is loaded in a temporary instrumentation class loader, and instrumentation service codes of the update instrumentation package are embedded into target software through a reflection mechanism. As shown in fig. 1, the method specifically comprises the following steps:
s101, removing the existing instrumentation service codes, and closing the temporary instrumentation type loader for loading the existing instrumentation packages, wherein the instrumentation packages comprise the existing instrumentation service codes.
The instrumentation service code needs to be added into a system classloader of the JVM or a path of an application classloader of the target software, and then the instrumentation service code can be identified by the JVM and loaded for operation. Limited by the characteristics of classloaders, a single packet cannot be cleared when the instrumentation service code is updated.
In order to update the instrumentation package without restarting the target program, the instrumentation package is updated in a hot mode. It is desirable to remove existing instrumentation service codes and existing instrumentation packages from the JVM and introduce new instrumentation service codes and new instrumentation packages into the JVM prior to a hot update.
In order to achieve the above object, in the process of pile insertion, a pile insertion package is not directly added to a system pile insertion type loader or an application pile insertion type loader, and a pile insertion package may be loaded in a temporary pile insertion type loader, where the pile insertion includes a pile insertion service code.
The temporary pile inserting type loader is a newly-built temporary pile inserting type loader during pile inserting each time. That is, the temporary stake-type loader is a temporary existing stake-type loader. And then, loading the instrumentation service code of the current time into a temporary instrumentation class loader.
In the following technical solutions of the embodiments of the present invention, an example is given by taking an instrumented packet, specifically an instrumented jar packet.
In the process of updating the software, the software needs to be updated through the update instrumentation jar package. Then, the existing instrumentation service code needs to be cleared, and then the temporary instrumentation class loader that loads the existing instrumentation jar package is closed.
Specifically, the instrumentation reduction action is executed on the existing instrumentation jar packet to clear the existing instrumentation service code. And if the existing instrumentation jar needs to be updated, executing instrumentation recovery action on the existing instrumentation jar packet, so that the existing instrumentation service codes in the instrumentation jar can be cleared out of execution logic. And then, closing the temporary instrumentation type loader for loading the existing instrumentation jar packages. In this way, existing instrumented jar packages are cleared.
In an embodiment of the present invention, to avoid that the temporary instrumentation class loader and the existing instrumentation jar packet are stored in the memory for a long time, which wastes memory resources. After the temporary instrumentation class loader loaded with the existing instrumentation jar packages is closed, the JVM is informed to recover the existing instrumentation jar packages and load the temporary instrumentation class loader loaded with the existing instrumentation jar packages to release the memory if the temporary instrumentation class loader loaded with the existing instrumentation jar packages and the existing instrumentation jar packages are not used any more.
S102, a new temporary pile inserting type loader is built, and the new temporary pile inserting type loader is used for loading an updated pile inserting package.
The purpose of clearing the existing instrumentation service codes and closing the temporary instrumentation class loader for loading the existing instrumentation jar packages is as follows: and loading the new instrumentation service code. Then, a new temporary instrumentation class loader needs to be built, and the new temporary instrumentation class loader loads the updated instrumentation jar package.
Referring to fig. 2, fig. 2 is a schematic flow chart of loading an update instrumentation jar package according to an embodiment of the present invention, which specifically includes:
s201, newly building a temporary pile inserting loader.
The JVM cannot directly execute java code, nor can it directly execute class files, and the JVM can only execute the instruction code stored in the class files. Therefore, it is necessary to load jar packages in the temporary instrumented class loader.
And newly building a temporary instrumentation class loader, wherein the temporary instrumentation class loader is temporarily built and can be deleted in the process of updating the software next time.
S202, loading the updated instrumentation jar package to a newly-built temporary instrumentation loader so that the newly-built temporary instrumentation loader loads the updated instrumentation jar package.
In order to ensure that the JVM can smoothly execute instrumentation, the updated instrumentation jar package needs to be loaded to the newly-built temporary instrumentation loader, so that the newly-built temporary instrumentation loader loads the updated instrumentation jar package.
In the embodiment of fig. 2, after the new temporary instrumentation class loader is created, the updated instrumentation jar package may be loaded to the new temporary instrumentation class loader, thereby ensuring that the JVM smoothly performs instrumentation.
S103, implanting the instrumentation business code in the updated instrumentation package into the target software through a reflection mechanism, and finishing the updating of the target software.
The reflection mechanism is specifically referred to as JAVA reflection mechanism. The JAVA reflection mechanism is that in a running state, all attributes and methods of any class can be acquired; any object can call any attribute and method thereof; this kind of dynamic acquisition class information and dynamic call object content is called a reflection mechanism of JAVA language.
And (4) by a reflection mechanism, the instrumentation business code in the updated instrumentation jar package can be implanted into the target software, so that the target software is updated.
Specifically, the attributes and the methods of the classes to which the instrumentation service codes in the updated instrumentation jar package belong are called through a reflection mechanism, and the instrumentation service codes in the updated instrumentation jar package are implanted into target software.
And through a reflection mechanism, the attribute and the method of the class to which the instrumentation business code in the instrumentation jar package belongs can be called and updated. After the attributes and the methods of the classes to which the instrumentation service codes in the updated instrumentation jar package belong are obtained, the instrumentation service codes in the updated instrumentation jar package can be implanted into target software. In this way, the embedded instrumentation service code can be easily recognized and loaded for execution by the JVM.
In an embodiment of the present invention, after the instrumentation process is completed by updating the instrumentation jar package, the instrumentation service code in the updated instrumentation jar package, the newly-built temporary instrumentation class loader, and the updated instrumentation jar package may be introduced into the JVM to complete the update of the target software.
In the embodiment of the present invention, the target software is software that needs to be updated. Illustratively, the target software comprises target software of a server side or target software of an android system client side. As an example, a plurality of pieces of software are installed on the server side, the software is edited in JAVA language, and the software needing to be updated can be used as target software. As another example, a plurality of pieces of software are installed on the android system client, and the software that needs to be updated can be used as the target software. It can be understood that the technical scheme in the embodiment of the invention is not only suitable for the server side, but also suitable for the client side provided with the android system.
A plurality of threads are operated at the server end, and the main thread belongs to one or more sub-threads. As an example, one child thread may be responsible for monitoring; another child thread may be responsible for security. Under the condition that the sub-thread needs to be updated, the main thread cannot be restarted, and the normal operation of the main thread is influenced. Therefore, the sub-thread subordinate to the main thread is used as the target software, and the target software is updated by adopting the technical scheme in the embodiment of the invention.
In the embodiment, the existing instrumentation service codes are cleared, the temporary instrumentation class loader for loading the existing instrumentation jar packages is closed, and the instrumentation jar comprises the existing instrumentation service codes; newly building a temporary pile inserting type loader, and loading an updated pile inserting jar package by the newly built temporary pile inserting type loader; and (4) implanting the instrumentation business code in the updated instrumentation jar package into the target software through a reflection mechanism, and finishing the updating of the target software. The target software is implanted by using the instrumentation business code of the instrumentation jar package updated in the temporary instrumentation class loader, so that the software can be updated without restarting the software.
The following description will exemplarily describe updating the sub-thread subordinate to the main thread. Referring to fig. 3, fig. 3 is a schematic flowchart of a method for updating software according to an embodiment of the present invention, which specifically includes:
s301, starting hot updating.
In the embodiment of the present invention, the process of updating software is referred to as a warm boot. That is, in order to update the instrumentation jar package without restarting software, the technical solution in the embodiment of the present invention may be adopted. As one example, hot update start may be triggered manually; or triggering the hot update to start in order to meet the preset condition.
After the hot update is started, if no instrumentation business code is implanted in the sub-thread of the target software, a new temporary instrumentation loader can be built, and the new temporary instrumentation loader loads instrumentation jar packages.
S302, clearing the existing instrumentation business code.
Before, a temporary instrumentation class loader is used for implanting instrumentation service codes in a sub-thread, but due to the need of updating target software, instrumentation recovery actions are executed on existing instrumentation jar packages so as to eliminate the existing instrumentation service codes in the sub-thread.
And S303, closing the temporary pile inserting type loader.
And after removing the existing instrumentation service codes in the sub-threads, closing the temporary instrumentation loader for loading the existing instrumentation jar packages.
S304, newly building a temporary instrumentation loader, and loading an updated instrumentation jar package.
The method comprises the following steps of clearing the existing pile inserting service codes of the sub-threads, and closing the temporary pile inserting type loader for loading the existing pile inserting jar packages, and aims to: and loading the new instrumentation service code.
Then, a new temporary instrumentation class loader is built, and the new temporary instrumentation class loader loads the updated instrumentation jar package.
S305, implanting the instrumentation business code in the updated instrumentation jar package into target software.
And (4) by a reflection mechanism, the instrumentation business code in the updated instrumentation jar package can be implanted into the sub-thread.
And S306, finishing hot updating.
And after the pile inserting service codes in the updated pile inserting jar package are implanted into the sub-thread, the sub-thread completes hot updating.
Referring to table 1, table 1 is a table comparing a conventional method with an embodiment of the present invention.
TABLE 1
Figure BDA0002383713670000091
In table 1, for convenience of description, the contents that will need to be implemented in JAVA bytecode are unified, described using JAVA pseudo code. Jar, and the code fragment needing to be inserted into the target software is Runnable Foo ═ new Foo (); run () by foo.
As can be seen from table 1, in the existing method, an instrumentation jar package is added into a system instrumentation class loader or an application instrumentation class loader, and the target software needs to be restarted before being updated.
According to the method provided by the embodiment of the invention, the pile inserting jar packet is not directly added into the system loader or the application loader during pile inserting, but a temporary pile inserting loader is newly built every time pile inserting is carried out. And the newly-built temporary pile-inserting type loader is used for loading the pile-inserting jar packages. Then, the instrumentation service code in the updated instrumentation jar package is implanted into the target software through a reflection mechanism instead of directly implanting the instrumentation service code into the target program, so as to complete the updating.
The instrumentation service code is isolated from the class loader of the target software, but can be normally identified and executed, and can be conveniently unloaded so as to support the hot update of the target software.
Referring to fig. 4, fig. 4 is a schematic diagram of a main structure of an apparatus for updating software according to an embodiment of the present invention, where the apparatus for updating software may implement a method for updating software, and as shown in fig. 4, the apparatus for updating software specifically includes:
and the clearing module 401 is configured to clear the existing instrumentation service code, and close the temporary instrumentation class loader that loads the existing instrumentation package, where the instrumentation package includes the existing instrumentation service code.
And a new building module 402, configured to build a new temporary instrumentation class loader, where the new temporary instrumentation class loader loads the updated instrumentation package.
And the updating module 403 is configured to implant the instrumentation service code in the updated instrumentation package into the target software through a reflection mechanism, so that the target software completes updating.
In an embodiment of the present invention, the clearing module 401 is specifically configured to perform an instrumentation reduction action on an existing instrumentation package to clear an existing instrumentation service code and close a temporary instrumentation class loader that loads the existing instrumentation package.
In an embodiment of the present invention, the clearing module 401 is further configured to notify the JAVA virtual machine, reclaim an existing instrumentation packet, and load a temporary instrumentation class loader of the existing instrumentation packet, where the instrumentation packet includes an instrumentation jar packet.
In an embodiment of the present invention, the new building module 402 is specifically configured to build a new temporary instrumentation loader;
and loading the updated pile inserting package to the newly-built temporary pile inserting type loader so as to enable the newly-built temporary pile inserting type loader to load the updated pile inserting package.
In an embodiment of the present invention, the updating module 403 is specifically configured to invoke, through a reflection mechanism, an attribute and a method of a class to which an instrumentation service code in an updated instrumentation package belongs, and implant the instrumentation service code in the updated instrumentation package into the target software.
In one embodiment of the invention, the target software comprises target software of a server side or target software of an android system client side.
In one embodiment of the invention, the target software includes child threads that are subordinate to the main thread.
Fig. 5 illustrates an exemplary system architecture 500 to which the method of updating software or the apparatus for updating software of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for updating software provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the apparatus for updating software is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a transmitting unit, an obtaining unit, a determining unit, and a first processing unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, the sending unit may also be described as a "unit sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
clearing an existing instrumentation service code, and closing a temporary instrumentation class loader for loading an existing instrumentation package, wherein the instrumentation package comprises the existing instrumentation service code;
newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader;
and implanting the instrumentation service code in the updated instrumentation package into target software through a reflection mechanism, and finishing the updating of the target software.
According to the technical scheme of the embodiment of the invention, the existing instrumentation service code is eliminated, the temporary instrumentation loader for loading the existing instrumentation package is closed, and instrumentation comprises the existing instrumentation service code; newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader; and (4) implanting the instrumentation service code in the updated instrumentation package into the target software through a reflection mechanism, and finishing the updating of the target software. The target software is implanted by utilizing the instrumentation service code of the updated instrumentation package in the temporary instrumentation class loader, so that the software can be updated without restarting the software.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of updating software, comprising:
clearing an existing instrumentation service code, and closing a temporary instrumentation class loader for loading an existing instrumentation package, wherein the instrumentation package comprises the existing instrumentation service code;
newly building a temporary pile inserting type loader, and loading an updated pile inserting package by the newly built temporary pile inserting type loader;
and implanting the instrumentation service code in the updated instrumentation package into target software through a reflection mechanism, and finishing the updating of the target software.
2. The method for updating software according to claim 1, wherein said clearing the existing instrumentation traffic code and closing the temporary instrumentation class loader that loads the existing instrumentation package comprises:
and executing the pile inserting reduction action on the existing pile inserting package to clear the existing pile inserting service codes, and closing the temporary pile inserting type loader for loading the existing pile inserting package.
3. The method for updating software according to claim 1, wherein after closing the temporary instrumentation class loader that loads existing instrumentation packages, further comprising:
notifying a JAVA virtual machine, recovering the existing instrumentation package, and loading a temporary instrumentation class loader of the existing instrumentation package, wherein the instrumentation package comprises an instrumentation jar package.
4. The method for updating software according to claim 1, wherein the creating of the temporary instrumentation class loader, the creating of the temporary instrumentation class loader loading the updated instrumentation package, comprises:
newly building a temporary pile inserting type loader;
and loading the updated pile inserting package to the newly-built temporary pile inserting type loader so as to enable the newly-built temporary pile inserting type loader to load the updated pile inserting package.
5. The method for updating software according to claim 1, wherein said implanting instrumentation service codes in said update instrumentation package into target software through a reflection mechanism comprises:
and calling the attribute and the method of the class to which the instrumentation service code in the updated instrumentation package belongs through a reflection mechanism, and implanting the instrumentation service code in the updated instrumentation package into target software.
6. The method for updating software according to claim 1, wherein the target software comprises target software of a server side or target software of an android system client.
7. The method of updating software of claim 1 wherein the target software comprises a child thread subordinate to a main thread.
8. An apparatus for updating software, comprising:
the clearing module is used for clearing the existing instrumentation service codes and closing the temporary instrumentation loader for loading the existing instrumentation packages, and the instrumentation packages comprise the existing instrumentation service codes;
the new building module is used for building a new temporary pile inserting type loader, and the new temporary pile inserting type loader loads an updated pile inserting package;
and the updating module is used for implanting the instrumentation business code in the updated instrumentation package into target software through a reflection mechanism, and the target software completes updating.
9. An electronic device for updating software, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202010090987.6A 2020-02-13 2020-02-13 Method, device, equipment and computer readable medium for updating software Pending CN113253990A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010090987.6A CN113253990A (en) 2020-02-13 2020-02-13 Method, device, equipment and computer readable medium for updating software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010090987.6A CN113253990A (en) 2020-02-13 2020-02-13 Method, device, equipment and computer readable medium for updating software

Publications (1)

Publication Number Publication Date
CN113253990A true CN113253990A (en) 2021-08-13

Family

ID=77219865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010090987.6A Pending CN113253990A (en) 2020-02-13 2020-02-13 Method, device, equipment and computer readable medium for updating software

Country Status (1)

Country Link
CN (1) CN113253990A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411506A (en) * 2011-07-07 2012-04-11 杭州典能科技有限公司 Java-system business-unit plug-in type managing system and dynamic business-function changing method
CN104239054A (en) * 2014-09-12 2014-12-24 广州市久邦数码科技有限公司 Android-system-based plug-in loading method and system
CN108334374A (en) * 2017-01-18 2018-07-27 北京京东尚科信息技术有限公司 The method and apparatus of component dynamic load and execution
US20180321953A1 (en) * 2017-05-04 2018-11-08 Dell Products L.P. Method and system for dynamic loading of incremental changes of software
CN110716720A (en) * 2018-07-12 2020-01-21 北京京东尚科信息技术有限公司 Method and device for realizing application hot deployment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411506A (en) * 2011-07-07 2012-04-11 杭州典能科技有限公司 Java-system business-unit plug-in type managing system and dynamic business-function changing method
CN104239054A (en) * 2014-09-12 2014-12-24 广州市久邦数码科技有限公司 Android-system-based plug-in loading method and system
CN108334374A (en) * 2017-01-18 2018-07-27 北京京东尚科信息技术有限公司 The method and apparatus of component dynamic load and execution
US20180321953A1 (en) * 2017-05-04 2018-11-08 Dell Products L.P. Method and system for dynamic loading of incremental changes of software
CN110716720A (en) * 2018-07-12 2020-01-21 北京京东尚科信息技术有限公司 Method and device for realizing application hot deployment

Similar Documents

Publication Publication Date Title
US9253265B2 (en) Hot pluggable extensions for access management system
CN109308241B (en) Method and device for monitoring starting process of application program, terminal equipment and storage medium
CN110389786B (en) Kernel management method, electronic device and computer-readable storage medium
US7216344B2 (en) Side-by-side drivers
CN106886422A (en) Method for upgrading software and device, electronic equipment
CN110716720A (en) Method and device for realizing application hot deployment
CN111240766B (en) Application starting method and device, electronic equipment and computer readable storage medium
CN110704131B (en) Method and device for calling native application by HTML5 application
CN110895468A (en) Method and device for realizing service enhancement
CN110928571A (en) Business program development method and device
CN108845864B (en) Spring frame-based JVM garbage recycling method and device
CN112835639B (en) Hook realization method, device, equipment, medium and product
CN109683992B (en) Method and apparatus for managing objects
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN112529711B (en) Transaction processing method and device based on block chain virtual machine multiplexing
CN113253990A (en) Method, device, equipment and computer readable medium for updating software
CN112181470B (en) Patch deployment method and device
EP3872630A2 (en) Request processing method and apparatus, electronic device, and computer storage medium
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
CN110609731A (en) Method, apparatus and computer program product for managing virtual machines
CN111142972B (en) Method, apparatus, system, and medium for extending functions of application program
CN110389791B (en) Component scheduling method, device, equipment and storage medium
CN113296829A (en) Method, device, equipment and computer readable medium for processing service
CN113779451A (en) Page loading method and device
CN112379973A (en) Heavy loading method and device

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