CN114610381A - Method, device, equipment and storage medium for calling method service - Google Patents

Method, device, equipment and storage medium for calling method service Download PDF

Info

Publication number
CN114610381A
CN114610381A CN202210229403.8A CN202210229403A CN114610381A CN 114610381 A CN114610381 A CN 114610381A CN 202210229403 A CN202210229403 A CN 202210229403A CN 114610381 A CN114610381 A CN 114610381A
Authority
CN
China
Prior art keywords
class
interface class
interceptor
annotation
proxy
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
CN202210229403.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 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 CN202210229403.8A priority Critical patent/CN114610381A/en
Publication of CN114610381A publication Critical patent/CN114610381A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a method, a device, equipment and a storage medium for calling method services, wherein the method comprises the following steps: acquiring an interface class defined by a user, and acquiring a low-code platform annotation configured for the interface class; the low code platform annotations comprise annotations to method service configurations in the interface class, the method services comprising RPC services and/or local method services; receiving an access request of a client, and determining a target interface class corresponding to the access request; generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification; executing the proxy method by executing the method interceptor.

Description

Method, device, equipment and storage medium for calling method service
Technical Field
The present invention relates to a method service invoking technology, and in particular, to a method service invoking method, an apparatus, an electronic device, and a computer storage medium.
Background
At present, when a Java Web project is developed, in order to make the structure of a code clearer, readability stronger and project division more clear, developers can develop hierarchically, and the Java Web project can be generally divided into four layers according to responsibilities, namely a domain model layer, a database access layer, a business logic layer and a business layer. Each application layer has its own unique responsibilities and cannot mix its own functions with other layers. At the same time, each application layer should be isolated from the other layers, but allow communication between the layers using an interface. The most core is a business logic layer, which not only needs to process complex business logic, but also needs to process the call of remote process service and the call of local method service, so that the development of the business logic layer is more complex compared with other three levels, and the requirements on the realization complexity and quality of codes are higher.
However, when a business logic layer is developed, if a new function needs to be added, developers need to write a large amount of codes, and even if the added new function contains remote process services called in a project, the developers need to write a large amount of codes for assembly and debugging, so that the development efficiency is low. In addition, a plurality of developers are required to develop together in one project, but because the development habits of each developer are different, a uniform coding specification is lacked for a common method for calling the remote process service for packaging, so that the readability of codes is poor, and the development efficiency is also reduced. Therefore, how to reduce the complexity of developing a project and improve the development efficiency of the project is an urgent technical problem to be solved.
Disclosure of Invention
The embodiment of the invention provides a method and device for calling method services, electronic equipment and a computer storage medium.
The invention provides a method for calling method service, which comprises the following steps:
acquiring an interface class defined by a user, and acquiring a low-code platform annotation configured for the interface class; the low code platform annotations include annotations to method service configurations in the interface class, the method services including Remote Procedure Call (RPC) services and/or local method services;
receiving an access request of a client, and determining a target interface class corresponding to the access request;
generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification; executing the proxy method by executing the method interceptor.
In the above solution, the executing the proxy method by executing the method interceptor includes:
executing the method interceptor, and executing the proxy method under the condition of obtaining a result of calling the method service; terminating execution of the proxy method without a result of invoking the method service.
In the above solution, the low-code platform annotation configured for the interface class further includes at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
In the above solution, the method interceptor is further configured to invoke at least one of the following methods:
the method for scheduling the management thread of the low-code platform annotation identifier, the method for managing the log of the low-code platform annotation identifier and the method for managing the cache of the low-code platform annotation identifier.
In the above solution, the method interceptor for generating the dynamic agent class of the target interface class and associating the agent method of the dynamic agent class includes:
and generating a dynamic proxy class of the target interface class and a method interceptor associated with a proxy method of the dynamic proxy class based on a Code Generation Library (CGLIB).
The embodiment of the invention also provides a device for calling the method service, which at least comprises the following steps:
the acquisition module is used for acquiring an interface class defined by a user and acquiring a low-code platform annotation configured for the interface class; the low-code platform annotation comprises annotation configured for method services in the interface class, and the method services comprise RPC services and/or local method services;
the determining module is used for receiving an access request of a client and determining a target interface class corresponding to the access request;
the generation module is used for generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification;
and the execution module is used for executing the proxy method by executing the method interceptor.
In one implementation, the execution module is configured to execute the proxy method by executing the method interceptor; wherein, the first and the second end of the pipe are connected with each other,
the method interceptor is used for executing the proxy method under the condition of obtaining a result of calling the method service; terminating execution of the proxy method without a result of invoking the method service.
In one implementation, the low code platform annotation configured for the interface class further comprises at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
In one implementation, the method interceptor is further configured to invoke at least one of the following methods:
the method for scheduling the management thread of the low-code platform annotation identifier, the method for managing the log of the low-code platform annotation identifier and the method for managing the cache of the low-code platform annotation identifier.
In one implementation, the generating module is configured to generate a dynamic proxy class of the target interface class and a method interceptor associated with a proxy method of the dynamic proxy class; wherein the content of the first and second substances,
a method interceptor for generating a dynamic proxy class of the target interface class and a proxy method association of the dynamic proxy class based on CGLIB.
The embodiment of the invention also provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the program, the processor realizes the calling method of any one of the method services.
The embodiment of the invention also provides a computer storage medium, wherein a computer program is stored on the computer storage medium, and when being executed by a processor, the computer program realizes the calling method of any one of the above method services.
Based on the method, the device, the electronic equipment and the computer storage medium for calling the method service, the interface class defined by a user is obtained, and the low-code platform annotation configured for the interface class is obtained; the low code platform annotations comprise annotations to method service configurations in the interface class, the method services comprising RPC services and/or local method services; receiving an access request of a client, and determining a target interface class corresponding to the access request; generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification; executing the proxy method by executing the method interceptor.
It can be seen that the embodiment of the present invention configures a low-code platform annotation for an interface class, wherein the low-code platform annotation includes an annotation for method service configuration in the interface class, thereby implementing a uniform coding specification of a public method for encapsulating a calling method service, and improving readability of a code. And a dynamic agent class of a target interface class corresponding to the access request is generated, and a method interceptor associated with an agent method of the dynamic agent class calls a method service of the low code platform annotation identifier in the method interceptor, so that when the called method service needs to be added to the project, only the method service of the corresponding low code platform annotation identifier needs to be called in the method interceptor, thereby reducing the complexity of developing the project and improving the development efficiency of the project.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
Fig. 1 is a schematic flowchart of a method for invoking a method service according to an embodiment of the present invention;
fig. 2 is an application scenario diagram of a method for invoking a method service according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating an apparatus for invoking a method service according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical scheme of the embodiment of the disclosure is provided aiming at the problems of high complexity and irregular coding in the process of developing projects. The embodiments of the present invention will be described in further detail below with reference to the drawings and the embodiments. It should be understood that the examples provided herein are merely illustrative of the present invention and are not intended to limit the present invention. In addition, the following embodiments are provided as partial embodiments for implementing the present invention, not all embodiments for implementing the present invention, and the technical solutions described in the embodiments of the present invention may be implemented in any combination without conflict.
It should be noted that, in the embodiments of the present invention, the terms "comprises", "comprising" or any other variation thereof are intended to cover a non-exclusive inclusion, so that a method or apparatus including a series of elements includes not only the explicitly recited elements but also other elements not explicitly listed or inherent to the method or apparatus. Without further limitation, the use of the phrase "including a. -. said." does not exclude the presence of other elements (e.g., steps in a method or elements in a device, such as portions of circuitry, processors, programs, software, etc.) in the method or device in which the element is included.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
For example, the method for calling the method service provided by the embodiment of the present invention includes a series of steps, but the method for calling the method service provided by the embodiment of the present invention is not limited to the described steps, and similarly, the apparatus for calling the method service provided by the embodiment of the present invention includes a series of modules, but the apparatus for calling the method service provided by the embodiment of the present invention is not limited to include the explicitly described modules, and may also include modules that are required to be set for acquiring relevant information or performing processing based on the information.
Embodiments of the invention may be implemented on a terminal and/or a server, where the terminal may be a thin client, a thick client, a hand-held or laptop device, a microprocessor-based system, a set-top box, a programmable consumer electronics, a network personal computer, a small computer system, and so forth. The server may be a small computer system, a mainframe computer system, a distributed cloud computing environment including any of the systems described above, and so forth.
An electronic device such as a server may include program modules that execute computer instructions. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks. The computer system/server may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
Fig. 1 is a schematic flowchart of a method for invoking a method service according to an embodiment of the present invention, and as shown in fig. 1, the flow may include:
step 101: acquiring an interface class defined by a user, and acquiring a low-code platform annotation configured for the interface class; the low code platform annotation comprises an annotation to a method service configuration in the interface class, the method service comprising a remote procedure call service and/or a local method service; .
In the embodiment of the invention, the interface class defined by the user can be obtained from the initial memory space. Here, the initial memory space is a memory space requested by a Java Virtual Machine to an operating system, the Java Virtual Machine (JVM) is an abstract computer running all Java programs, and the JVM is an imaginary Machine implemented by software simulation on an actual computer. The JVM virtual machine has its own imaginable hardware such as processors, stacks, registers, etc., and has a corresponding instruction system.
In the embodiment of the invention, the interface class represents an abstract type in a Java programming language and is a set of abstract methods, namely a reference type for defining an agreement, and other types can inherit the abstract method of the interface class in a mode of inheriting the interface class, thereby realizing the concrete function of the method. It can be seen that all methods in the interface class are abstract methods, and therefore the interface class cannot be instantiated, i.e. the methods in the interface class cannot be implemented in the interface, but the methods in the interface class can be implemented by the class implementing the interface class.
In the embodiment of the present invention, the interface class is defined by a user, and is used for abstracting methods for implementing some specific functions into a set, and the interface class may include methods, attributes, indexers, and the like. The user-defined interface classes may be stored in the initial memory space.
In the embodiment of the invention, a Low-Code Development Platform (LCDP) represents a Development Platform which can quickly generate an application program without coding or by a small amount of codes, and allows an end user to develop the application program by using an easily understood visualization tool instead of a traditional Code writing mode. The functions required for constructing the business process, the logic, the data model and the like can be added with own codes if necessary.
In the embodiment of the invention, the low-code platform annotation is implemented based on a low-code platform, and is a special mark in the code, and the mark can be read during compiling, class loading and running and executes corresponding processing. The developer may embed supplemental information in the original code without changing the original code and logic by annotating the low code platform.
Illustratively, the low-code platform annotation may include @ lowcodelnterface, @ LowCodeQuery, @ Page, @ FloorProp, it should be noted that @ lowcodelnterface is used to identify an interface class, @ LowCodeQuery is used to identify an abstract method in the interface class, @ Page is used to identify a Page function in the interface class, and @ FloorProp is used to identify a floor function in the interface class. The low code platform annotation may be regarded as an extension to an interface class and/or method, each interface class and/or method annotates different parameters for the interface class and/or method according to the low code platform annotation, and the various parameters annotated in the interface class and/or method may be obtained at runtime.
In the embodiment of the invention, the defined low-code platform annotation is packaged and stored as a Java Archive File (JAR), the JAR File is an Archive File and is constructed in a ZIP format, JAR is used as a File extension name, and exemplarily, Lowcode. And further, sending the Lowcode.jar to a Maven warehouse, wherein the Maven warehouse is a service for centralized management of JAR files, so that the Lowcode.jar can be introduced into the project to realize low-code platform annotation for interface type configuration.
In the embodiment of the invention, the method service is a method body with specific functions, a user can realize the corresponding functions by calling the method service, and the method service comprises Remote Procedure Call (RPC) service and/or local method service. The RPC service is a service for sending a request from a remote computer program through a network, and the local method service is a service for sending a request through a local function, namely the service can be realized through a method stack and a parameter stack in the same address space or the same memory.
Step 102: receiving an access request of a client, and determining a target interface class corresponding to the access request.
In the embodiment of the invention, when an access request of a client is received, a Web application is started, wherein the Web application is used for processing the access request, the Web application is provided with an event listener, when the Web application receives the access request, the event listener is triggered to scan an interface class identified by a low-code platform annotation, a target interface class corresponding to the access request is determined, and what is needed to be described is that the interface class of a function corresponding to the access request is realized when the target interface class.
In some embodiments, a CoreService class is defined in a Web application, where the CoreService class is used to implement an ApplicationListener < contexthresholded event > interface class, where the ApplicationListener interface class is an event listener, and the application listener completes development of an event-driven model by listening to an event in the Web application and triggering a call back of the listener when the event occurs, and the method includes: loading data, initializing cache, registering specific tasks and the like; ContextRefresedEvent is used to indicate that an event is issued when the event is initialized or refreshed in a Web application.
In some embodiments, an ApplicationListener < contexthresheddevent > interface class has an applicationevent (e event) method, it being understood that a CoreService class may implement an applicationevent (e event) method. When an event in the Web application is issued, the instance of the CoreServer class calls an application event (E event) for processing an access request of a client, scanning an interface class identified by the annotation of the low-code platform and determining a target interface class corresponding to the access request.
Step 103: generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification.
In the embodiment of the invention, because the interface class can not be instantiated, the method in the interface class can not be realized in the interface, therefore, the method in the interface class can be realized by the example of the proxy class by providing the proxy class for the interface class.
In the embodiment of the invention, the dynamic proxy class is generated during the running of the code and inherits the proxy class of the target interface class, the dynamic proxy class also inherits the abstract method of the target interface class, the proxy method of the dynamic proxy class can be obtained, and the dynamic proxy class and the target interface class have a corresponding relation. After the dynamic proxy class is generated, a method interceptor associated with the proxy method of the dynamic proxy class is also generated.
In the embodiment of the invention, the method interceptor is used for intercepting before or after executing the proxy method of the dynamic proxy class and then executing some methods in the method interceptor. It can be seen that when some method services need to be added, only corresponding method interceptors need to be provided, and the method services of the low code platform annotation identifier need to be called in the method interceptors, and when some method services need to be deleted, only the settings of the corresponding method interceptors need to be cancelled.
In the embodiment of the present invention, at least one method interceptor may be provided, where each method interceptor is used to implement a corresponding function, and in actual development, a plurality of method interceptors are usually executed simultaneously before or after executing a proxy method of a dynamic proxy class.
Step 104: executing the proxy method by executing the method interceptor.
In the embodiment of the invention, interception is carried out before the agent method of the dynamic agent class is executed, and a method interceptor is executed, wherein the method interceptor is used for calling the method service of the annotation identifier of the low-code platform.
In some embodiments, the method interceptor is executed to execute the proxy method with the result of invoking the method service; terminating execution of the proxy method without a result of invoking the method service.
In the embodiment of the invention, under the condition that the method in the execution method interceptor is completed, namely the method service of the low code platform annotation mark can be called, the agent method of the dynamic agent class is continuously executed; and stopping executing the proxy method of the dynamic proxy class when the method in the execution method interceptor is not completed, namely the method service of the annotation identifier of the low-code platform cannot be called.
In practical applications, the steps 101 to 104 are implemented by a Processor based on an electronic Device, and the Processor may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor.
It can be seen that, in the embodiment of the present invention, by configuring a low-code platform annotation to an interface class, where the low-code platform annotation includes an annotation to a method service configuration in the interface class, a uniform coding specification of a common method for encapsulating a method service can be implemented, and readability of a code is improved. Meanwhile, by generating a dynamic proxy class of a target interface class and a method interceptor associated with the proxy method of the dynamic proxy class, executing the method interceptor before executing the proxy method, calling the method service of the low-code platform annotation identifier through the method interceptor, when some method services need to be added or deleted, only the corresponding interceptor needs to be configured or cancelled, and codes do not need to be rewritten, so that the complexity of developing a project is reduced, and the development efficiency of the project is improved.
In some embodiments, the low code platform annotation of the interface class configuration further comprises at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
In an embodiment of the present invention, the low-code platform annotation may further include at least one of: @ ThreadPoolBuilder, @ ApiLogger, @ Cacher, where @ ThreadPoolBuilder is used for identifying a method for scheduling management threads in interface classes, @ ApiLogger is used for identifying a method for managing logs in the interface classes, and @ Cacher is used for identifying a method for managing caches in the interface classes.
In some embodiments, the method interceptor is further configured to invoke at least one of the following methods:
the method for scheduling the management thread of the low-code platform annotation identifier, the method for managing the log of the low-code platform annotation identifier and the method for managing the cache of the low-code platform annotation identifier.
In the embodiment of the invention, the method interceptor can be used for calling a management thread scheduling method of the low-code platform annotation identification to form a method interceptor for managing thread scheduling; the method interceptor can be used for calling a method for managing the log of the low-code platform annotation identifier to form a method interceptor for managing the log; the method interceptor can be used for calling a method for managing the cache of the low-code platform annotation identifier to form the method interceptor for managing the cache.
In this embodiment of the present invention, after executing the agent method of the dynamic agent class, the method interceptor for managing thread scheduling, the method interceptor for managing logs, and the method interceptor for managing cache may be executed in the following steps: executing an agent method of a dynamic agent class, scheduling multithreading, logging, managing cache.
In some embodiments, the method interceptor generating the dynamic proxy class of the target interface class and the proxy method association of the dynamic proxy class includes:
and generating a dynamic proxy class of the target interface class and a method interceptor related to the proxy method of the dynamic proxy class based on the CGLIB.
In the embodiment of the invention, the CGLIB is a powerful and high-performance code generation library, and can be used for expanding Java classes and realizing Java interfaces.
In the embodiment of the invention, the method interceptor related to the dynamic proxy class of the target interface class and the proxy method of the dynamic proxy class can be generated based on the Enhancer class of the CGLIB, and the Enhancer class can proxy a non-interface class and also can proxy an interface class.
Fig. 2 is an application scenario diagram of a method for calling a method service according to an embodiment of the present invention, and as shown in fig. 2, the annotation of the low-code platform includes: the method comprises the following steps of annotation configured for an interface class, annotation configured for an abstract method of the interface class, annotation configured for a method service, annotation configured for a method for managing thread scheduling, annotation configured for a method for managing logs and annotation configured for a method for managing cache. The Web application comprises a configuration module and an agent module, wherein the configuration module is used for annotating a low-code platform configured for the interface class, and the agent module is used for generating a dynamic agent class of the interface class and a method interceptor related to an agent method of the dynamic agent class.
In the embodiment of the invention, the low-code platform annotation is packaged into a JAR file and sent to a Maven warehouse of a configuration module, and the JAR file is introduced into a project by a Web application, so that the low-code platform annotation configured for a defined interface class and the low-code platform annotation configured for public packaging of method services can be realized.
In the embodiment of the invention, when a client request is received, a Web application is started, a target interface class corresponding to an access request is determined, a dynamic proxy class of the target interface class and a method interceptor associated with a proxy method of the dynamic proxy class are generated, and the proxy method is executed through an execution method interceptor, wherein the method interceptor comprises the following steps: an interceptor for calling method services, a method interceptor for managing thread scheduling, a method interceptor for managing logs, and a method interceptor for managing caches.
Based on the same technical concept as the foregoing embodiment, referring to fig. 3, the method service invoking device provided in the embodiment of the present invention may include:
an obtaining module 301, configured to obtain an interface class defined by a user, and obtain a low-code platform annotation configured for the interface class; the low code platform annotations comprise annotations to method service configurations in the interface class, the method services comprising RPC services and/or local method services;
a determining module 302, configured to receive an access request from a client, and determine a target interface class corresponding to the access request;
a generating module 303, configured to generate a dynamic agent class of the target interface class and a method interceptor associated with an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification;
an executing module 304, configured to execute the proxy method by executing the method interceptor.
In one implementation, the execution module 304 is configured to execute the proxy method by executing the method interceptor; wherein, the first and the second end of the pipe are connected with each other,
the method interceptor is used for executing the proxy method under the condition of obtaining a result of calling the method service; terminating execution of the proxy method without a result of invoking the method service.
In one implementation, the low code platform annotation configured for the interface class further comprises at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
In one implementation, the method interceptor is further configured to invoke at least one of the following methods:
the method for scheduling the management thread of the low-code platform annotation identifier, the method for managing the log of the low-code platform annotation identifier and the method for managing the cache of the low-code platform annotation identifier.
In one implementation manner, the generating module 303 is configured to generate a dynamic proxy class of the target interface class and a method interceptor associated with a proxy method of the dynamic proxy class; wherein the content of the first and second substances,
a method interceptor for generating a dynamic proxy class of the target interface class and proxy method associations of the dynamic proxy class based on CGLIB.
In practical applications, the obtaining module 301, the determining module 302, the generating module 303, and the executing module 304 may all be implemented by a processor of an electronic device, where the processor may be at least one of an ASIC, a DSP, a DSPD, a PLD, an FPGA, a CPU, a controller, a microcontroller, and a microprocessor, and the embodiment of the present invention is not limited thereto.
It should be noted that the above description of the embodiment of the apparatus, similar to the above description of the embodiment of the method, has similar beneficial effects as the embodiment of the method. For technical details not disclosed in the embodiments of the apparatus of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
It should be noted that the above description of the embodiment of the apparatus, similar to the description of the embodiment of the method, has similar beneficial effects as the embodiment of the method. For technical details not disclosed in the embodiments of the apparatus of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
Correspondingly, the embodiment of the present invention further provides a computer program product, where the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the method for calling any one of the method services provided by the embodiment of the present invention.
Accordingly, an embodiment of the present invention further provides a computer storage medium, where computer-executable instructions are stored on the computer storage medium, and the computer-executable instructions are used to implement the method for invoking any one of the method services provided in the foregoing embodiments.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present invention may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Based on the same technical concept as the foregoing embodiment, referring to fig. 4, an electronic device 400 provided in an embodiment of the present invention may include: a memory 410 and a processor 420; wherein the content of the first and second substances,
a memory 410 for storing computer programs and data;
a processor 420 for executing the computer program stored in the memory to implement the calling method of any one of the method services in the foregoing embodiments.
The foregoing description of the various embodiments is intended to highlight various differences between the embodiments, and the same or similar components may be referred to one another, and for brevity, are not repeated herein.
The methods disclosed in the method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.
Features disclosed in various product embodiments provided by the application can be combined arbitrarily to obtain new product embodiments without conflict.
The features disclosed in the various method or apparatus embodiments provided herein may be combined in any combination to arrive at new method or apparatus embodiments without conflict.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, and for example, the division of the unit is only one logical function division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication between the components shown or discussed may be through some interfaces, and the indirect coupling or communication between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of grid units; some or all of the units can be selected according to actual conditions to achieve the purpose of the scheme of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one processing module, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.

