A MethodInvoker is used on the server side to invoke methods sent by a client (using RemoteMethodCall).
As shown in fig. 2.2, a method invoker uses a transport to receive method invocations and to send responses. When created, it automatically creates an instance of PullPushAdapter with which it registers. Whenever the PullPushAdapter receives a message, it will the Receive method of the method invoker. The latter extracts a MethodCall object from the message's byte buffer and invokes it against its registered object. When the return value is an exception, it will be thrown, otherwise the return value will be returned to the caller, i.e. the method invoker uses the transport to send the response back to the caller.
Note that client and server roles may be switched at will as processes in the server role (using MethodInvoker) may themselves become clients (using RemoteMethodCall) and client may become servers at any time (by registering themselves with an instance of MethodInvoker).
The combination of MethodInvoker in the server role and RemoteMethodCall in the client role make up for simple and light-weight remote method invocation communication mechanism. However, if more than a single object needs to be registered in a server, if more than one group needs to be joined, and / or if client and server roles need to be combined in a single pattern, then class Dispatcher (2.2.10) should be preferred.