CN110895468A - Method and device for realizing service enhancement - Google Patents

Method and device for realizing service enhancement Download PDF

Info

Publication number
CN110895468A
CN110895468A CN201810959384.8A CN201810959384A CN110895468A CN 110895468 A CN110895468 A CN 110895468A CN 201810959384 A CN201810959384 A CN 201810959384A CN 110895468 A CN110895468 A CN 110895468A
Authority
CN
China
Prior art keywords
jar
application server
enhancement
implementation
notification
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
CN201810959384.8A
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 Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke 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 Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810959384.8A priority Critical patent/CN110895468A/en
Publication of CN110895468A publication Critical patent/CN110895468A/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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The invention discloses a method and a device for realizing service enhancement, and relates to the technical field of computers. One embodiment of the method comprises: receiving a download notification from a monitoring server; downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement; and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement. The implementation scheme can dynamically replace the execution code to achieve the service enhancement function. The implementation method replaces the logic operation of the execution process under the condition of not interrupting or stopping the service, can be used for input and output checking or other function enhancement of online abnormal execution, reduces the risk of artificial errors caused by manually modifying codes, and avoids the complicated operation of repeatedly releasing business codes.

Description

Method and device for realizing service enhancement
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for implementing service enhancement.
Background
In the process of development and online product maintenance, the user often encounters some troublesome problems, for example, micro-services are more and more prevalent, one operation may invoke a service chain of a plurality of services, data exception occurs, and the like, and since the condition of input and output parameters of a service method cannot be seen, the confirmation and debugging of the abnormal position become very painful. At present, for similar scenes, a common solution is to implement service enhancement by stopping or interrupting service, modifying codes, adding new service logic into the codes, and putting the modified codes on line, that is, determining an exception, and when the exception is eliminated, the new service logic needs to be deleted or annotated, and at this time, the codes need to be modified again on line. Wherein, the enhancement (add) is to inject some logic codes into each program so as to enhance the function of the original program.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
because the exception is unpredictable, that is, where or which methods are abnormal cannot be determined, the code can only be repeatedly modified and repeatedly online after the exception occurs, and when the exception is eliminated, new business logic needs to be deleted or annotated, the code needs to be modified again online at this time, which is tedious in operation, time-consuming, prone to human errors, and high in risk.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for implementing service enhancement, which can dynamically replace an execution code to achieve a service enhancement function, that is, replace a logic operation in an execution process without interrupting or stopping a service, and can be used for input/output checking or other function enhancement performed abnormally on a line, thereby reducing a risk of human errors caused by manually modifying a code and avoiding a tedious operation of repeatedly releasing a service code.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for implementing service enhancement, including: receiving a download notification from a monitoring server; downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement; and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
Optionally, the jar packet further includes an interception rule; dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism to realize service enhancement, wherein the step of dynamically loading and instantiating the implementation class comprises the following steps: dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism; intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
Optionally, before invoking the implementation class in the jar package, the method further includes: determining that the execution switch is in an on state.
Optionally, the dynamic loading mechanism is a java reflection mechanism.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a method for implementing service enhancement, including: receiving a jar packet uploaded by a user, wherein the jar packet at least comprises an implementation class for implementing service enhancement; determining whether to send a download notification to an application server; and if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation classes in the jar package through a dynamic loading mechanism.
Optionally, before sending the download notification to the application server, the method further includes: determining that the execution switch is in an on state.
To achieve the above object, according to yet another aspect of the embodiments of the present invention, there is provided an apparatus for implementing service enhancement, including: a notification receiving module, configured to receive a download notification from the monitoring server; the download module is used for downloading a corresponding jar package according to the download notice, wherein the jar package at least comprises an implementation class for implementing service enhancement; and the service enhancement module is used for dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
Optionally, the jar packet further includes an interception rule; the service enhancement module is further configured to: dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism; intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
Optionally, the service enhancement module is further configured to: and determining that an execution switch is in an open state before calling the implementation class in the jar packet.
Optionally, the dynamic loading mechanism is a java reflection mechanism.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an apparatus for implementing service enhancement, including: the jar packet receiving module is used for receiving jar packets uploaded by users, and the jar packets at least comprise implementation classes for implementing service enhancement; the judging module is used for determining whether to send a downloading notification to the application server; and the notification sending module is used for sending a downloading notification to an application server so as to notify the application server of downloading and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism.
Optionally, the determining module is further configured to: and determining the state of an execution switch, and if the execution switch is in an on state, determining to send a download notification to the application server.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a system for implementing service enhancement, the system including a monitoring server and an application server; the monitoring server is used for receiving jar packets uploaded by users, and the jar packets at least comprise implementation classes for implementing service enhancement; determining whether to send a download notification to an application server; if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation class in the jar packet through a dynamic loading mechanism; the application server is used for downloading a corresponding jar packet according to a downloading notification from the monitoring server, wherein the jar packet at least comprises an implementation class for implementing service enhancement; and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
Optionally, the dynamically loading, by the application server, the implementation class in the jar package through a dynamic loading mechanism to implement service enhancement includes: dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism; intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
Optionally, an execution switch is further deployed on the monitoring server; the monitoring server is also used for determining that the execution switch is in an open state before sending a downloading notification to the application server; the application server is further used for determining that the execution switch is in an open state before calling the implementation class in the jar packet.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus including: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the method for implementing service enhancement according to the embodiment of the present invention.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a computer readable medium having a computer program stored thereon, the program, when executed by a processor, implementing the method of the embodiments of the present invention for implementing service enhancement.
One embodiment of the above invention has the following advantages or benefits: because the download notification from the monitoring server is received; downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement; the implementation classes in the jar package are dynamically loaded through a dynamic loading mechanism to realize a technical means of service enhancement, so that the execution codes can be dynamically replaced to achieve a service enhancement function, namely, the logic operation of the execution process is replaced under the condition of not interrupting or stopping service, the method can be used for input and output checking of online abnormal execution or other function enhancement to reduce the risk of artificial errors caused by manual code modification, and the complicated operation of repeatedly releasing the service codes is avoided.
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 for implementing service enhancement according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of a method for implementing service enhancement according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of a system for implementing service enhancements in accordance with an embodiment of the present invention;
fig. 4 is a schematic diagram of a main flow of a method for implementing service enhancement according to still another embodiment of the present invention;
fig. 5 is a schematic diagram of main modules of an apparatus for implementing service enhancement according to an embodiment of the present invention;
fig. 6 is a schematic diagram of main blocks of an apparatus for implementing service enhancement according to another embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present 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.
Fig. 1 is a schematic diagram of a main flow of a method for implementing service enhancement according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S101: receiving a download notification from a monitoring server;
step S102: downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement;
step S103: and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
Enhancement (advice) is the injection of some logic code into each program to enhance the functionality of the original program. The method for implementing service enhancement in this embodiment may be used in an application server of a service party to implement service enhancement functions of the application server, such as log recording, performance statistics, security control, transaction processing, exception handling, and the like.
For steps S101 and S102, the download notification from the listening server may include the upload time or version information (e.g., version number) of the jar package, and after receiving the download notification, the application server may download the jar package according to the upload time or version information.
A jar package (Java Archive) is a platform-independent file format that allows many files to be combined into one compressed file. A class is an abstract template that describes the behavior and state of a class of objects. An implementation class refers to a class that implements an interface, implementing all methods described within the interface. In this embodiment, the jar packet at least includes an implementation class for implementing the service enhancement, and the implementation class is logic for implementing the service enhancement.
The jar package also includes a custom interception rule that indicates a business method that needs to be enhanced. The service method to be enhanced (i.e. the target service method) can be determined according to the scene requirement, and then the interception rule is defined according to the service to be enhanced so as to intercept the target service method.
For step S103, service enhancement may be implemented according to the following procedure:
dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism;
intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
Instantiation refers to a process of creating an object with a class in object-oriented programming, and is generally called instantiation.
As a specific example, the dynamic loading mechanism is a java reflection mechanism. The java reflection mechanism is that in a running state, for any class, all attributes and methods of the class can be known; for any object, any method and attribute of the object can be called; this function of dynamically acquiring information and dynamically invoking object methods is referred to as the reflection mechanism of the java language.
Aspect Oriented Programming (AOP) refers to a technology for implementing unified maintenance of program functions through a pre-compilation mode and a run-time dynamic proxy. The connection point position in the target service method according to the enhancement can be classified into pre-enhancement (beforeaddress), post-enhancement (after turning address), surround enhancement (methodconnector), exception throw enhancement (thrasdvice), and introduction enhancement (introducer). In this embodiment, pre-enhancement and post-enhancement are adopted, that is, before and after execution of the intercepted service method, the implementation class in the jar packet is called to implement service enhancement.
The embodiment of the invention can dynamically replace the execution code to achieve the service enhancement function, namely, the logic operation of the replacement execution process can be used for the input and output check of the online abnormal execution or other function enhancement under the condition of not interrupting or stopping the service.
In an optional embodiment, before invoking the implementation class in the jar package, the method further includes: determining that the execution switch is in an on state. After intercepting the corresponding service method according to the interception rule, judging the state of the execution switch, if the execution switch is in an open state at the moment, namely, the service enhancement is required to be realized, calling the implementation class in the jar packet to realize the service enhancement, and if the execution switch is in a close state, namely, the service enhancement is not required to be realized, not calling the implementation class in the jar packet, and executing the service method according to a normal service flow. Therefore, the method for realizing the service enhancement of the embodiment of the invention does not need to repeatedly release a new version of service code to realize the service enhancement or cancel the service enhancement.
As a specific example, the execution switch may be a status flag or a flag bit, for example, when the status flag or the flag bit is 1, it indicates that the execution switch is in an on state; when the status flag or flag is 0, it indicates that the execution switch is in the off state. The execution switch is arranged on the monitoring server, and the staff can flexibly set the state of the execution switch according to the requirement.
Fig. 2 is a schematic diagram of a main flow of a method for implementing service enhancement according to an embodiment of the present invention, as shown in fig. 2, the method includes the following steps:
step S201: receiving a jar packet uploaded by a user, wherein the jar packet at least comprises an implementation class for implementing service enhancement;
step S202: determining whether to send a download notification to an application server;
step S203: and if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation classes in the jar package through a dynamic loading mechanism.
For step S202, it may be determined whether to send a download notification to the application server by:
and determining the state of an execution switch, and if the execution switch is in an on state, determining to send a download notification to the application server.
The state of the execution switch is determined before sending a download notification to the application server. And if the execution switch is in the on state, namely the application server needs to be informed of downloading the jar packet, sending a downloading notification to the application server, and if the execution switch is in the off state, namely the application server does not need to be informed of. The state of the execution switch can be flexibly set by a worker according to requirements. A man-machine interaction interface (or an operation management page) can be arranged on the monitoring server, and a worker can select to turn on or turn off the execution switch on the interface and also can select to send a download notification to which application servers.
The method for implementing service enhancement of the embodiment can be applied to the monitoring server. And after the monitoring server determines that the jar package is uploaded, determining whether a downloading notification should be sent to the application server, if so, sending the downloading notification to the application server to notify the application server of downloading the jar package. The download notification may include an upload time or version number of the new jar package, and the application server may download the new jar package according to the upload time or version number. The monitoring server can interact and communicate with the application server through MQ technology or TCP technology. MQ (Message Queue) is a communication mechanism across processes, and is used for upstream and downstream Message passing. TCP (Transmission Control Protocol) is a connection-oriented, reliable transport layer communication Protocol based on a byte stream. Different technologies may be used to implement communications to support different usage scenarios.
Fig. 3 is a schematic diagram of a system 300 for implementing service enhancement according to an embodiment of the present invention, and as shown in the figure, the system 300 includes a listening server 301 and an application server 302;
the monitoring server 301 is configured to receive a jar packet uploaded by a user, where the jar packet at least includes an implementation class for implementing service enhancement; determining whether to send a download notification to an application server; if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation class in the jar packet through a dynamic loading mechanism;
the application server 302 is configured to download a corresponding jar package according to a download notification from the monitoring server, where the jar package at least includes an implementation class for implementing service enhancement; and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
In this embodiment, the listening server can notify the application server of a new change and trigger the application server to download the changed jar package. In addition, the monitoring server can be used for controlling jar downloading, for example, 100 application servers may be deployed in practice, all the application servers or part of the application servers can be informed to download the changed jar packages through the monitoring server, developers are not required to upload jar packages to each application server, and batch processing scripts are not required to be written.
In an optional embodiment, the dynamically loading, by the application server, the implementation class in the jar package through a dynamic loading mechanism to implement service enhancement includes:
dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism;
intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
In an optional embodiment, an execution switch is further deployed on the monitoring server;
the monitoring server is also used for determining that the execution switch is in an open state before sending a downloading notification to the application server;
the application server is further used for determining that the execution switch is in an open state before calling the implementation class in the jar packet.
Fig. 4 is a flowchart illustrating a method for implementing service enhancement according to another embodiment of the present invention, as shown in the figure, the method includes:
1. the developer uploads the jar package (i.e., the execution jar in fig. 4). The jar package comprises a specific logic implementation of output or other enhanced services and an implementation class package of a calling interface;
2. after the developer finishes uploading, the execution switch is turned on, and the monitoring server informs the application server of downloading the jar package;
3. the application server requests to download the jar package;
4. after downloading, the application server loads and instantiates the implementation class in the jar package through a java reflection mechanism, replaces the implementation class reference of the current proxy class, and dynamically changes the implementation logic.
5. After the replacement is finished, returning the result to the monitoring server;
6. the monitoring server feeds back the result to the developer, and the result describes whether the dynamic updating is successful or not;
7. after the replacement is finished, the client of the application server initiates the service request again (the step belongs to the service request of the application side)
8. After the request reaches the application server, the application server intercepts the corresponding service method through the AOP technology according to an interception rule, and invokes a realization class (i.e. invokes a before interface) according to the downloaded and replaced jar packet before the service method is processed, i.e. invokes the logic processing of a developer to realize service enhancement;
9. executing normal business logic;
10. after the service is processed by the application server through the AOP technology, calling an implementation class (i.e. calling an after interface) according to the downloaded and replaced jar packet, i.e. calling the logic processing of a developer to realize service enhancement;
11. the application server returns a response to the client.
In steps 8-11 of the embodiment of the invention, an interception rule is configured (for example, the interception rule is customized by execution) through an AOP technology, an execution process of interception is handed to an agent class through an agent mode, the agent class holds a reference of an implementation class, and the implementation class is implemented in jar executed before and after the method is executed. Wherein, the implementation class implements two interfaces: a before interface and an after interface. The Interface (English: Interface) is an abstract type in JAVA programming language, and is a collection of abstract methods, and the Interface is usually declared by the Interface. A class inherits the interface and thus the abstraction method of the socket. An implementation class refers to a class that implements an interface, implementing all methods described within the interface. The proxy class is a proxy for a class, and the class is given to the proxy and is not directly called to a method of the class but is called by the proxy. The proxy mode comprises the following steps: a proxy object is provided for an object and access to the original object is controlled by the proxy object, i.e. the client does not directly manipulate the original object, but indirectly manipulates the original object through the proxy object. References generally refer to the act of operating on the address of something.
The method for realizing the service enhancement of the embodiment can dynamically replace the execution code to achieve the service enhancement function, and can be used for input and output checking of online abnormal execution or other function enhancement.
Fig. 5 is a schematic diagram of main modules of an apparatus 500 for implementing service enhancement according to an embodiment of the present invention, and as shown in fig. 5, the apparatus 500 includes:
a notification receiving module 501, configured to receive a download notification from a monitoring server;
a downloading module 502, configured to download a corresponding jar package according to the downloading notification, where the jar package at least includes an implementation class for implementing service enhancement;
and a service enhancement module 503, configured to dynamically load the implementation class in the jar package through a dynamic loading mechanism, so as to implement service enhancement.
Optionally, the jar packet further includes an interception rule;
the service enhancement module 503 is further configured to: dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism; intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
Optionally, the service enhancement module 503 is further configured to: and determining that an execution switch is in an open state before calling the implementation class in the jar packet.
Optionally, the dynamic loading mechanism is a java reflection mechanism.
Fig. 6 is a schematic diagram of main modules of an apparatus 600 for implementing service enhancement according to an embodiment of the present invention, and as shown in fig. 6, the apparatus 600 includes:
a jar packet receiving module 601, configured to receive a jar packet uploaded by a user, where the jar packet at least includes an implementation class for implementing service enhancement;
a determining module 602, configured to determine whether to send a download notification to an application server;
a notification sending module 603, configured to send a download notification to an application server, so as to notify the application server to download and dynamically load the implementation class in the jar package through a dynamic loading mechanism.
Optionally, the determining module 602 is further configured to: and determining the state of an execution switch, and if the execution switch is in an on state, determining to send a download notification to the application server.
The device can execute the method provided by the embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
Fig. 7 illustrates an exemplary system architecture 700 of a method for implementing service enhancements or an apparatus for implementing service enhancements to which embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like, may be installed on the terminal devices 701, 702, and 703.
The terminal devices 701, 702, 703 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 705 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 701, 702, and 703. The background 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 (e.g., target push information and product information) to the terminal device.
It should be noted that the method for implementing service enhancement provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus for implementing service enhancement is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 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. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 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 can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
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 sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not in some cases constitute a limitation on the unit itself, and for example, the sending module may also be described as a "module that sends 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:
receiving a download notification from a monitoring server;
downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement;
and dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism so as to realize service enhancement.
The technical scheme of the embodiment of the invention replaces the logic operation of the execution process under the condition of not interrupting or stopping the service, can be used for the input and output check or other function enhancement of the online abnormal execution, reduces the risk of artificial errors caused by manually modifying the codes, and avoids the complicated operation of repeatedly releasing the service codes.
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 (17)

