<!----> The java.rmi.server.RemoteStub
class is the common superclass for stubs of remote objects. Stub objects are surrogates that support exactly the same set of remote interfaces defined by the actual implementation of a remote object.
package java.rmi.server;
public abstract class RemoteStub extends java.rmi.RemoteObject {
protected RemoteStub();
protected RemoteStub(RemoteRef ref);
protected static void setRef(RemoteStub stub, RemoteRef ref);
}
<!----> The first constructor of RemoteStub
creates a stub with a null
remote reference. The second constructor creates a stub with the given remote reference, ref.
<!----> The setRef
method is deprecated (and unsupported) as of the Java 2 SDK, Standard Edition, v1.2.
<!----> 8.1.1 Type Equivalency of Remote Objects with a Stub Class
<!----> Clients interact with stub (surrogate) objects that have exactly the same set of remote interfaces defined by the remote object's class; the stub class does not include the non-remote portions of the class hierarchy that constitutes the object's type graph. This is because the stub class is generated from the most refined implementation class that implements one or more remote interfaces. For example, if C extends B and B extends A, but only B implements a remote interface, then a stub is generated from B, not C.
<!----> Because the stub implements the same set of remote interfaces as the remote object's class, the stub has the same type as the remote portions of the server object's type graph. A client, therefore, can make use of the built-in Java programming language operations to check a remote object's type and to cast from one remote interface to another.
<!----> Stubs are generated using the rmic compiler.
<!----> 8.1.2 The Semantics of Object Methods Declared final
<!----> The following methods are declared final
in the java.lang.Object
class and therefore cannot be overridden by any implementation:
<!----> The default implementation for
getClass
is appropriate for all objects written in the Java programming language, local or remote; so, the method needs no special implementation for remote objects. When used on a remote stub, the
getClass
method reports the exact type of the stub object, generated by
rmic. Note that stub type reflects only the remote interfaces implemented by the remote object, not that object's local interfaces.
<!----> The wait
and notify
methods of java.lang.Object
deal with waiting and notification in the context of the Java programming language's threading model. While use of these methods for remote stubs does not break the threading model, these methods do not have the same semantics as they do for local objects written in the Java programming language. Specifically, using these methods operates on the client's local reference to the remote object (the stub), not the actual object at the remote site.
<!----> The interface Skeleton
is used solely by the implementation of skeletons generated by the rmic
compiler. A skeleton for a remote object is a server-side entity that dispatches calls to the actual remote object implementation.
Note - The Skeleton
interface was deprecated as of the Java 2 SDK, Standard Edition, v1.2. Every 1.1 (and version 1.1 compatible skeletons generated in 1.2 using rmic -vcompat
, the default) skeleton class generated by the rmic
stub compiler implements this interface. Skeletons are no longer required for remote method call dispatch as of Java 2 SDK, Standard Edition, v1.2-compatible versions. To generate stubs that are compatible with 1.2 or later versions, use the command rmic
with the option -v1.2.
package java.rmi.server;
public interface Skeleton {
void dispatch(Remote obj, RemoteCall call, int opnum, long hash)
throws Exception;
Operation[] getOperations();
}
<!----> The
dispatch
method unmarshals any arguments from the input stream obtained from the
call object, invokes the method (indicated by the operation number
opnum) on the actual remote object implementation
obj, and marshals the return value or throws an exception if one occurs during the invocation.
<!----> The getOperations
method returns an array containing the operation descriptors for the remote object's methods.
分享到:
相关推荐
4. **Stub and Skeleton**:Stub是远程对象的代理,驻留在客户端,负责接收客户端的调用并转发到服务器端。Skeleton则在服务器端,接收Stub转发的请求并调用实际的远程对象。在Java 1.2及以后版本中,Stub和Skeleton...
- **8 Using the gSOAP Stub and Skeleton Compiler**:本节展示了如何使用gSOAP编译器来构建SOAP客户端和Web服务。gSOAP的编译器工具可自动生成XML和SOAP消息的序列化和反序列化代码。 #### 2.6 gSOAP远程方法规范...
3. **Stub and Skeleton**:由IDL编译器生成,stub(存根)用于客户端调用远程服务,skeleton(骨架)用于服务端实现远程接口。 4. **POA(Portable Object Adapter)**:POA是ORB的一个组件,用于将对象实现暴露给...
4. ** stub 和 skeleton**:stub是远程对象的代理,它在客户端运行,负责调用远程方法并将参数通过网络发送到服务器。skeleton在服务器端运行,接收到请求后调用远程对象的相应方法。在Java RMI的新版本中,stub和...
本文介绍了J2EE中几个核心概念,包括RMI、CORBA、RMI-IIOP、JNDI以及STUB与SKELETON。通过理解这些概念,可以帮助开发者更好地理解和使用J2EE框架及其相关技术。此外,对于如何选择合适的远程通信方式(RMI vs CORBA...
2. **生成Stub和Skeleton**:使用Axis的`wsdl2java`工具,根据你的服务接口定义(通常是WSDL文件)生成客户端和服务器端的Stub和Skeleton。这一步骤将自动生成处理Web服务请求和响应的代码。 3. **实现服务逻辑**:...
- ** stub 和 skeleton**:stub是远程对象在网络上的代理,它负责将本地调用转换为网络消息。skeleton是远程对象的网络端,接收并处理由stub发送的消息。在Java 1.2之后,skeleton被自动处理,不再需要手动创建。 ...
5. **Stub和Skeleton**:Stub是客户端代码,用于与远程服务交互;Skeleton是服务器端的代理,处理接收到的请求。Axis1.4自动生成这些代码,简化了开发过程。 6. **JAX-RPC(Java API for XML-based RPC)**:这是...
- 生成 stub 和 skeleton:使用IDL编译器(如TAO的idlc)生成C++和C#的stub(客户端存根)和skeleton(服务器骨架)代码。 - 实现服务对象:在C++中实现服务对象,继承自生成的skeleton类。 - 配置ORB:在C++和C#...
2. **生成Stub和Skeleton**: 使用Axis2工具从WSDL生成客户端Stub和服务器端Skeleton代码。 3. **创建Client**: 实例化客户端,设置服务地址和其他必要属性。 4. **调用服务**: 调用服务方法,传递参数并处理响应。 ...
3. **角色与通信**:在EJB的分布式环境中,主要有三个角色:服务提供者(提供业务逻辑)、客户端(调用服务)以及Stub和Skeleton。Stub作为客户端和服务器之间的代理,使得客户端可以像调用本地方法一样调用远程服务...
理解RMI的关键概念包括远程接口、远程对象、 stub 和 skeleton,以及如何处理异常和透明性。RMI的使用也涉及到注册表、ORB(对象请求代理)以及线程管理,这些都是企业级Java应用设计中需要掌握的重要知识点。 XML...
- 使用wsdl2java工具生成客户端 stub 和 skeleton 类。 - 创建客户端对象,通过stub调用Web服务方法。 三、XFire简介 XFire是另一个Java Web服务框架,后来演变为CXF项目的一部分。XFire以其轻量级、高性能和易于...
4. **Stubs and Skeletons**:IDL编译器会生成Stub和Skeleton代码。Stub是客户端用来调用远程对象的代理,而Skeleton则是服务器端用来接收并处理客户端请求的部分。 #### 四、Java与CORBA的集成 1. **Java IDL**:...
5. **编译和运行**:使用javac编译源代码,使用rmic生成Stub和Skeleton,然后启动RMI的RMIServer,最后运行服务器和客户端程序。 在这个特定的示例“gumball_Manualtest”中,可能是一个自动售货机(Gumball ...
- RMI的核心思想是将对象的引用转换为可以在网络上传输的`Stub`对象,`Stub`对象在客户端调用远程方法时,会通过网络发送请求到服务器的`Skeleton`对象。 2. **RMI组件** - **远程接口(Remote Interface)**:...
RMI系统由几个组件组成,包括远程接口(Remote Interface)、远程对象(Remote Object)、注册表(Registry)和 stub/skeleton 对象。开发者定义远程接口,声明远程方法,然后实现这些接口的远程对象。RMI会自动处理...
SmartClient架构主要包括Client、Server、Stub、Skeleton等几个部分。 Ajax架构:Ajax(Asynchronous JavaScript and XML)是一个基于JavaScript的异步通信技术,旨在简化web应用程序的用户体验。Ajax架构主要包括...