EJB Basis RMI Getting Started

xiaoxiao2021-03-06  128

Friends who have been programmed under unix should have heard of RPC concept, RPC's full name is Remote Procedure

Call; if the RMI's full name (Remote Method Invocation), smart, you should know their

Diftype: RPC is based on process, RMI is object-oriented. In fact, RMI is a Java version of RPC, so Java

RMI has the advantages of Java's "Write Once, Run Anywhere", which is 100% of the distributed application system.

Java solution.

1) Why is serialization that is a distributed application system, involving multiple JRE issues. In A JRE object, its memory address is

0xAbcDef, the value stored in this address, and the value of this address in B JRE is different, so the RMI does not support sequences.

It is not possible. We can see the SERIALIZABLE interface in the RMI package.

2) RMI system running mechanism RMI applications typically include two separate programs: server programs and client programs, this and general C / S development

There is no difference between mode. RMI is also an ORB standard, including stub and skeleton. When calling stub,

Do the following: (1) Initializing the connection to a remote virtual machine containing a remote object; (2) For remote virtual machines

The parameter is group (written and transmitted), serialization is what is done here; (3) Waiting for method call results; (4) solving

(Read) Return the value or returns an exception; (5) returns the value to the call. You don't have to say it .stub and the Skeleton call process .STUB and

Skeleton does not write itself, it is generated by the RMIC compiler.

3) Steps (1) written by the Java RMI distributed application define the functionality of the remote class as the Java interface. Refer to Java.rmi.Remote, pay attention to the abnormal throwing problem.

(2) Write the server class. Use the object-oriented views to consider this problem. (3) Write client programs that use remote services. Get far from the lookup () method in java.rmi.naming

The reference to the object, according to the remote method of the reference, the call mode, and the adjustment of the local object method

Use the same. • Steps to compile and run RMI Distributed Applications (1) Compile remote interface classes, remote interface implementation classes, and client programs using Javac. Write code according to your business logic.. (2) Use the RMIC compiler to generate STUBs and SKELETONs that implement classes. Automatic implementation, don't use our depends. (3) Start the RMI Registration Service RMIREGISTRY. You can see this window when using the CORBA system.. (4) Start the server-side program. (5) Start the client program.

Description: It is best to see the java.rmi bag to understand the concept of the above; it is best to see

Appendix

explain.

转载请注明原文地址:https://www.9cbs.com/read-126782.html

New Post(0)