CN117785511A - Method and device for processing functional data, storage medium and electronic equipment - Google Patents

Method and device for processing functional data, storage medium and electronic equipment Download PDF

Info

Publication number
CN117785511A
CN117785511A CN202311810438.1A CN202311810438A CN117785511A CN 117785511 A CN117785511 A CN 117785511A CN 202311810438 A CN202311810438 A CN 202311810438A CN 117785511 A CN117785511 A CN 117785511A
Authority
CN
China
Prior art keywords
function
calling
service provider
target
class
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
CN202311810438.1A
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.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp 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 China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202311810438.1A priority Critical patent/CN117785511A/en
Publication of CN117785511A publication Critical patent/CN117785511A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The disclosure provides a method, a device, electronic equipment and a storage medium for processing functional data, and relates to the technical field of computers. The method is applied to the service provider in the remote calling process, and comprises the following steps: acquiring function realization data of a function to be added; processing the function realization data by utilizing a byte code editing library, and dynamically creating a function object of the function to be added; the functional object is loaded into the service provider's operating environment. The method can utilize the byte code editing library to realize the dynamic increase of the capability of the service provider in the remote calling process, dynamically inject the capability which the service provider wants to increase into the running environment, enable the service provider to update the capability of the service provider on line, improve the efficiency of capability update, ensure the high availability of the service and avoid the problem of low availability caused by stopping service update.

Description

