CN110659139A - Remote procedure calling method, computer equipment and storage medium - Google Patents

Remote procedure calling method, computer equipment and storage medium Download PDF

Info

Publication number
CN110659139A
CN110659139A CN201810687231.2A CN201810687231A CN110659139A CN 110659139 A CN110659139 A CN 110659139A CN 201810687231 A CN201810687231 A CN 201810687231A CN 110659139 A CN110659139 A CN 110659139A
Authority
CN
China
Prior art keywords
remote procedure
call
type
procedure call
message
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
CN201810687231.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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810687231.2A priority Critical patent/CN110659139A/en
Publication of CN110659139A publication Critical patent/CN110659139A/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention provides a remote procedure calling method, which comprises the following steps: determining a type of a remote procedure call when the call is made asynchronously; if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type; creating a remote procedure call message according to the remote procedure call function; setting the type of the remote procedure call message as a notification type; and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end. The calling types can be distinguished, and the calling which does not need to use the calling result is set as the notification type, so that the called end is notified of not needing to return the calling result, and the utilization rate of the bandwidth resource is improved.

Description

Remote procedure calling method, computer equipment and storage medium
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a remote procedure call method, computer equipment and a storage medium.
Background
A Remote Procedure Call (RPC) is a process that calls a method provided by another process, but the Call side is still consistent with the function calling the process. In the remote procedure call, all parameters to be provided to the called end process are serialized into a network message and then sent to the called end process through network transmission. After the called end completes the corresponding service, the generated result is also serialized into a network message and sent to the calling end process.
It can be seen that, in the remote procedure call, the called end returns the result to the calling end every time the call is made, however, in some applications, the calling end does not need to use the call result, and the processing mode of sending all the call results to the calling end is a waste of bandwidth resources.
Disclosure of Invention
The embodiment of the application distinguishes the calling types by providing the remote procedure calling method, the computer equipment and the storage medium, and sets the calling which does not need to use the calling result as the notification type, so that the called end is notified of not needing to return the calling result, and the problem of bandwidth waste caused by the fact that the called end sends all remote procedure calling results to the calling end in the prior art is solved.
In a first aspect, the present application provides the following technical solutions through an embodiment of the present application:
a remote procedure call method, the method is applied to a calling terminal, and the method comprises the following steps:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
Optionally, the creating a remote procedure call message according to the remote procedure call function includes:
creating a structural object of a remote procedure call message, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method;
and assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
Optionally, after the determining the type of the call, the method further includes:
and if the calling type is the request type, creating a callback function corresponding to the calling, and returning a calling result to the calling end through the callback function.
In a second aspect, the present application provides the following technical solutions through an embodiment of the present application:
a remote procedure call method, the method is applied to a called end, and the method comprises the following steps:
receiving a remote procedure call message sent by a call end;
determining an RPC function according to a procedure field in the remote procedure call message;
executing a call according to the RPC function;
and determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end.
In a third aspect, the present application provides the following technical solutions through an embodiment of the present application:
a remote procedure call device, the device being applied to a calling terminal, the device comprising:
the remote procedure call processing device comprises a first determining unit, a second determining unit and a processing unit, wherein the first determining unit is used for determining the type of a call when the remote procedure call is carried out in an asynchronous mode, and the type of the call comprises a notification type and a request type;
a first setting unit, configured to set a type of a remote procedure call function corresponding to the call as a notification type if the call is of the notification type, where the type of the remote procedure call function is set as the notification type by setting a value of a notify parameter of the remote procedure call function corresponding to the call as true;
a first creating unit configured to create a remote procedure call message according to the remote procedure call function;
a second setting unit, configured to set the type of the remote procedure call MESSAGE as a notification type, where the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
a sending unit, configured to send the remote procedure call message to a called end, so that the called end determines that the type of the remote procedure call message is a notification type, thereby determining that a result of the call does not need to be returned to the calling end.
Optionally, the first creating unit is specifically configured to:
creating a structural object of a remote procedure call message, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method;
and assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
Optionally, the apparatus further comprises:
and the second creating unit is used for creating a callback function corresponding to the call if the type of the call is a request type, and returning a call result to the call end through the callback function.
In a fourth aspect, the present application provides the following technical solutions through an embodiment of the present application:
a remote procedure call device, the device being applied to a called end, the device comprising:
the receiving unit is used for receiving the remote procedure call message sent by the call end;
a second determining unit, configured to determine an RPC function according to a procedure field in the remote procedure call message;
the execution unit is used for executing calling according to the RPC function;
a third determining unit, configured to determine the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determine that the call is of a notification type, thereby determining that a result of the call does not need to be returned to the call end.
In a fifth aspect, the present application provides the following technical solutions through an embodiment of the present application:
a computer-readable storage medium storing a computer program, the computer program when executed by a processor implementing the steps of:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
In a sixth aspect, the present application provides the following technical solutions through an embodiment of the present application:
a computer device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the steps of:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
In the embodiment of the application, a remote procedure call method is disclosed, which comprises the following steps: when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type; if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true; creating a remote procedure call message according to the remote procedure call function; setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY; and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end. The calling types can be distinguished, and the calling which does not need to use the calling result is set as the notification type, so that the called end is notified of not needing to return the calling result, and the problem of bandwidth waste caused by the fact that the called end sends all remote process calling results to the calling end in the prior art is solved.
Drawings
FIG. 1 is a flow chart of a remote procedure call method provided in an embodiment of the present application;
FIG. 2 is a flow diagram of another remote procedure call method provided in an embodiment of the present application;
FIG. 3 is a flow chart of a remote procedure call device provided in an embodiment of the present application;
FIG. 4 is a flow chart of another remote procedure call device provided in an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a computer-readable storage medium provided in an embodiment of the present application;
FIG. 6 is a schematic structural diagram of a computer device provided in an embodiment of the present application;
FIG. 7 is a schematic structural diagram of another computer-readable storage medium provided in an embodiment of the present application;
fig. 8 is a schematic structural diagram of another computer device provided in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a remote procedure calling method, computer equipment and a storage medium, which can distinguish calling types, and set calling which does not need to use a calling result as a notification type, so that a called end is notified of not needing to return a calling result, and the problem of bandwidth waste caused by the fact that the called end sends all remote procedure calling results to the calling end in the prior art is solved.
In order to better understand the technical solutions, the technical solutions are further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the function names or variable names used in the embodiments of the present application are not limited to the present application, and in some other possible implementations, other naming manners may also be used.
The first embodiment is as follows:
referring to fig. 1, the remote procedure call method provided in this embodiment is applied to a call end, and includes the following steps:
s101, when remote process calling is carried out in an asynchronous mode, determining the calling type, wherein the calling type comprises a notification type and a request type.
In the method for carrying out remote procedure call in an asynchronous mode, before a call result is returned, a virtual response result is returned to a call end so that a thread corresponding to the call end is in an awakening state, after the call result returned by the call end is received, a real response result is returned to the call end, compared with the method for synchronously calling the remote procedure, the method can solve the problem that a pseudo-dead state occurs on a program interface before the response result is not received when the remote procedure call is carried out, and the technical effect of user experience is improved. However, in some cases, the calling end does not need to use the calling result, and the manner in which the called end returns all the calling results to the calling end is a waste of bandwidth resources, so in the method for performing remote procedure call in an asynchronous manner according to this embodiment, the calling type is divided into a notification type and a request type, and it can be determined whether the calling result needs to be returned according to actual conditions.
S102, if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type.
Specifically, the type of the remote procedure call function is set to the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call to true. It should be noted that the value of the notify parameter may be set manually, or may be set automatically according to a preset judgment condition, which is not limited herein.
S103, creating a remote procedure call message according to the remote procedure call function.
Specifically, the step of creating the remote procedure call message rpmessage according to the remote procedure call function includes:
creating a structural object of a remote procedure call message RpcCMessage, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method. Specifically, because the RpcMessage structure object is based on a binary system, the irpcargent parameter in the RPC call is written into the load data of the RpcMessage, and the irpcargent parameter is serialized first. The serialization method is a method for serializing the irpcargment parameter, in the method, the serialization operation is performed according to the data type of the irpcargment parameter, for example, if the data type of the irpcargment parameter is an integer type, the integer value of the irpcargment parameter can be set into the m _ intValue field of the serialization parameter, and the m _ type field of the serialization parameter can be set into the RAT _ I32 type, so that the serialization operation on the irpcargment parameter is completed.
And assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
S104, setting the type of the remote procedure call message as a notification type.
Specifically, the rpcType field of the remote procedure call MESSAGE is set to RPC _ MESSAGE _ NOTIFY, so that the type of the remote procedure call MESSAGE is set to the notification type. It should be further noted that the value of the rpcType field may be set manually, or may be set automatically according to a determination condition set in advance, which is not limited herein.
S105, sending the remote procedure call message to a called end, so that the called end determines that the type of the remote procedure call message is a notification type, and therefore the calling end does not need to be returned with the call result.
It should be noted that, in this embodiment, an asynchronous method for performing remote procedure call is used, so after sending the remote procedure call message to the called end, a virtual response result needs to be returned to the calling end, so that a thread corresponding to the calling end is in an awake state.
Further, after the determining the type of the call, the embodiment further includes:
if the type of the call is a REQUEST type, when the RpcmAccess is created, setting rpcType in an RpcmAccess structure as RPC _ MESSAGE _ REQUEST, indicating that the call is the REQUEST type and a call result needs to be returned, then creating a callback function corresponding to the call, and sending a remote process call MESSAGE to a called end of the remote process; returning a virtual response result to a calling end of the remote process so as to enable a thread corresponding to the calling end to be in an awakening state; and when a real response result returned by the called end is received, returning the real response result to the calling end through the callback function.
In some possible implementations, this embodiment may further assign a unique identifier to the callback function; storing the callback function and the unique identifier in a dictionary Dict, wherein the unique identifier corresponds to the callback function and is sent to a called end together with a calling request, the calling end extracts the unique identifier from the real response result when receiving the real response result, and whether the time for receiving the real response result is overtime is judged based on the unique identifier; and if the time does not exceed the preset time, extracting the callback function from the dictionary Dict based on the unique identifier.
Optionally, this embodiment may further detect whether the network connection between the calling end and the called end is disconnected; and if the dictionary Dict is disconnected, clearing the data in the dictionary Dict. Therefore, the calling of the request type is more complex than the calling of the notification type, so that the calling types are distinguished and processed in the embodiment, the calling flow can be simplified, and the working efficiency is improved.
It can be seen that, in this embodiment, when a remote procedure call is performed in an asynchronous manner, the type of the call is determined, where the type of the call includes a notification type and a request type; if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true; creating a remote procedure call message according to the remote procedure call function; setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY; and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end. The calling types can be distinguished, and the calling which does not need to use the calling result is set as the notification type, so that the called end is notified of not needing to return the calling result, and the problem of bandwidth waste caused by the fact that the called end sends all remote process calling results to the calling end in the prior art is solved.
The above is a remote procedure call method based on a calling end, and based on the same inventive concept, the present application provides another remote procedure call method, which is applied to a called end, and is detailed in fig. 2, and a second embodiment will be described below with reference to fig. 2.
Example two:
referring to fig. 2, another remote procedure call method provided in this embodiment is applied to a called end, and the method includes:
s201, receiving a remote procedure call message sent by a call end;
s202, determining an RPC function according to a procedure field in the remote procedure call message;
s203, executing calling according to the RPC function;
s204, determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end.
As can be seen, in this embodiment, a remote procedure call message sent by a call end is received; determining an RPC function according to a procedure field in the remote procedure call message; executing a call according to the RPC function; and determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end. The calling types can be distinguished, for the remote procedure calling of the notification type, the called end does not need to return the calling result to the calling end, and the problem of bandwidth waste caused by the fact that the called end sends all the remote procedure calling results to the calling end in the prior art is solved.
Example three:
referring to fig. 3, the remote procedure call device provided in this embodiment is applied to a call end, and includes:
a first determining unit 301, configured to determine a type of a remote procedure call when the remote procedure call is performed in an asynchronous manner, where the type of the call includes a notification type and a request type;
a first setting unit 302, configured to set, if the call is a notification type, a type of a remote procedure call function corresponding to the call as the notification type, where the type of the remote procedure call function is set as the notification type by setting a value of a notify parameter of the remote procedure call function corresponding to the call as true;
a first creating unit 303, configured to create a remote procedure call message according to the remote procedure call function;
a second setting unit 304, configured to set the type of the remote procedure call MESSAGE as a notification type, where the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
a sending unit 305, configured to send the remote procedure call message to a called end, so that the called end determines that the type of the remote procedure call message is a notification type, thereby determining that a result of the call does not need to be returned to the calling end.
In some possible implementations, the first creating unit is specifically configured to:
creating a structural object of a remote procedure call message, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method;
and assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
In some possible implementations, the apparatus further includes:
and the second creating unit is used for creating a callback function corresponding to the call if the type of the call is a request type, and returning a call result to the call end through the callback function.
Specifically, the remote procedure call device provided in the third embodiment of the present application and the remote procedure call method provided in the first embodiment of the present application belong to the same concept, and the specific implementation process thereof is detailed throughout the entire specification and is not described herein again.
As can be seen, in this embodiment, the first determining unit 301 is configured to determine the type of the call when performing a remote procedure call in an asynchronous manner, where the type of the call includes a notification type and a request type; the first setting unit 302 is configured to set, if the call is a notification type, a type of a remote procedure call function corresponding to the call as the notification type, where the type of the remote procedure call function is set as the notification type by setting a value of a notify parameter of the remote procedure call function corresponding to the call as true; the first creating unit 303 is configured to create a remote procedure call message according to the remote procedure call function; the second setting unit 304 is configured to set the type of the remote procedure call MESSAGE as a notification type, where the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY; the sending unit 305 is configured to send the remote procedure call message to the called end, so that the called end determines that the type of the remote procedure call message is a notification type, thereby determining that a result of the call does not need to be returned to the calling end. The calling types can be distinguished, and the calling which does not need to use the calling result is set as the notification type, so that the called end is notified of not needing to return the calling result, and the problem of bandwidth waste caused by the fact that the called end sends all remote process calling results to the calling end in the prior art is solved.
Example four:
referring to fig. 4, the remote procedure call device provided in this embodiment is applied to a called end, and includes:
a receiving unit 401, configured to receive a remote procedure call message sent by a call end;
a second determining unit 402, configured to determine an RPC function according to a procedure field in the remote procedure call message;
an execution unit 403, configured to execute a call according to the RPC function;
a third determining unit 404, configured to determine the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determine that the call is of a notification type, thereby determining that a result of the call does not need to be returned to the call end.
Specifically, the remote procedure call device provided in the fourth embodiment of the present application and the remote procedure call method provided in the second embodiment of the present application belong to the same concept, and the specific implementation process thereof is detailed throughout the entire specification and is not described herein again.
As can be seen, in this embodiment, the receiving unit 401 is configured to receive a remote procedure call message sent by a calling end; the second determining unit 402 is configured to determine an RPC function according to a procedure field in the remote procedure call message; the execution unit 403 is configured to execute a call according to the RPC function; a third determining unit 404 is configured to determine the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determine that the call is of a notification type, thereby determining that a result of the call does not need to be returned to the call end. The calling types can be distinguished, for the remote procedure calling of the notification type, the called end does not need to return the calling result to the calling end, and the problem of bandwidth waste caused by the fact that the called end sends all the remote procedure calling results to the calling end in the prior art is solved.
Example five:
the present embodiment provides a computer-readable storage medium 500, the computer-readable storage medium 500 storing a computer program 511, the computer program 511 realizing the following steps when executed by a processor:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
In a specific implementation, the computer program 511 may implement any one of the embodiments when executed by a processor.
Based on the same inventive concept, the present application further provides a computer device, which is detailed in fig. 6, and a sixth embodiment will be described with reference to fig. 6.
Example six:
the present application provides a computer arrangement 600 comprising a processor 620, a memory 610 and a computer program 611 stored on the memory 610 and executable on the processor 620, the processor 620 realizing the following steps when executing the computer program 611:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
Since the computer device 600 described in this embodiment is a device for implementing the remote procedure call method in the first embodiment of the present application, a person skilled in the art can understand a specific implementation manner of the computer device 600 of this embodiment and various variations thereof based on the method described in the first embodiment of the present application, and therefore, a detailed description of how the computer device 600 implements the method in the embodiment of the present application is omitted here. The equipment used by those skilled in the art to implement the methods in the embodiments of the present application is within the scope of the present application.
Example seven:
the present embodiment provides a computer-readable storage medium 700, the computer-readable storage medium 700 storing a computer program 711, the computer program 711 implementing the following steps when executed by a processor:
receiving a remote procedure call message sent by a call end;
determining an RPC function according to a procedure field in the remote procedure call message;
executing a call according to the RPC function;
and determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end.
In a specific implementation, the computer program 711, when executed by a processor, may implement any of the second embodiments.
Based on the same inventive concept, the present application further provides a computer device, which is detailed in fig. 8, and an eighth embodiment will be described with reference to fig. 8.
Example eight:
the present application provides a computer device 800 comprising a processor 820, a memory 810 and a computer program 811 stored on the memory 810 and executable on the processor 820, the processor 820 realizing the following steps when executing the computer program 811:
receiving a remote procedure call message sent by a call end;
determining an RPC function according to a procedure field in the remote procedure call message;
executing a call according to the RPC function;
and determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end.
Since the computer device 800 described in this embodiment is a device for implementing the remote procedure call method in the second embodiment of the present application, based on the method described in the second embodiment of the present application, a person skilled in the art can understand a specific implementation manner of the computer device 800 of this embodiment and various variations thereof, and therefore, a detailed description of how to implement the method in the embodiment of the present application by the computer device 800 is omitted here. The equipment used by those skilled in the art to implement the methods in the embodiments of the present application is within the scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A remote procedure call method is applied to a calling end, and comprises the following steps:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
2. The method of claim 1, wherein said creating a remote procedure call message from said remote procedure call function comprises:
creating a structural object of a remote procedure call message, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method;
and assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
3. The method of claim 1 or 2, wherein after said determining the type of the call, the method further comprises:
and if the calling type is the request type, creating a callback function corresponding to the calling, and returning a calling result to the calling end through the callback function.
4. A remote procedure call method, applied to a called end, the method comprising:
receiving a remote procedure call message sent by a call end;
determining an RPC function according to a procedure field in the remote procedure call message;
executing a call according to the RPC function;
and determining the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determining that the call is of a notification type, thereby determining that the result of the call does not need to be returned to the call end.
5. A remote procedure call device, applied to a calling side, comprising:
the remote procedure call processing device comprises a first determining unit, a second determining unit and a processing unit, wherein the first determining unit is used for determining the type of a call when the remote procedure call is carried out in an asynchronous mode, and the type of the call comprises a notification type and a request type;
a first setting unit, configured to set a type of a remote procedure call function corresponding to the call as a notification type if the call is of the notification type, where the type of the remote procedure call function is set as the notification type by setting a value of a notify parameter of the remote procedure call function corresponding to the call as true;
a first creating unit configured to create a remote procedure call message according to the remote procedure call function;
a second setting unit, configured to set the type of the remote procedure call MESSAGE as a notification type, where the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
a sending unit, configured to send the remote procedure call message to a called end, so that the called end determines that the type of the remote procedure call message is a notification type, thereby determining that a result of the call does not need to be returned to the calling end.
6. The apparatus of claim 5, wherein the first creating unit is specifically configured to:
creating a structural object of a remote procedure call message, wherein the structural object comprises a numArgs member with 1 byte and a payload load data member with variable length, the numArgs member comprises the number of parameters of the remote procedure call function, and the payload load data member comprises an IRpcArgment parameter contained in the remote procedure call function;
serializing the IRpcArgment parameter into the payload data of the payload data member by calling the SerializeRpccArgument method;
and assigning the RPC function name of the called end specified in the remote procedure call function to the procedure field of the structure object.
7. The apparatus of claim 5 or 6, wherein the apparatus further comprises:
and the second creating unit is used for creating a callback function corresponding to the call if the type of the call is a request type, and returning a call result to the call end through the callback function.
8. A remote procedure call apparatus, applied to a called end, the apparatus comprising:
the receiving unit is used for receiving the remote procedure call message sent by the call end;
a second determining unit, configured to determine an RPC function according to a procedure field in the remote procedure call message;
the execution unit is used for executing calling according to the RPC function;
a third determining unit, configured to determine the type of the call according to the remote procedure call MESSAGE, and if the rpcType field of the remote procedure call MESSAGE is RPC _ MESSAGE _ NOTIFY, determine that the call is of a notification type, thereby determining that a result of the call does not need to be returned to the call end.
9. A computer-readable storage medium storing a computer program, the computer program when executed by a processor implementing the steps of:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
10. A computer device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the steps of:
when a remote procedure call is carried out in an asynchronous mode, determining the type of the call, wherein the type of the call comprises a notification type and a request type;
if the call is a notification type, setting the type of the remote procedure call function corresponding to the call as the notification type, wherein the type of the remote procedure call function is set as the notification type by setting the value of the notify parameter of the remote procedure call function corresponding to the call as true;
creating a remote procedure call message according to the remote procedure call function;
setting the type of the remote procedure call MESSAGE as a notification type, wherein the type of the remote procedure call MESSAGE is set as the notification type by setting an rpcType field of the remote procedure call MESSAGE as RPC _ MESSAGE _ NOTIFY;
and sending the remote procedure call message to a called end so that the called end determines the type of the remote procedure call message as a notification type, thereby determining that the call result does not need to be returned to the calling end.
CN201810687231.2A 2018-06-28 2018-06-28 Remote procedure calling method, computer equipment and storage medium Pending CN110659139A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810687231.2A CN110659139A (en) 2018-06-28 2018-06-28 Remote procedure calling method, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810687231.2A CN110659139A (en) 2018-06-28 2018-06-28 Remote procedure calling method, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110659139A true CN110659139A (en) 2020-01-07

