CN112596927A - Remote method calling method and device - Google Patents

Remote method calling method and device Download PDF

Info

Publication number
CN112596927A
CN112596927A CN202011567898.2A CN202011567898A CN112596927A CN 112596927 A CN112596927 A CN 112596927A CN 202011567898 A CN202011567898 A CN 202011567898A CN 112596927 A CN112596927 A CN 112596927A
Authority
CN
China
Prior art keywords
target
calling
identifier
parameter value
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
CN202011567898.2A
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.)
Shanghai I2finance Software Co ltd
Original Assignee
Shanghai I2finance Software 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 Shanghai I2finance Software Co ltd filed Critical Shanghai I2finance Software Co ltd
Priority to CN202011567898.2A priority Critical patent/CN112596927A/en
Publication of CN112596927A publication Critical patent/CN112596927A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F9/548Object oriented; Remote method invocation [RMI]

Landscapes

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

Abstract

One or more embodiments of the present specification disclose a remote method invocation method and apparatus, which are used to solve the problems of slow invocation speed and low efficiency of the existing invocation method. The method comprises the following steps: receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value; acquiring a class object corresponding to the target class identifier according to the calling request; acquiring an example of a target method according to the class object and the target method identifier; calling the target method according to the class object, the instance of the target method and the target parameter value; and returning the execution result of the calling target method to the caller. According to the technical scheme, the target method can be called without the calling party appointing the type of the target parameter in the calling request, and the data content transmitted between the calling party and the called party is reduced, so that the calling speed and the calling efficiency of the remote method can be improved.

Description