Method and device for processing functional data, storage medium and electronic equipment
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a method and device for processing functional data, a storage medium and electronic equipment.
Background
With the development of computer technology and network technology, micro service technology and remote call technology are increasingly used. In the context of a micro-service production environment, a service provider may typically provide an RPC/HTTP capability interface to the outside to provide service capabilities to service invokers.
In the related art, after the development of service providers is completed, when the service providers need to add interfaces, especially public services need to add capability interfaces, the newly added capability can be validated only by stopping service update release, so that the availability problem of online service can occur within a period of time, and the service is influenced and the dynamic evolution of the service capability is not facilitated.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the present disclosure and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The disclosure aims to provide a method, a device, electronic equipment and a storage medium for processing functional data, which can realize the effect that a service provider can dynamically enhance a capability interface without stopping updating.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to one aspect of the present disclosure, there is provided a method of functional data processing, the method being applied to a service provider in a remote invocation process, the method comprising: acquiring function realization data of a function to be added; processing the function realization data by utilizing a byte code editing library, and dynamically creating a function object of the function to be added; the functional object is loaded into the service provider's operating environment.
In one embodiment of the present disclosure, a service provider has a capability to dynamically inject interfaces; the method for dynamically creating the function object of the function to be added by utilizing the byte code editing library to process the function realization data comprises the following steps: calling a capability dynamic injection interface, and transmitting function realization data to the capability dynamic injection interface; and calling a byte code editing library through the capability dynamic injection interface, and further processing the function by utilizing the byte code editing library to realize data, and dynamically creating a function object of the function to be added.
In one embodiment of the present disclosure, the function implementation data includes: full class name, method parameters and method body data; the method for dynamically creating the function object of the function to be added by utilizing the byte code editing library to process the function realization data comprises the following steps: loading the full class name by using a class container of the byte code editing library, and dynamically creating a loaded class object with a function to be added; dynamically creating a method object in the loaded class object according to the method name, the method parameters and the method body data; the loaded class object with the method object is converted into a class interface object by using a byte code editing library to be used as a functional object.
In one embodiment of the present disclosure, loading a functional object into a service provider's runtime environment includes: the function object is loaded into a class loader of the running environment, so that the function object becomes a class managed by the running environment.
In one embodiment of the present disclosure, the method of functional data processing further includes: receiving a call request of a service calling party for a target function in a remote call process; calling the target function in the operation environment according to the request parameters in the calling request to obtain a calling result; and returning the calling result to the service calling party.
In one embodiment of the present disclosure, the service provider also has a capability generalization call interface; the method comprises the steps of calling a target function in an operation environment according to a request parameter in a call request to obtain a call result, wherein the method comprises the following steps: calling a capacity generalization calling interface, and transmitting the request parameters into the capacity generalization calling interface; and accessing the running environment through the capacity generalization calling interface, and calling the target function in the running environment according to the request parameter in the calling request to obtain a calling result.
In one embodiment of the disclosure, the request parameters include a target full class name, a target method parameter list of the target function; the method comprises the steps of calling a target function in an operation environment according to a request parameter in a call request to obtain a call result, wherein the method comprises the following steps: searching a target full class name based on a reflection calling mechanism in an operation environment; under the condition that the target full class name is found, acquiring a target method object in the running environment according to the target method name and a target method parameter list; and calling the target method object, obtaining a method return value, and determining the method return value as a calling result.
According to another aspect of the present disclosure, there is provided an apparatus for functional data processing, the apparatus being applied to a service provider in a remote invocation process; the device for processing the functional data comprises: the acquisition module is used for acquiring function realization data of the function to be added; the dynamic creating module is used for processing the function realization data by utilizing a byte code editing library and dynamically creating the function object of the function to be added; and the loading module is used for loading the functional object to the running environment of the service provider.
According to yet another aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the method of functional data processing described above.
According to still another aspect of the present disclosure, there is provided an electronic apparatus including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-described method of functional data processing via execution of the executable instructions.
The method for processing the functional data provided by the embodiment of the disclosure can be applied to remote call between services, and can utilize the byte code editing library to process the function realization data of the function to be added, dynamically create the function object of the function to be added, load the function object into the running environment of a service provider and realize dynamic injection of the function. Therefore, the method can utilize the byte code editing library to dynamically increase the capacity of the service provider in the remote calling process, dynamically inject the capacity which the service provider wants to increase into an operating environment (such as JVM), enable the service provider to update the capacity on line, improve the efficiency of capacity update, ensure the high availability of the service, and avoid the problem of low availability caused by stopping service update.
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 disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
FIG. 1 illustrates a schematic diagram of an exemplary system architecture to which a method of functional data processing of embodiments of the present disclosure may be applied;
FIG. 2 illustrates a flow chart of a method of functional data processing of one embodiment of the present disclosure;
FIG. 3 illustrates a flow chart of dynamically creating a functional object in a method of functional data processing according to one embodiment of the present disclosure;
FIG. 4 illustrates a flow chart of processing a call request of a service caller in a method of functional data processing of one embodiment of the present disclosure;
FIG. 5 illustrates a flow chart of a call to a target function in a method of function data processing of one embodiment of the present disclosure;
FIG. 6 illustrates a block diagram of an apparatus for functional data processing of one embodiment of the present disclosure; and
fig. 7 shows a block diagram of a computer device for functional data processing in an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present disclosure, the meaning of "a plurality" is at least two, such as two, three, etc., unless explicitly specified otherwise.
FIG. 1 shows a schematic diagram of an exemplary system architecture to which the method of functional data processing of embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture may include a server 101, a network 102, and a client 103. Network 102 is the medium used to provide communication links between clients 103 and server 101. Network 102 may include various connection types such as wired, wireless communication links, or fiber optic cables, among others.
In an exemplary embodiment, the client 103 in data transmission with the server 101 may include, but is not limited to, a smart phone, a desktop computer, a tablet computer, a notebook computer, a smart speaker, a digital assistant, an AR (Augmented Reality) device, a VR (Virtual Reality) device, a smart wearable device, and the like. Alternatively, the operating system running on the electronic device may include, but is not limited to, an android system, an IOS system, a linux system, a windows system, and the like.
The server 101 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligent platforms, and the like. In some practical applications, the server 101 may also be a server of a network platform, and the network platform may be, for example, a transaction platform, a live broadcast platform, a social platform, or a music platform, which is not limited in the embodiments of the present disclosure. The server may be one server or may be a cluster formed by a plurality of servers, and the specific architecture of the server is not limited in this disclosure.
In an exemplary embodiment, the server 101 may be a service provider in a remote invocation process and the client 103 may be a service caller in a remote invocation process. The server 101 can dynamically inject service capability (i.e. function to be added), and can also receive a call request of a service calling party for a target function and provide a corresponding capability method to realize capability generalization call. ,
In an exemplary embodiment, the procedure of the method for implementing the functional data processing by the server 101 may be: the server 101 acquires function realization data of a function to be added; the server 101 processes the function realization data by utilizing a byte code editing library, and dynamically creates a function object of the function to be added; the server 101 loads the functional object to the service provider's running environment.
In addition, it should be noted that fig. 1 is only one application environment of the method for processing functional data provided in the present disclosure. The number of servers 101, networks 102, and clients 103 in FIG. 1 is merely illustrative, and any number of clients, networks, and servers may be provided as desired.
In order for those of ordinary skill in the art to better understand the technical solutions of the present disclosure, the steps of the method for processing functional data in the exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings and embodiments.
FIG. 2 illustrates a flow chart of a method of functional data processing of one embodiment of the present disclosure. The method provided by the embodiments of the present disclosure may be performed by the server 101 as shown in fig. 1, but the present disclosure is not limited thereto.
In the following explanation, the server 101 is exemplified as an execution subject.
As shown in fig. 2, the method for processing functional data provided by the embodiment of the present disclosure may be applied to a service provider in a remote call process, and includes the following steps.
Step S201, obtaining function realization data of a function to be added.
The function implementation data may be development data written in advance by a developer.
In some embodiments, the functional implementation data may include: full class name, method parameters, and method body data.
Step S203, the function object of the function to be added is dynamically created by processing the function realization data by using the byte code editing library.
In this step, the bytecode editing library may be a javaist library, which is a library for operating Java bytecodes at runtime, which may provide an API interface allowing developers to modify the structure and behavior of classes without directly operating the bytecodes.
In some embodiments, the service provider may have the capability to dynamically inject interfaces.
The service provider can build a public service module by relying on the ecai-common package, and then integrate the dynamic injection interface into the public service module. The dynamic injection interface can be used for receiving the call and realizing the dynamic injection of the capability, and the participation of the interface comprises the following steps: full class name, method parameter list (including parameter type full class name, parameter name), and method body implementation.
Based on this, step S203 may include: calling a capability dynamic injection interface, and transmitting function realization data to the capability dynamic injection interface; and calling a byte code editing library through the capability dynamic injection interface, and further processing the function by utilizing the byte code editing library to realize data, and dynamically creating a function object of the function to be added.
In this embodiment, a capability dynamic injection interface may be invoked, and the function implementation data is processed through the capability dynamic injection interface, so that the function implementation data of the function to be added is dynamically injected. In some practical applications, a service provider may implement dynamic injection of multiple functions to be added through a capability dynamic injection interface.
FIG. 3 illustrates a flow chart of dynamically creating a function object in a method of function data processing of an embodiment of the present disclosure, as shown in FIG. 3, in some embodiments, utilizing a byte code editing library to process function implementation data, dynamically creating a function object for a function to be added, comprising the following steps.
Step S301, loading the full class name by using the class container of the byte code editing library, and dynamically creating the loaded class object with the function to be added.
The loaded class object to be added with functionality may be a CtClass object. CtClass is an important class in the Java class library and represents a loaded Java class. A Java class may be loaded from a class path or a specified class file by the get () method of class pool and expressed as a CtClass object.
In this step, a CtClass may be created by the class of the javaist library, i.e., a CtClass object may be loaded and created using the class. After the CtClass object is obtained, the bytecode of this class can be manipulated and modified using the method provided by javaist. For example, fields, methods, and constructors of a class may be added, modified, or deleted, notes, modification methods, and the like may also be added. In this way, the loaded Java class can be dynamically modified at runtime to implement some high-level functions, such as dynamic proxy, AOP, etc.
In some practical applications, the following code may be invoked to implement this step:
step S303, dynamically creating the method objects in the loaded class objects according to the method names, the method parameters and the method body data.
The method object may be a CtMethod object, and the CtMethod class is a subclass of the CtClass class, which may be used to represent methods in the class. It may provide a series of methods to operate the structure of the method, such as modifying the method body, adding parameters, obtaining return types, etc., i.e., detailed operations and modifications of the method may be made by CtMethod classes.
In this step, a new method can be dynamically created by using the related method of the CtMethod class in the javaist library, importing the method name, the method parameter list and the code of the method body, and adding the method to the loaded Java class. Through this step, the method can be dynamically created at runtime and added to the loaded Java class, thereby enabling dynamic modification and enhancement of the class.
In step S305, the loaded class object with the method object is converted into a class interface object as a function object by using the byte code editing library.
In this step, the class interface object may be a java. Lang. Class object, where each loaded class has a corresponding java. Lang. Class object in memory. This object contains structural information of the class, such as the name of the class, the parent class, the interface of the implementation, fields, methods, etc. Through the java. Lang. Class object, various information of the class, such as class name, package name, modifier, etc., can be obtained. Javassist needs to convert CtClass into java. Lang. Class, so that the CtClass can be loaded and validated by JVM (i.e. the running environment of the service provider), and the following api can be called to implement this step: ctclass.toclass (class.getclass loader ()), ctclass.getclass (). GetProtec tionDomain ()).
In step S205, the functional object is loaded into the service provider' S running environment.
In this step, the runtime environment may be a JVM (Java Virtual Machine ).
In some embodiments, loading the functional object into the service provider's runtime environment may include: the function object is loaded into a class loader of the running environment, so that the function object becomes a class managed by the running environment.
In some practical applications, the dynamically injecting the parameters of the interface includes: string fullClassName, string methodName, string methodImpl, list < String > parameters, the specific implementation of this interface may be:
by the method, the call of the service provider can be accepted, and the dynamic injection of the capability is realized.
The method for processing the function data can be applied to remote call between services, and the function realization data of the function to be added can be processed by utilizing the byte code editing library, so that the function object of the function to be added is dynamically created, the function object is loaded to the running environment of a service provider, and the dynamic injection of the function is realized. Therefore, the method can realize the dynamic increase of the capacity for the service provider in the remote calling process, dynamically inject the capacity which the service provider wants to increase into the running environment (such as JVM), enable the service provider to update the capacity on line, improve the efficiency of capacity update, ensure the high availability of the service, and avoid the problem of low availability caused by stopping service update.
Based on the implementation of the capability dynamic injection, the method for processing the functional data provided by the disclosure can also implement capability generalization calling based on the implementation.
FIG. 4 illustrates a flow chart of processing a call request of a service caller in a method of functional data processing of one embodiment of the present disclosure, as illustrated in FIG. 4, in some embodiments the method of functional data processing further comprises the following steps.
Step S401, receiving a call request of a service calling party in a remote call process for a target function.
In some embodiments, the request parameters include a target full class name, a target method parameter list of the target function.
Step S403, calling the target function in the operation environment according to the request parameter in the calling request to obtain a calling result.
In some embodiments, the service provider also has a capability generalization call interface.
The capability generalization calling interface can also be integrated into a public service module, and can be used for receiving a call from a service calling party to provide the capability inside a service provider, wherein the capability is just provided externally and is generalized, after external call, the internal capability is called by reflection, and then the result is returned, so that the effect of dynamic call of the interface is achieved.
Based on this, step S403 may include: calling a capacity generalization calling interface, and transmitting the request parameters into the capacity generalization calling interface; and accessing the running environment through the capacity generalization calling interface, and calling the target function in the running environment according to the request parameter in the calling request to obtain a calling result.
Step S405, returns the calling result to the service caller.
If the call is successful, the return value of the target function based on the target method parameter list can be returned; if the call fails, a message may be returned indicating that the call failed. Specifically, the call may be successful when the target function exists in the service provider's operating environment (i.e., JVM), and the call may fail if the target function does not exist in the service provider's operating environment or the data in the request parameters is incorrect.
FIG. 5 illustrates a flow chart of a call to a target function in a method of function data processing according to one embodiment of the present disclosure, as illustrated in FIG. 5, in some embodiments, the call to the target function is performed in a runtime environment according to a request parameter in a call request, and a call result is obtained, including the following steps.
Step S501, searching the target full class name based on a reflection calling mechanism in the running environment.
Wherein the runtime environment may be, for example, a JVM.
Step S503, under the condition that the target full class name is found, the target method object in the running environment is obtained according to the target method name and the target method parameter list.
If the target full class name is found in the operation environment of the service provider, the service provider has the capability of providing service for the target function and can be continuously called; if the target full class name is not found in the running environment of the service provider, the service provider cannot provide the function service, a message of call failure can be returned, and the fact that the method does not exist can be indicated in the message.
And if the target method name and the target method parameter list are wrong (for example, the target method name is not matched with the method name of the service provider or the target method parameter list is not matched with the parameter type required by the service provider), a message of call failure can be returned, and the parameter can be indicated in the message.
Step S505, the target method object is called, a method return value is obtained, and the method return value is determined to be a calling result.
The target function capable of being successfully invoked may be preset in the JVM of the service provider, or may be injected into the JVM of the service provider according to the capability injection method.
In some practical applications, the method for processing functional data provided by the present disclosure may be applied to the collection and control project of group 5 GC.
First, a common service module of a service provider (i.e., service provider) can be built by relying on ecai-common packages, and then other acquisition services (i.e., service invoker) invoke a capability interface of the common service through RPC/HTTP. Wherein the common service module may be part of a service provider. The ecai-common module is a common abstract module for all service providers, wherein business logic common to most services is extracted, business module code, wherein the dynamic capability injection interface can be extracted and placed into ecai-common.
When the public service module needs to increase public capacity, a capacity interface method can be developed firstly, then the capacity of the ecai-common service is called to dynamically inject the interface/api/v 1/dynamicInject, the full class name of the newly developed interface is transferred, and the method name, the method parameter list, the method body implementation and the like are carried out.
When the ecai-common service receives the call, a CtClass can be created through the class pool of the Java library, then a Ctmethod is created through a method name and a method parameter list, then the CtClass is converted into java. Lang. Class and loaded into a ClassLoader to be subjected to JVM management, and thus, the dynamic injection of the service capability interface method is completed.
Wherein if an exception occurs during the creation of the class/method, exception information is also returned to the service caller. Specifically, if a class name abnormality, a method parameter type absence, a method parameter signature absence, a grammar error of a method body and the like occur in the capability to be injected, the capability injection abnormality is caused.
Further, when the service caller needs to call a new capability interface (such as a function dynamically injected according to the method), the calling capability generalization call interface/api/v 1/dynamic invite can be used by entering a full class name, a method name and a method parameter list. When the public service module receives the call, the capacity generalization call is realized and returned through the following steps:
1. Finding the Class corresponding to the full Class name in the JVM:
Class clazz=Class.forName(fullClassName);
2. converting the parameter list into an object array:
Object[]objects=parameterList.toArray(new Object[0]);
3. converting the object array into a Class list Class [ ]:
List<Class<?>>collect=Arrays.stream(args).map(item->item.getClass()).collect(Collectors.toList());
Class[]classes=collect.toArray(new Class[collect.size()]);
4. obtaining a method object according to the method name and the method parameter list:
Method method=clazz.getDeclaredMethod(methodName,classes);
5. calling a method and returning a result:
return(T)method.invoke(null,parameterList)。
wherein if the class/method cannot be found during the period to cause the call exception, the exception information can be returned to the service caller.
In sum, through dynamic capability injection and generalized call, the effect that a service provider can dynamically enhance a capability interface without stopping service update can be achieved, the problems of flexibility and dynamic expandability of continuous stopping service update in actual production are solved, and the method has architecture reference significance for public service provider modules.
In some practical applications, both parties (service provider and service caller) may also register with a "service registry", where the service provider may register with the service registry the type of service or specific service content that it can provide, so that the service caller may autonomously select a target service provider from multiple service providers and then make a call when a call method is required; a load balancing policy may also be configured in the service registry to combine the needs of the service invoker and the capabilities of the service provider to determine for the service invoker a target service provider that can meet its needs.
It is noted that the above-described figures are only schematic illustrations of processes involved in a method according to an exemplary embodiment of the invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
FIG. 6 illustrates a block diagram of an apparatus 600 for functional data processing for use with a service provider in a remote invocation process, in accordance with one embodiment of the present disclosure; as shown in fig. 6, the apparatus 600 for functional data processing includes: an obtaining module 601, configured to obtain function implementation data of a function to be added; the dynamic creation module 602 is configured to process the function implementation data by using a byte code editing library, and dynamically create the function object of the function to be added; and the loading module 603 is configured to load the functional object into the running environment of the service provider.
The device for processing the function data can be applied to remote call between services, and the device for processing the function data can process function realization data of functions to be added by utilizing a byte code editing library, dynamically create function objects of the functions to be added, load the function objects into the running environment of a service provider and realize dynamic injection of the functions. Therefore, the method can realize the dynamic increase of the capability of the service provider in the remote call process, dynamically inject the capability which the service provider wants to increase into the running environment (such as JVM), so that the service provider can update the self capability on line, improve the capability updating efficiency, ensure the high availability of the service, and avoid the problem of low availability caused by stopping the service updating
In some embodiments, the apparatus for functional data processing further comprises a capability dynamic injection interface 604; wherein, the dynamic creation module 602 processes the function implementation data by using the byte code editing library, dynamically creates a function object of the function to be added, and includes: calling the capability dynamic injection interface 604, and transmitting the function realization data to the capability dynamic injection interface 604; the byte code editing library is called through the capability dynamic injection interface 604, and then the function object of the function to be added is dynamically created by processing the function realization data by utilizing the byte code editing library.
In some embodiments, the functional implementation data includes: full class name, method parameters and method body data; wherein, the dynamic creation module 602 processes the function implementation data by using the byte code editing library, dynamically creates a function object of the function to be added, and includes: loading the full class name by using a class container of the byte code editing library, and dynamically creating a loaded class object with a function to be added; dynamically creating a method object in the loaded class object according to the method name, the method parameters and the method body data; the loaded class object with the method object is converted into a class interface object by using a byte code editing library to be used as a functional object.
In some embodiments, the loading module 603 loads the functional object to the service provider's runtime environment, including: the function object is loaded into a class loader of the running environment, so that the function object becomes a class managed by the running environment.
In some embodiments, the apparatus for functional data processing further comprises: a receiving module 605, configured to receive a call request of a service calling party for a target function in a remote call process; a calling module 606, configured to call a target function in an operating environment according to a request parameter in a call request, so as to obtain a call result; a return module 607, configured to return the calling result to the service caller.
In some embodiments, the apparatus for functional data processing further includes a capability generalization call interface 608; the calling module 606 calls the target function in the running environment according to the request parameter in the calling request, so as to obtain a calling result, which includes: calling the capacity generalization calling interface 608, and transmitting the request parameters into the capacity generalization calling interface 608; the running environment is accessed through the capability generalization calling interface 608, and then the target function is called in the running environment according to the request parameter in the calling request, so that a calling result is obtained.
In some embodiments, the request parameters include a target full class name, a target method parameter list of the target function; the calling module 606 calls the target function in the running environment according to the request parameter in the calling request, so as to obtain a calling result, which includes: searching a target full class name based on a reflection calling mechanism in an operation environment; under the condition that the target full class name is found, acquiring a target method object in the running environment according to the target method name and a target method parameter list; and calling the target method object, obtaining a method return value, and determining the method return value as a calling result.
Other details of the embodiment of fig. 6 may be found in the other embodiments described above.
Those skilled in the art will appreciate that the various aspects of the invention may be implemented as a system, method, or program product. Accordingly, aspects of the invention may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
Fig. 7 shows a block diagram of a computer device for functional data processing in an embodiment of the present disclosure. It should be noted that the illustrated electronic device is only an example, and should not impose any limitation on the functions and application scope of the embodiments of the present invention.
An electronic device 700 according to this embodiment of the invention is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 7, the electronic device 700 is embodied in the form of a general purpose computing device. Components of electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one memory unit 720, and a bus 730 connecting the different system components, including the memory unit 720 and the processing unit 710.
Wherein the storage unit stores program code that is executable by the processing unit 710 such that the processing unit 710 performs steps according to various exemplary embodiments of the present invention described in the above-mentioned "exemplary methods" section of the present specification. For example, the processing unit 710 may perform the method as shown in fig. 2.
The memory unit 720 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 7201 and/or cache memory 7202, and may further include Read Only Memory (ROM) 7203.
The storage unit 720 may also include a program/utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 730 may be a bus representing one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 700, and/or any device (e.g., router, modem, etc.) that enables the electronic device 700 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 750. Also, electronic device 700 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 over bus 730. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 700, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
In an exemplary embodiment of the present disclosure, a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification is also provided. In some possible embodiments, the various aspects of the invention may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the invention as described in the "exemplary methods" section of this specification, when said program product is run on the terminal device.
A program product for implementing the above-described method according to an embodiment of the present invention may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a 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.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Furthermore, although the steps of the methods in the present disclosure are depicted in a particular order in the drawings, this does not require or imply that the steps must be performed in that particular order or that all illustrated steps be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
According to one aspect of the present disclosure, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the methods provided in the various alternative implementations of the above-described embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method of functional data processing, characterized in that the method is applied to a service provider in a remote invocation process; the method comprises the following steps:
Acquiring function realization data of a function to be added;
processing the function realization data by using a byte code editing library, and dynamically creating the function object of the function to be added;
and loading the functional object to the running environment of the service provider.
2. The method of claim 1, wherein the service provider has a capability dynamic injection interface;
processing the function realization data by using a byte code editing library, dynamically creating the function object of the function to be added, and comprising the following steps:
calling the capability dynamic injection interface, and transmitting the function realization data to the capability dynamic injection interface;
and calling the byte code editing library through the capability dynamic injection interface, and further processing the function realization data by utilizing the byte code editing library, and dynamically creating the function object of the function to be added.
3. The method according to claim 1 or 2, wherein the function implementation data comprises: full class name, method parameters and method body data;
processing the function realization data by using a byte code editing library, dynamically creating the function object of the function to be added, and comprising the following steps:
Loading the full class name by using a class container of the byte code editing library, and dynamically creating the loaded class object with the function to be added;
dynamically creating a method object in the loaded class object according to the method name, the method parameters and the method body data;
and converting the loaded class object with the method object into a class interface object by using the byte code editing library to serve as the functional object.
4. A method according to claim 3, wherein loading the functional object into the service provider's operating environment comprises:
and loading the functional object into a class loader of the running environment so that the functional object becomes a class managed by the running environment.
5. The method according to claim 1, wherein the method further comprises:
receiving a call request of a service calling party for a target function in the remote call process;
calling the target function in the running environment according to the request parameters in the calling request to obtain a calling result;
and returning the calling result to the service calling party.
6. The method of claim 5, wherein the service provider further has a capability generalization call interface;
The method comprises the steps of calling the target function in the running environment according to a request parameter in the call request to obtain a call result, wherein the method comprises the following steps:
calling the capacity generalization calling interface, and transmitting the request parameters into the capacity generalization calling interface;
and accessing the running environment through the capability generalization calling interface, and calling the target function in the running environment according to the request parameters in the calling request to obtain a calling result.
7. The method according to claim 5 or 6, wherein the request parameters comprise a target full class name, a target method parameter list of the target function;
the method comprises the steps of calling the target function in the running environment according to a request parameter in the call request to obtain a call result, wherein the method comprises the following steps:
searching the target full class name in the running environment based on a reflection calling mechanism;
under the condition that the target full class name is found, acquiring a target method object in the running environment according to the target method name and a target method parameter list;
and calling the target method object and obtaining a method return value, and determining the method return value as the calling result.
8. A device for functional data processing, wherein the device is applied to a service provider in a remote call process; the device comprises:
the acquisition module is used for acquiring function realization data of the function to be added;
the dynamic creating module is used for processing the function realization data by utilizing a byte code editing library and dynamically creating the function object of the function to be added;
and the loading module is used for loading the functional object to the running environment of the service provider.
9. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs a method of functional data processing according to any of claims 1 to 7.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which when executed by the one or more processors cause the one or more processors to implement the method of functional data processing of any of claims 1 to 7.
CN202311810438.1A 2023-12-26 2023-12-26 Method and device for processing functional data, storage medium and electronic equipment Pending CN117785511A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311810438.1A CN117785511A (en) 2023-12-26 2023-12-26 Method and device for processing functional data, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311810438.1A CN117785511A (en) 2023-12-26 2023-12-26 Method and device for processing functional data, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117785511A true CN117785511A (en) 2024-03-29