Family

ID=69026295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810687231.2A Pending CN110659139A (en) 2018-06-28 2018-06-28 Remote procedure calling method, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110659139A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084046A (en) * 2020-09-12 2020-12-15 朱领军 Dubbo generalization interface calling method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102780613A (en) * 2012-06-19 2012-11-14 瑞斯康达科技发展股份有限公司 Method and device for communication of boards of distributed device
CN106648928A (en) * 2016-11-29 2017-05-10 成都广达新网科技股份有限公司 Method and device for inter-process communication
CN107277029A (en) * 2017-06-30 2017-10-20 武汉斗鱼网络科技有限公司 A kind of method of remote procedure call, device and computer equipment
CN107483399A (en) * 2017-06-30 2017-12-15 武汉斗鱼网络科技有限公司 A kind of Information encapsulation method and device in remote procedure call
US20180048717A1 (en) * 2016-08-12 2018-02-15 Oracle International Corporation System and method for supporting live addition of a tenant in a connection pool environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102780613A (en) * 2012-06-19 2012-11-14 瑞斯康达科技发展股份有限公司 Method and device for communication of boards of distributed device
US20180048717A1 (en) * 2016-08-12 2018-02-15 Oracle International Corporation System and method for supporting live addition of a tenant in a connection pool environment
CN106648928A (en) * 2016-11-29 2017-05-10 成都广达新网科技股份有限公司 Method and device for inter-process communication
CN107277029A (en) * 2017-06-30 2017-10-20 武汉斗鱼网络科技有限公司 A kind of method of remote procedure call, device and computer equipment
CN107483399A (en) * 2017-06-30 2017-12-15 武汉斗鱼网络科技有限公司 A kind of Information encapsulation method and device in remote procedure call

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084046A (en) * 2020-09-12 2020-12-15 朱领军 Dubbo generalization interface calling method and device