1. A method for implementing service enhancements, comprising:
receiving a download notification from a monitoring server;
downloading a corresponding jar package according to the downloading notification, wherein the jar package at least comprises an implementation class for implementing service enhancement;
and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
2. The method of claim 1, wherein the jar package further comprises an intercept rule;
dynamically loading the implementation class in the jar package through a dynamic loading mechanism to realize service enhancement, wherein the implementation class comprises the following steps:
dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism;
intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
3. The method of claim 2, wherein prior to invoking the implementation class in the jar package, the method further comprises:
determining that the execution switch is in an on state.
4. A method according to any of claims 1-3, wherein the dynamic loading mechanism is a java reflection mechanism.
5. A method for implementing service enhancements, comprising:
receiving a jar packet uploaded by a user, wherein the jar packet at least comprises an implementation class for implementing service enhancement;
determining whether to send a download notification to an application server;
and if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation classes in the jar package through a dynamic loading mechanism.
6. The method of claim 5, wherein determining whether to send a download notification to an application server comprises:
and determining the state of an execution switch, and if the execution switch is in an on state, determining to send a download notification to the application server.
7. An apparatus for implementing service enhancements, comprising:
a notification receiving module, configured to receive a download notification from the monitoring server;
the download module is used for downloading a corresponding jar package according to the download notice, wherein the jar package at least comprises an implementation class for implementing service enhancement;
and the service enhancement module is used for dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
8. The apparatus of claim 7, wherein the jar package further comprises an intercept rule;
the service enhancement module is further configured to:
dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism;
intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
9. The apparatus of claim 8, wherein the traffic enhancement module is further configured to:
and determining that an execution switch is in an open state before calling the implementation class in the jar packet.
10. The apparatus as claimed in any one of claims 7-9, wherein the dynamic loading mechanism is a java reflection mechanism.
11. An apparatus for implementing service enhancements, comprising:
the jar packet receiving module is used for receiving jar packets uploaded by users, and the jar packets at least comprise implementation classes for implementing service enhancement;
the judging module is used for determining whether to send a downloading notification to the application server;
and the notification sending module is used for sending a downloading notification to an application server so as to notify the application server of downloading and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism.
12. The apparatus method of claim 11, wherein the determining module is further configured to: and determining the state of an execution switch, and if the execution switch is in an on state, determining to send a download notification to the application server.
13. A system for realizing service enhancement is characterized in that the system comprises a monitoring server and an application server;
the monitoring server is used for receiving jar packets uploaded by users, and the jar packets at least comprise implementation classes for implementing service enhancement; determining whether to send a download notification to an application server; if so, sending a downloading notification to an application server to notify the application server to download and dynamically load the implementation class in the jar packet through a dynamic loading mechanism;
the application server is used for downloading a corresponding jar packet according to a downloading notification from the monitoring server, wherein the jar packet at least comprises an implementation class for implementing service enhancement; and dynamically loading the implementation classes in the jar package through a dynamic loading mechanism so as to realize service enhancement.
14. The system of claim 13, wherein the application server dynamically loads the implementation classes in the jar package through a dynamic loading mechanism to implement service enhancement, comprising:
dynamically loading and instantiating the implementation class in the jar package through a dynamic loading mechanism;
intercepting corresponding business methods by a section-oriented programming method according to the interception rule, and calling the implementation classes in the jar packet respectively before and after the business methods are executed so as to realize business enhancement.
15. The system according to claim 14, wherein an execution switch is further disposed on the listening server;
the monitoring server is also used for determining that the execution switch is in an open state before sending a downloading notification to the application server;
the application server is further used for determining that the execution switch is in an open state before calling the implementation class in the jar packet.
16. An electronic device, 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-4.
17. 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-4.
CN201810959384.8A 2018-08-22 2018-08-22 Method and device for realizing service enhancement Pending CN110895468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810959384.8A CN110895468A (en) 2018-08-22 2018-08-22 Method and device for realizing service enhancement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810959384.8A CN110895468A (en) 2018-08-22 2018-08-22 Method and device for realizing service enhancement

