Java remote method call 5

zhaozj2021-02-08  347

RMI application in the evolved business

You can now use RMI to connect new Java applications (or small applications) and existing servers. In this case, your business will continue to benefit as Java purposes. If a part of your system is rewritten with Java, RMI enables Java's advantages to transfer from existing Java components to a new Java program. Consider the path to reciprocate between the following two-level system to reciprocate between clients and servers:

Using RMI means that you can use RMI as a transmission method between the client and the server, so that Java's benefits spread throughout the system, even if the server side is non-Java program in a while. If you choose to rewrite some or all of your server with Java, you can benefit from existing Java components. The most important Java advantages you can have are as follows:

Object-oriented program reuse: You can transfer objects from clients to servers and from servers to the client, which you can use design patterns and other object-oriented programming technologies to increase the reuse of your internal programs.

Pass attributes: The object transmitted between the client and the server can be the type before the other end. It will be downloaded to perform new attributes.

Type Safety: Java object is always type security, which can prevent malfunctions when the programmer is wrong to generate an error.

Confidentiality: Java Classes can operate in a confidential manner so that you can interact with a client running in an environment where confidentiality. The figure below shows that the client written in Java uses RMI to talk to the server. "Request" arrow with shadow indicates the Java security, object-oriented features and other advantages you can get:

A small number of Java code is connected to the "traditional parcel program" using the existing server API. The conventional package program is a bridge between Java and an existing API, as shown in the above implementation of GetUnpaid and Shutdown. In this figure, we show that it is written in JNI, but as mentioned above, traditional package programs can also be written using JDBC or TwinPeaks (if the market).

In contrast to the above figure, the following figure shows that the language neutral system uses an interface definition language (commonly referred to as IDL) to implement connections between clients and servers:

The wrapper must still be written to connect to the existing server API defined by IDL. However, if you use an IDL-based approach, the advantage of Java will be isolated on one end of the client - because the client's Java has been reduced to the minimum portion before crossing the server. Assume that you think with Java rewrite some service programs for you. Of course, this may have variety of reasons, such as hoping a safe Java system higher reliability, or because you want to reduce mobile costs. Or maybe you have introduced an updated version that can take advantage of Java advantage because of suppliers that provide some server implementation (IMPLEMentation). The schematic of RMI is as follows:

Most requests can now be beneficial from Java. Objects passing between clients and servers through the network now is beneficial for the entire system. For example, you can start passing attributes through the same remote interface you're defined, thereby increasing the value of the client and server. Please make a comparison with the IDL-based way:

You can get Java advantages only to the server, but you cannot use the value of Java connection client / server extension. The value of Java is partitioned at the IDL boundary because IDL can't assume that Java is on the other side of the connection. If you don't abandon the IDL program, you will not take advantage of Java's Java in your system with RMI.

This loss is even more huge when you use Java in most environments. Use RMI, you can get Java benefits in your entire system:

Adopting the IDL-based way, rewriting the server with Java is still only allowed to enjoy the partial benefits of the server:

Today, you can use RMI to connect to the server without having to rewrite the service program with Java. RMI is easy to use, which is very easy to use it to create a server-side RMI class. In both cases, the complexity of conventional wrap procedures is basically the same. However, if you use an IDL-based distributed system, your Java programs you create cannot share Java benefits. RMI now allows you to easily connect, and when you decide to expand Java's usage range, you will get more benefits since Java has a synergistic effect on both sides of the network. in conclusion

RMI provides a reliable platform for the distributed calculation of true face-to-object. You can use RMI to connect to Java components, or existing components written in other languages. With the increasing importance of Java's importance in your environment, you can expand the range of Java, and get all the benefits - environmentally confidential environment without porting, low maintenance costs and security. RMI provides you with a platform that extends Java to all parts of your system, you can add Java servers and clients as needed. As long as you add Java, then all the benefits will come. RMI makes it easier, confidential and powerful.

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

New Post(0)