Family

ID=90384566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311810438.1A Pending CN117785511A (en) 2023-12-26 2023-12-26 Method and device for processing functional data, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117785511A (en)

Similar Documents

Publication Publication Date Title
CN109032706B (en) Intelligent contract execution method, device, equipment and storage medium
US8739147B2 (en) Class isolation to minimize memory usage in a device
US7703089B2 (en) Compatibility framework using versioning class loaders
US9110654B2 (en) Dynamically building locale objects or subsections of locale objects based on historical data
US7174361B1 (en) Scripting task-level user-interfaces
US11366643B2 (en) Generating dynamic modular proxies
CN110716748B (en) Service processing method, device, computer readable medium and electronic equipment
US9262237B2 (en) Automating software availability management based on API versioning
EP3350696B1 (en) Overriding a migrated method of an updated type
US7730492B1 (en) Method and system for running multiple virtual machines in a single process
US10310827B2 (en) Flow-based scoping
WO2022062634A1 (en) Method, apparatus, device, and storage medium for integrating map service in service
US9141353B2 (en) Dynamically building locale objects at run-time
US20190278639A1 (en) Service for enabling legacy mainframe applications to invoke java classes in a service address space
US11347487B2 (en) Confining reflective access based on module boundaries
US10394610B2 (en) Managing split packages in a module system
CN117785511A (en) Method and device for processing functional data, storage medium and electronic equipment
CN113760262A (en) Task processing method, device, computer system and computer readable storage medium
US10521200B2 (en) Unambiguous proxying of interface methods
US9471341B1 (en) Optimizing latest user defined class loader
CN117111904B (en) Method and system for automatically converting Web applications into serverless functions
CN117118962B (en) Method and system for deploying user methods across multiple cloud platforms
US12020043B2 (en) Using containers to clean runtime resources when unloading a shared library
US11061703B2 (en) Managed runtime data marshaling for native code access using a thread local native buffer
CN116010100A (en) Contract calling method, device, equipment and storage medium in block chain 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