Publications (1)

Publication Number Publication Date
CN110895468A true CN110895468A (en) 2020-03-20

Family

ID=69784773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810959384.8A Pending CN110895468A (en) 2018-08-22 2018-08-22 Method and device for realizing service enhancement

Country Status (1)

Country Link
CN (1) CN110895468A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181470A (en) * 2020-09-22 2021-01-05 京东数字科技控股股份有限公司 Method and device for deploying patch
CN114036017A (en) * 2021-10-25 2022-02-11 苏州臻璇数据信息技术有限公司 Reinforcing method and device based on tangent plane technology
CN114995983A (en) * 2022-07-11 2022-09-02 支付宝(杭州)信息技术有限公司 Method and device for acquiring data flow link
CN115190161A (en) * 2022-06-10 2022-10-14 北京京东振世信息技术有限公司 Method, apparatus, device and computer readable medium for processing item data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102622227A (en) * 2011-09-13 2012-08-01 北京科技大学 Component model supporting dynamic configuration, and component factory
CN102810057A (en) * 2011-05-30 2012-12-05 中国银联股份有限公司 Log recording method
EP2701061A1 (en) * 2012-08-24 2014-02-26 CA, Inc. Method of updating or rollbacking dynamically a Java Agent by instrumenting its bytecode
CN106066807A (en) * 2016-06-08 2016-11-02 北京光年无限科技有限公司 Method for updating OS and operating system towards intelligent robot
CN108196833A (en) * 2018-01-09 2018-06-22 武汉斗鱼网络科技有限公司 Implementation method, storage medium, electronic equipment and the system of AOP agent frameworks
CN108228208A (en) * 2016-12-22 2018-06-29 北京神州泰岳软件股份有限公司 A kind of dynamic updating method and device of JAVA application programs

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810057A (en) * 2011-05-30 2012-12-05 中国银联股份有限公司 Log recording method
CN102622227A (en) * 2011-09-13 2012-08-01 北京科技大学 Component model supporting dynamic configuration, and component factory
EP2701061A1 (en) * 2012-08-24 2014-02-26 CA, Inc. Method of updating or rollbacking dynamically a Java Agent by instrumenting its bytecode
CN106066807A (en) * 2016-06-08 2016-11-02 北京光年无限科技有限公司 Method for updating OS and operating system towards intelligent robot
CN108228208A (en) * 2016-12-22 2018-06-29 北京神州泰岳软件股份有限公司 A kind of dynamic updating method and device of JAVA application programs
CN108196833A (en) * 2018-01-09 2018-06-22 武汉斗鱼网络科技有限公司 Implementation method, storage medium, electronic equipment and the system of AOP agent frameworks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
沈凯;: "利用反射和动态代理机制实现面向切面的程序设计", 计算机时代, no. 11 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181470A (en) * 2020-09-22 2021-01-05 京东数字科技控股股份有限公司 Method and device for deploying patch
CN114036017A (en) * 2021-10-25 2022-02-11 苏州臻璇数据信息技术有限公司 Reinforcing method and device based on tangent plane technology
CN115190161A (en) * 2022-06-10 2022-10-14 北京京东振世信息技术有限公司 Method, apparatus, device and computer readable medium for processing item data
CN115190161B (en) * 2022-06-10 2024-04-05 北京京东振世信息技术有限公司 Method, apparatus, device and computer readable medium for processing article data
CN114995983A (en) * 2022-07-11 2022-09-02 支付宝(杭州)信息技术有限公司 Method and device for acquiring data flow link