Claims (10)

1. A method for invoking a method service, comprising:
acquiring an interface class defined by a user, and acquiring a low-code platform annotation configured for the interface class; the low code platform annotations comprise annotations to method service configurations in the interface class, the method services comprising remote procedure call services and/or local method services;
receiving an access request of a client, and determining a target interface class corresponding to the access request;
generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification;
executing the proxy method by executing the method interceptor.
2. The method of claim 1, wherein the executing the proxy method by executing the method interceptor comprises:
executing the method interceptor, and executing the proxy method under the condition of obtaining a result of calling the method service; terminating execution of the proxy method without a result of invoking the method service.
3. The method of claim 1, wherein the low code platform annotation of the interface class configuration further comprises at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
4. The method of claim 3, wherein the method interceptor is further configured to invoke at least one of the following methods:
the method for scheduling the management thread of the low-code platform annotation identifier, the method for managing the log of the low-code platform annotation identifier and the method for managing the cache of the low-code platform annotation identifier.
5. The method of claim 1, wherein the generating the dynamic proxy class of the target interface class and the method interceptor associated with the proxy method of the dynamic proxy class comprises:
and generating a dynamic proxy class of the target interface class and a method interceptor related to the proxy method of the dynamic proxy class based on a code generation library.
6. A method service invocation device, characterized in that said device comprises at least:
the acquisition module is used for acquiring an interface class defined by a user and acquiring a low-code platform annotation configured for the interface class; the low code platform annotations comprise annotations to method service configurations in the interface class, the method services comprising remote procedure call services and/or local method services;
the determining module is used for receiving an access request of a client and determining a target interface class corresponding to the access request;
the generation module is used for generating a dynamic agent class of the target interface class and a method interceptor related to an agent method of the dynamic agent class; the method interceptor is used for calling the method service of the low-code platform annotation identification;
and the execution module is used for executing the proxy method by executing the method interceptor.
7. The apparatus of claim 6, wherein the execution module is configured to execute the proxy method by executing the method interceptor; wherein the content of the first and second substances,
the method interceptor is used for executing the proxy method under the condition of obtaining a result of calling the method service; terminating execution of the proxy method without a result of invoking the method service.
8. The apparatus of claim 6, wherein the low code platform annotation of the interface class configuration further comprises at least one of:
annotation of method configuration for managing thread scheduling in the interface class, annotation of method configuration for managing logs in the interface class, and annotation of method configuration for managing caches in the interface class.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing a method of invoking a method service of any of claims 1-5 when executing the program.
10. A computer storage medium storing a computer program; characterized in that said computer program is capable of implementing a method for invoking a method service according to any of claims 1-5 when executed.
CN202210229403.8A 2022-03-10 2022-03-10 Method, device, equipment and storage medium for calling method service Pending CN114610381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210229403.8A CN114610381A (en) 2022-03-10 2022-03-10 Method, device, equipment and storage medium for calling method service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210229403.8A CN114610381A (en) 2022-03-10 2022-03-10 Method, device, equipment and storage medium for calling method service