Remote method calling method and device
Technical Field
The present disclosure relates to the field of remote invocation technologies, and in particular, to a method and an apparatus for remote method invocation.
Background
With the continuous development of services and the continuous increase of functions, the communication, management, coordination and other costs of the traditional monolithic architecture are higher and higher, and micro services are produced in response to the problem of the traditional system architecture. Due to the unification of service responsibilities of a single node of a system under a micro-service architecture, a remote method invocation phenomenon among different services is more and more common.
However, in the current practical application, the two parties performing the remote method invocation can only transmit the invocation request according to the fixed data content, and the fixed data content required at present is more, so that the system of the invoking party is busy, the response speed of the system of the invoking party is slow, and the invocation speed and efficiency of the remote method are affected. For example, when a caller system performs highly concurrent call operations, corresponding fixed data content needs to be generated for each callee, thus causing the caller system to be busy, affecting remote method call speed and efficiency. Therefore, it is an urgent need to provide a highly efficient remote method invocation method.
Disclosure of Invention
One or more embodiments of the present disclosure provide a remote method invocation method and apparatus, so as to solve the problems of slow invocation speed and low efficiency of the existing invocation method.
To solve the above technical problem, one or more embodiments of the present specification are implemented as follows:
in one aspect, one or more embodiments of the present specification provide a method for remote method invocation, including:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
In another aspect, one or more embodiments of the present specification provide a remote method invocation apparatus, including:
the system comprises a receiving module, a calling module and a processing module, wherein the receiving module is used for receiving a calling request sent by a calling party, the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
the first obtaining module is used for obtaining the class object corresponding to the target class identifier according to the calling request;
a second obtaining module, configured to obtain an instance of the target method according to the class object and the target method identifier;
the calling module is used for calling the target method according to the class object, the instance of the target method and the target parameter value;
and the first execution module is used for returning an execution result after the target method is called to be executed to the caller.
In yet another aspect, one or more embodiments of the present specification provide a remote method invocation device, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
In yet another aspect, an embodiment of the present application provides a storage medium for storing computer-executable instructions, where the computer-executable instructions, when executed, implement the following processes:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
By adopting the technical scheme of one or more embodiments of the specification, when the remote method is called, the class object corresponding to the target class identifier can be obtained according to the calling request which is sent by the calling party and comprises the target class identifier, the target method identifier and the target parameter value, the example of the target method is obtained according to the class object and the target method identifier, then the target method is called according to the class object, the example of the target method and the target parameter value, and the execution result after the target method is called is returned to the calling party. Therefore, the technical scheme can call the target method without the calling party appointing the type of the target parameter in the calling request, so that the flexibility of remote method calling is improved, and compared with the traditional mode that the target method can be called only by the calling party appointing the type identifier, the method identifier, the parameter value and the parameter type, the data content transmitted between the calling party and the called party is reduced, so that the calling speed of the remote method can be increased, and the calling efficiency of the remote method is improved.
Drawings
In order to more clearly illustrate one or more embodiments or technical solutions in the prior art in the present specification, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in one or more embodiments of the present specification, and other drawings can be obtained by those skilled in the art without inventive exercise.
FIG. 1 is a schematic block diagram of a remote method invocation relationship in accordance with an embodiment of the present specification;
FIG. 2 is a schematic flow chart diagram of a remote method invocation method in accordance with an embodiment of the present specification;
FIG. 3 is a schematic flow chart diagram of a remote method invocation method in accordance with another embodiment of the present specification;
FIG. 4 is a block diagram of a remote method invocation device according to an embodiment of the present specification;
fig. 5 is a hardware configuration diagram of a remote method invocation device according to an embodiment of the present specification.
Detailed Description
One or more embodiments of the present disclosure provide a remote method invocation method and apparatus, so as to solve the problems of slow invocation speed and low efficiency of the existing invocation method.
In order to make those skilled in the art better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in one or more embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all embodiments. All other embodiments that can be derived by a person skilled in the art from one or more of the embodiments of the present disclosure without making any creative effort shall fall within the protection scope of one or more of the embodiments of the present disclosure.
Fig. 1 is a schematic block diagram of a remote method invocation relationship according to an embodiment of the present specification, and as shown in fig. 1, when a remote method invocation is performed, data is transmitted between an invoking party and a called party through a communication protocol.
In one embodiment, when a remote method is called, a calling party sends a calling request to a called party through a communication protocol, and then receives an execution result sent by the called party based on the communication protocol.
Before sending a call request to a called party, a calling party can perform serialization operation on call information (including class identifiers, method identifiers, parameter values and the like) carried by the call request, so as to achieve the purpose of converting the call information into a transmittable form. For example, the call information after serialization may be information in XML (Extensible Markup Language), JSON (JavaScript Object notification), and other formats.
The class identifier may include information describing the class, such as a class name. The method identification may include information describing the method, such as the method name. The parameter values may include values of parameters actually incoming at the time the method is called.
For example, one specific implementation of the caller generating the call information may be:
public class RemoteClass{public Object remoteMethod(String a,Object b,List<Object>c){return new Object();}}。
wherein, RemoteClass is class identification (class name), remoteMethod is a method in the class, and a, b and c are parameter names in the method.
At this time, the specific implementation manner of loading the call information onto the communication protocol may be as shown in the following data of JSON structure:
{”class”:”RemoteClass”,”method”:”remoteMethod”,”parameter”:{”a”:”value_a”,”b”:”value_b”,”c”:”value_c”}}。
the parameter is a parameter array, and the parameter value corresponding to each parameter name is defined in the parameter array in a "value _ parameter name" manner.
The operation performed by the caller during the remote method invocation will not be described in detail in this specification. The following describes in detail specific procedures of operations performed by the callee to receive a call request, execute a call operation (business logic), and return an execution result in the remote method call process.
FIG. 2 is a schematic flow chart of a remote method invocation method according to an embodiment of the present specification, as shown in FIG. 2, applied to a callee shown in FIG. 1, including:
s202, receiving a calling request sent by a calling party.
In this embodiment, the call request carries target call information, where the target call information includes a target class identifier, a target method identifier, and a target parameter value.
The target class identifier may include information describing the target class, such as a target class name. The target method identification may include information describing the target method, such as the target method name. The target parameter values may include values of parameters actually passed in when the target method was called.
Optionally, in an embodiment, the invoking request sent by the caller may be received based on a target communication protocol, where the target communication protocol is a communication protocol supported by both the caller and the callee.
Before the calling party loads the calling request to the target communication protocol, the calling party can execute serialization operation on target calling information carried by the calling request so as to convert the target calling information into information in a transmittable form. For example, the target call information after serialization can be information in XML, JSON, or the like format.
Optionally, in an embodiment, if the target call information carried in the received call request is information in an XML format or a JSON format, the operation of parsing the call request is performed to obtain information such as the target class identifier, the target method identifier, and the target parameter value.
The operation of parsing the call request may be an deserialization operation.
In this embodiment, the received call request is deserialized to obtain information such as the target class identifier, the target method identifier, the target parameter value, and the like, so that the purpose of simply and conveniently transmitting the target call information between the caller and the callee is achieved.
And S204, acquiring the class object corresponding to the target class identifier according to the calling request.
Optionally, in an embodiment, the class object corresponding to the target class identifier may be obtained according to the invocation request, and if there is no class object corresponding to the target class identifier in the callee, a new class object corresponding to the target class identifier may be created in the callee.
For example, the class object corresponding to the target class identifier may be acquired from the callee bean container according to the call request, and if there is no class object corresponding to the target class identifier in the callee bean container, the class object corresponding to the target class identifier may be created in the callee bean container.
S206, obtaining the example of the target method according to the class object and the target method identification.
And S208, calling the target method according to the class object, the instance of the target method and the target parameter value.
Optionally, in an embodiment, after the target method is called, a serialization operation may be performed on the execution result according to the target communication protocol to generate a data packet, so that the caller receives the data packet based on the target communication protocol.
In the embodiment, the data packet is generated by serializing the execution result, so that the form of the execution result is converted into a transmittable data form, and the execution result data can be conveniently transmitted between the caller and the callee.
And S210, returning the execution result after the execution of the calling target method to the calling party.
Optionally, in an embodiment, an execution result after the execution of the calling target method may be returned to the caller based on the target communication protocol.
By adopting the technical scheme of one or more embodiments of the specification, when the remote method is called, the class object corresponding to the target class identifier can be obtained according to the calling request which is sent by the calling party and comprises the target class identifier, the target method identifier and the target parameter value, the example of the target method is obtained according to the class object and the target method identifier, then the target method is called according to the class object, the example of the target method and the target parameter value, and the execution result after the target method is called is returned to the calling party. Therefore, the technical scheme can call the target method without the calling party appointing the type of the target parameter in the calling request, so that the flexibility of remote method calling is improved, and compared with the traditional mode that the target method can be called only by the calling party appointing the type identifier, the method identifier, the parameter value and the parameter type, the data content transmitted between the calling party and the called party is reduced, so that the calling speed of the remote method can be increased, and the calling efficiency of the remote method is improved.
Optionally, in an embodiment, after obtaining the instance of the target method according to the class object and the target method identifier and before calling the target method, each parameter value included in the instance of the target method may be obtained, and the quantity information and the type information of each parameter value may be determined.
In this embodiment, by obtaining each parameter value included in the example of the target method and determining the quantity information and the type information of each parameter value, the total number of each parameter and each parameter type required by the target method can be obtained, and a basis is provided for subsequent operations.
Optionally, in one embodiment, after determining the quantity information and the type information of each parameter value and before calling the target method, a parameter array consistent with the quantity of the parameter values may be created according to the quantity information of each parameter value.
In this embodiment, a basis is provided for subsequent operations by creating a parameter array whose number is consistent with the number of parameter values, so that each parameter value can be written in the parameter array to meet the calling requirement of the calling party.
Optionally, in an embodiment, after creating the parameter array corresponding to the number of the parameter values and before calling the target method, an index order of the parameter values may be determined according to an index order of the target parameter values, and the parameter values may be written into the parameter array according to the index order of the parameter values.
For example, the order of indexing each parameter value can be determined from the order of indexing each target parameter value using the javasissst technique.
In the embodiment, the index sequence of each parameter value is determined according to the index sequence of each target parameter value, and each parameter value is respectively written into the parameter array according to the index sequence of each parameter value, so that the sequence of each parameter value in the parameter array is consistent with the index sequence of the target parameter value in the target calling information, and the calling accuracy of the target method is improved.
Alternatively, in one embodiment, the target method may be invoked according to a dynamic invocation pattern.
The dynamic calling mode is used for dynamically transmitting each parameter value in the parameter array into the class object so as to realize calling of the target method. The parameter array is determined by the instance of the target method and the target parameter value.
The determination method of the parameter array is described in detail in the above embodiments, and is not described herein again.
For example, the dynamic calling mode is invoke method, the class Object is Object, and the parameter array is param [ ]. A call to the target Method may be implemented using Method # invoke (Object, param [ ]).
In the embodiment, the target method is called in a preset mode, so that the flexibility of calling the target method is improved.
FIG. 3 is a schematic flow chart diagram of a remote method invocation method in accordance with another embodiment of the present specification, as shown in FIG. 3, the method including:
s301, receiving a calling request sent by a calling party.
The calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value.
This step is described in detail in S202, and is not described herein again.
S302, the calling request is analyzed to obtain a target class identifier, a target method identifier and a target parameter value.
The operation of parsing the call request may be an deserialization operation.
S303, obtaining the class object corresponding to the target class identification according to the calling request.
S304, obtaining the instance of the target method according to the class object and the target method identification.
S305, obtain each parameter value included in the example of the target method.
S306, determining the quantity information and the type information of each parameter value.
S307, according to the quantity information of each parameter value, a parameter array consistent with the quantity of the parameter values is created.
S308, determining the index sequence of each parameter value according to the index sequence of each target parameter value.
S309, writing the parameter values into the parameter array according to the index sequence of the parameter values.
S310, calling the target method according to the dynamic calling mode.
The dynamic calling mode is used for dynamically transmitting each parameter value in the parameter array into the class object so as to realize calling of the target method. The parameter array is determined by the instance of the target method and the target parameter value.
S311, according to the target communication protocol, executing serialization operation on the execution result after the calling target method is executed, and generating a data packet, so that the calling party receives the data packet based on the target communication protocol.
S312, returning the execution result after the execution of the calling target method to the calling party.
Optionally, in an embodiment, an execution result after the execution of the calling target method may be returned to the caller based on the target communication protocol.
By adopting the technical scheme of one or more embodiments of the specification, when the remote method is called, the class object corresponding to the target class identifier can be obtained according to the calling request which is sent by the calling party and comprises the target class identifier, the target method identifier and the target parameter value, the example of the target method is obtained according to the class object and the target method identifier, then the target method is called according to the class object, the example of the target method and the target parameter value, and the execution result after the target method is called is returned to the calling party. Therefore, the technical scheme can call the target method without the calling party appointing the type of the target parameter in the calling request, so that the flexibility of remote method calling is improved, and compared with the traditional mode that the target method can be called only by the calling party appointing the type identifier, the method identifier, the parameter value and the parameter type, the data content transmitted between the calling party and the called party is reduced, so that the calling speed of the remote method can be increased, and the calling efficiency of the remote method is improved.
In summary, particular embodiments of the present subject matter have been described. Other embodiments are within the scope of the following claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may be advantageous.
Based on the same idea, the remote method invocation method provided in one or more embodiments of the present specification further provides a remote method invocation device.
Fig. 4 is a schematic structural diagram of a remote method invocation device 400 according to an embodiment of the present specification, and as shown in fig. 4, the remote method invocation device 400 includes:
the receiving module 410 is configured to receive a call request sent by a caller, where the call request carries target call information, and the target call information includes a target class identifier, a target method identifier, and a target parameter value;
a first obtaining module 420, configured to obtain, according to the call request, a class object corresponding to the target class identifier;
a second obtaining module 430, configured to obtain an instance of the target method according to the class object and the target method identifier;
the calling module 440 is used for calling the target method according to the class object, the instance of the target method and the target parameter value;
the first execution module 450 is configured to return an execution result of the call target method after execution to the caller.
In one embodiment, the remote method invocation apparatus 400 further includes:
a third obtaining module, configured to obtain parameter values included in an instance of the target method;
and the first determining module is used for determining the quantity information and the type information of each parameter value.
In one embodiment, the remote method invocation apparatus 400 further includes:
and the creating module is used for creating a parameter array consistent with the quantity of the parameter values according to the quantity information of the parameter values.
In one embodiment, the remote method invocation apparatus 400 further includes:
the second determining module is used for determining the index sequence of each parameter value according to the index sequence of each target parameter value;
and the second execution module is used for writing the parameter values into the parameter arrays respectively according to the index sequence of the parameter values.
In one embodiment, the calling module 440 includes:
and the calling unit is used for calling the target method according to a dynamic calling mode, the dynamic calling mode is used for dynamically transmitting each parameter value in a parameter array into the class object so as to realize calling the target method, and the parameter array is determined by the example of the target method and the target parameter value.
In one embodiment, the remote method invocation apparatus 400 further includes:
and the analysis module is used for analyzing the calling request to obtain the target class identifier, the target method identifier and the target parameter value, and the analysis operation is deserialization.
In one embodiment, the remote method invocation apparatus 400 further includes:
and the third execution module is used for executing serialization operation on the execution result according to the target communication protocol to generate a data packet so that the calling party receives the data packet based on the target communication protocol.
By adopting the device in one or more embodiments of the present specification, when a remote method is called, a class object corresponding to a target class identifier can be obtained according to a call request including the target class identifier, the target method identifier, and a target parameter value, which is sent by a caller, an instance of a target method can be obtained according to the class object and the target method identifier, then the target method is called according to the class object, the instance of the target method, and the target parameter value, and an execution result after the target method is called is returned to the caller. Therefore, the device can call the target method without the calling party appointing the type of the target parameter in the calling request, the flexibility of remote method calling is improved, and compared with the traditional mode that the target method can be called only by the calling party appointing the type identification, the method identification, the parameter value and the parameter type, the data content transmitted between the calling party and the called party is reduced, so that the calling speed of the remote method can be increased, and the calling efficiency of the remote method is improved.
It should be understood by those skilled in the art that the remote method invocation apparatus can be used to implement the remote method invocation method described above, wherein the detailed description is similar to the method description, and therefore, in order to avoid complexity, no further description is provided herein.
Along the same lines, one or more embodiments of the present specification also provide a remote method invocation device 500, as shown in FIG. 5. The remote method invocation apparatus 500 may vary widely in configuration or performance and may include one or more processors 501 and memory 502, with one or more stored applications or data being stored in the memory 502. Memory 502 may be, among other things, transient or persistent storage. The application program stored in memory 502 may include one or more modules (not shown), each of which may include a series of computer-executable instructions for the remote method invocation device 500. Still further, the processor 501 may be configured to communicate with the memory 502 to execute a series of computer-executable instructions in the memory 502 on the remote method invocation device 500. The remote method invocation apparatus 500 may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input-output interfaces 505, and one or more keyboards 506.
In particular, in this embodiment, the remote method invocation apparatus 500 includes memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the remote method invocation apparatus 500, and the one or more programs configured for execution by the one or more processors include computer-executable instructions for:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an example of a target method according to the class object and the target method identifier;
calling the target method according to the class object, the instance of the target method and the target parameter value;
and returning the execution result of the calling target method to the caller.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
acquiring parameter values contained in an example of a target method;
quantity information and type information of each parameter value are determined.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
and creating a parameter array consistent with the quantity of the parameter values according to the quantity information of the parameter values.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
determining the index sequence of each parameter value according to the index sequence of each target parameter value;
and respectively writing the parameter values into the parameter array according to the index sequence of the parameter values.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
and calling the target method according to a dynamic calling mode, wherein the dynamic calling mode is used for dynamically transmitting each parameter value in a parameter array into the class object so as to realize calling the target method, and the parameter array is determined by the example of the target method and the target parameter value.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
and analyzing the call request to obtain the target class identifier, the target method identifier and the target parameter value, wherein the analyzing operation is deserialization.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
and executing serialization operation on the execution result according to the target communication protocol to generate a data packet, so that the calling party receives the data packet based on the target communication protocol.
When the device in one or more embodiments of the present specification is used to call a remote method, a class object corresponding to a target class identifier can be obtained according to a call request including the target class identifier, the target method identifier, and a target parameter value, sent by a caller, an instance of the target method can be obtained according to the class object and the target method identifier, the target method can be called according to the class object, the instance of the target method, and the target parameter value, and an execution result obtained after the target method is called can be returned to the caller. Therefore, the device can call the target method without the calling party appointing the type of the target parameter in the calling request, the flexibility of remote method calling is improved, and compared with the traditional mode that the target method can be called only by the calling party appointing the type identification, the method identification, the parameter value and the parameter type, the data content transmitted between the calling party and the called party is reduced, so that the calling speed of the remote method can be increased, and the calling efficiency of the remote method is improved.
One or more embodiments of the present specification further provide a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, where the one or more programs include instructions, and when the instructions are executed by a remote method invocation device 500 that includes a plurality of application programs, the instructions can enable the remote method invocation device 500 to execute each process of the remote method invocation method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
One skilled in the art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present specification are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only one or more embodiments of the present disclosure, and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of claims of one or more embodiments of the present specification.