Similar Documents

Publication Publication Date Title
CN107241281B (en) Data processing method and device
CN110471749B (en) Task processing method, device, computer readable storage medium and computer equipment
CN111221700B (en) Cluster node state monitoring method, device, equipment and readable storage medium
CN102385536B (en) Method and system for realization of parallel computing
CN111200606A (en) Deep learning model task processing method, system, server and storage medium
CN103701867A (en) Method, system and central server for processing call requests
CN112231108A (en) Task processing method and device, computer readable storage medium and server
CN108304272B (en) Data IO request processing method and device
CN112817751A (en) Computing resource management method and device, storage medium and electronic device
CN109995595B (en) RGW quota determining method, system, equipment and computer medium
CN111541762A (en) Data processing method, management server, device and storage medium
CN110659139A (en) Remote procedure calling method, computer equipment and storage medium
CN110674172A (en) Data query method and device
CN113535020B (en) Method, apparatus, device, medium and product for generating application icons
CN111831503A (en) Monitoring method based on monitoring agent and monitoring agent device
CN113504981A (en) Task scheduling method and device, storage medium and electronic equipment
CN110266814B (en) Transmission method and transmission device
CN111477229B (en) Voice recognition request processing method and device
CN108958951B (en) Optimization method, computer equipment and storage medium
CN109450885B (en) Network data interception method and device, electronic equipment and storage medium
CN112711517A (en) Server performance monitoring method and device, storage medium and terminal
CN112488462A (en) Unified pushing method, device and medium for workflow data
CN113760487A (en) Service processing method and device
CN113760482A (en) Task processing method, device and system
CN112231612A (en) Configuration information transmission method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200107