What is a stub class

Transferred from: nofollow "> http://www.cnblogs.com/cy163/archive/2009/08/04/1539077.html

A stub class is a class that implements an interface, but each method after implementation is empty. Its function is: if an interface has many methods, if you want to implement this interface, you must implement all methods. However, a class may only need one or two of these methods from a business perspective. If you directly implement this interface, you should implement all other irrelevant methods in addition to the required methods. If the interface is implemented by inheriting the stub class, this trouble is avoided

Establish a connection with the virtual machine where the remote object is located, and send the marshal parameters to the remote virtual machine to wait for the execution result to unpack the return value or the returned error to return the call result to the caller. The stub object is responsible for the serialization of the call parameters and return values, packaging and unpacking, and the communication process of the network layer. skeleton

Unpack the parameters passed from the stub, call the matching method of the remote object, pack the return value or send an error to the stub object, and the stub and skeleton objects of the remote object are generated by the RMIC compiler. RMI-IIOP RMI can well solve the call problem of distributed objects in Java language, but RMI is not a standard call protocol, so RMI cannot call objects written in non Java language.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>