Claims (10)

1. A remote method invocation method, wherein the method is applied to a callee and comprises:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
2. The method of claim 1, wherein after obtaining the instance of the target method based on the class object and the target method identification, and before invoking the target method, the method further comprises:
acquiring parameter values contained in the example of the target method;
and determining quantity information and type information of each parameter value.
3. The method of claim 2, wherein after determining the quantity information and the type information of each of the parameter values, and before invoking the target method, the method further comprises:
and creating a parameter array consistent with the quantity of the parameter values according to the quantity information of the parameter values.
4. The method of claim 3, wherein after creating the parameter array consistent with the number of parameter values, prior to invoking the target method, the method further comprises:
determining the index sequence of each parameter value according to the index sequence of each target parameter value;
and respectively writing the parameter values into the parameter array according to the index sequence of the parameter values.
5. The method of claim 4, wherein said invoking a target method based on said class object, an instance of said target method, and said target parameter value comprises:
and calling the target method according to a dynamic calling mode, wherein the dynamic calling mode is used for dynamically transmitting each parameter value in the parameter array into the class object so as to realize calling the target method, and the parameter array is determined by the target method instance and the target parameter value.
6. The method according to claim 1, wherein after receiving the call request sent by the caller and before obtaining the class object corresponding to the target class identifier, the method further comprises:
and analyzing the calling request to obtain the target class identifier, the target method identifier and the target parameter value, wherein the analyzing operation is deserialization.
7. The method of claim 6, wherein after invoking the target method, before returning an execution result after invoking the target method to the caller, the method further comprises:
and executing serialization operation on the execution result according to a target communication protocol to generate a data packet, so that the calling party receives the data packet based on the target communication protocol.
8. A remote method invocation apparatus, comprising:
the system comprises a receiving module, a calling module and a processing module, wherein the receiving module is used for receiving a calling request sent by a calling party, the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
the first obtaining module is used for obtaining the class object corresponding to the target class identifier according to the calling request;
a second obtaining module, configured to obtain an instance of the target method according to the class object and the target method identifier;
the calling module is used for calling the target method according to the class object, the instance of the target method and the target parameter value;
and the first execution module is used for returning an execution result after the target method is called to be executed to the caller.
9. A remote method invocation device, characterized in that it comprises:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
10. A storage medium storing computer-executable instructions that, when executed, implement the following:
receiving a calling request sent by a calling party, wherein the calling request carries target calling information, and the target calling information comprises a target class identifier, a target method identifier and a target parameter value;
acquiring a class object corresponding to the target class identifier according to the calling request;
acquiring an instance of the target method according to the class object and the target method identifier;
calling a target method according to the class object, the instance of the target method and the target parameter value;
and returning an execution result after the target method is called to the caller.
CN202011567898.2A 2020-12-25 2020-12-25 Remote method calling method and device Pending CN112596927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011567898.2A CN112596927A (en) 2020-12-25 2020-12-25 Remote method calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011567898.2A CN112596927A (en) 2020-12-25 2020-12-25 Remote method calling method and device