Publications (1)

Publication Number Publication Date
CN114610381A true CN114610381A (en) 2022-06-10

Family

ID=81860913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210229403.8A Pending CN114610381A (en) 2022-03-10 2022-03-10 Method, device, equipment and storage medium for calling method service

Country Status (1)

Country Link
CN (1) CN114610381A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115658018A (en) * 2022-10-20 2023-01-31 广东云徙智能科技有限公司 Method, system, device and medium for expanding middle station logic

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115658018A (en) * 2022-10-20 2023-01-31 广东云徙智能科技有限公司 Method, system, device and medium for expanding middle station logic
CN115658018B (en) * 2022-10-20 2023-08-08 广东云徙智能科技有限公司 Middle-stage logic expansion method, system, device and medium

Similar Documents

Publication Publication Date Title
US7039923B2 (en) Class dependency graph-based class loading and reloading
US8635595B2 (en) Method and system for managing non-compliant objects
US7533388B1 (en) Method and apparatus for dynamic Stubs and Ties in RMI-IIOP
US20090300093A1 (en) Server computer
US6877163B1 (en) Method and system for dynamic proxy classes
US20030018950A1 (en) Dynamic redeploying environment for the rapid iterative development of software applications
US20090320045A1 (en) Server computer component
US20020178298A1 (en) Method and apparatus for fast, local CORBA object references
WO2007113539A1 (en) Interactive development tool and debugger for web services
US7770181B2 (en) System and method for transferring computer-readable objects across a remote boundary
US9135039B2 (en) Transferring objects between virtual machines
US11321090B2 (en) Serializing and/or deserializing programs with serializable state
US11537367B1 (en) Source code conversion from application program interface to policy document
US6951022B1 (en) Delegate-based event handling
US20080141219A1 (en) Multiple inheritance facility for java script language
US10873628B2 (en) System and method for non-intrusive context correlation across cloud services
CN114610381A (en) Method, device, equipment and storage medium for calling method service
CN108496157B (en) System and method for providing runtime trace using an extended interface
US20180081648A1 (en) Producing an internal representation of a type based on the type&#39;s source representation
US8196152B2 (en) Container context information propagation in an aspect-oriented environment
US12008353B2 (en) Parsing tool for optimizing code for deployment on a serverless platform
US20230083849A1 (en) Parsing tool for optimizing code for deployment on a serverless platform
Nykänen GDPR compliance: Creation of an automatic GDPR cleaning application
BAXTER A JAVASCRIPT PROGRAMMING MODEL FOR SERVERLESS COMPOSITIONS
CN115268985A (en) Mock method and device for RPC service and computer readable storage medium

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