Similar Documents

Publication Publication Date Title
CN110895468A (en) Method and device for realizing service enhancement
CN109995801B (en) Message transmission method and device
CN109918191B (en) Method and device for preventing frequency of service request
CN111400061A (en) Data processing method and system
US9471403B1 (en) Granular event management for service platforms
CN111427701A (en) Workflow engine system and business processing method
CN113517985B (en) File data processing method and device, electronic equipment and computer readable medium
CN111090423A (en) Webhook framework system and method for realizing active calling and event triggering
CN113595927A (en) Method and device for processing mirror flow in bypass mode
KR20220151585A (en) Business data processing method, apparatus, electronic apparatus, storage media and computer program
CN110928571A (en) Business program development method and device
CN110574006B (en) System and method for automatically synchronizing responses and conditions on a device
CN113472687A (en) Data processing method and device
CN110928706B (en) Applet interaction method and device, electronic equipment and storage medium
CN112764746B (en) Data processing method, device, electronic equipment and storage medium
CN113296829A (en) Method, device, equipment and computer readable medium for processing service
CN113779122B (en) Method and device for exporting data
CN114327404A (en) File processing method and device, electronic equipment and computer readable medium
CN113760487B (en) Service processing method and device
CN114666322A (en) Breakpoint resume method and device and electronic equipment
CN112241332B (en) Interface compensation method and device
CN113760693A (en) Method and apparatus for local debugging of microservice systems
CN113761433A (en) Service processing method and device
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN113132447A (en) Reverse proxy method and system

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