Publications (1)

Publication Number Publication Date
CN112596927A true CN112596927A (en) 2021-04-02

Family

ID=75202215

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011567898.2A Pending CN112596927A (en) 2020-12-25 2020-12-25 Remote method calling method and device

Country Status (1)

Country Link
CN (1) CN112596927A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040255268A1 (en) * 2003-06-13 2004-12-16 Erik Meijer Systems and methods providing lightweight runtime code generation
CN101697139A (en) * 2009-11-06 2010-04-21 金蝶软件(中国)有限公司 Method, device and registry for remote procedure call
US20150156278A1 (en) * 2012-06-29 2015-06-04 Kabushiki Kaisha Square Enix Holdings (Also Trading As Square Enix Holdings Co., Ltd. Methods and systems for bandwidth-efficient remote procedure calls

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040255268A1 (en) * 2003-06-13 2004-12-16 Erik Meijer Systems and methods providing lightweight runtime code generation
CN101697139A (en) * 2009-11-06 2010-04-21 金蝶软件(中国)有限公司 Method, device and registry for remote procedure call
US20150156278A1 (en) * 2012-06-29 2015-06-04 Kabushiki Kaisha Square Enix Holdings (Also Trading As Square Enix Holdings Co., Ltd. Methods and systems for bandwidth-efficient remote procedure calls

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ETBAN CERAMI: "《Web服务精髓》", 31 May 2003 *
王安生: "《软件工程专业导论》", 30 June 2020 *

Similar Documents

Publication Publication Date Title
CN109002362B (en) Service method, device and system and electronic equipment
CN108600326B (en) Communication method, device and equipment
CN110944018A (en) Rpc communication method, device and medium based on annotation and dynamic proxy
CN106878367B (en) Method and device for realizing asynchronous call of service interface
US11269611B2 (en) Data interface processing method, device, server and medium
CN111290866A (en) Service processing method and device
CN112181378B (en) Method and device for realizing business process
CN109062906B (en) Translation method and device for program language resources
CN112214334A (en) Micro-service calling method and device, electronic equipment and computer-readable storage medium
CN112230927A (en) File redirection method, code loading control method and device
CN107395663B (en) Data acquisition method and device
CN112579212A (en) Cross-language calling method, calling party device and called party device
CN112596927A (en) Remote method calling method and device
CN112738181B (en) Method, device and server for cluster external IP access
CN113946489A (en) Data acquisition method, system, device and storage medium
CN110750271B (en) Service aggregation, method and device for executing aggregated service and electronic equipment
CN111158940B (en) Method and device for docking and dynamically loading different devices in field of Internet of things
CN113961194A (en) Engineering construction method, system, terminal and medium based on FLUTTER cross-application
CN114358936A (en) Intelligent contract operation method based on micro-service block chain
CN114513483A (en) Message notification method and device based on service system
CN117270833B (en) Service calling and issuing method, medium and computer equipment
CN112596929B (en) Micro-service registration and calling method based on command event conversion and related device
CN117215676A (en) Inter-module data calling method and device, storage medium and computer equipment
CN114791833B (en) Method, device, equipment and storage medium for realizing dynamic ticket extraction
CN115878282A (en) Cross-platform interaction method, device and equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210402