How to randomly access any service in the web when two services are deployed

This is the back-end small class of the monastery. Each article is shared from

[background introduction] [knowledge analysis] [common problems] [solutions] [coding practice] [extended thinking] [more discussion] [References]

Eight aspects of in-depth analysis of back-end knowledge / skills. This article shares:

[deploy two services, how to randomly access any service in the web]

Hello, I'm the 10th student of Shenzhen Branch of it Academy. I'm an honest, pure and kind java programmer.

Today, I'd like to share with you Java task 8 on the official website of the Academy - how to deploy two services and randomly access any service on the web

1. Background introduction

Introduction to RMI

RMI (remote method invocation) is a distributed application solution provided by the earlier version of Java (JDK 1.1). As an important API, RMI is widely used in EJB. With the development of Internet applications, distributed processing tasks are also complicated, and web service has been widely popularized and applied.

2. Knowledge analysis

RMI refers to remote method invocation. It is a mechanism that allows an object on one Java virtual machine to call a method on an object in another Java virtual machine. Any object that can be called with this method must implement the remote interface. When such an object is called, its parameter is "marshaled" and it is sent from the local virtual machine to the remote virtual machine (the parameter of the remote virtual machine is "unmarshalled"). When the method terminates, the results from the remote machine will be marshalled and sent to the caller's virtual machine. If the method call causes an exception to be thrown, the exception will be indicated to the caller.

3. Frequently asked questions

Why use RMI? What are the advantages

4. Solutions

advantage:

1. Object oriented: RMI can pass complete objects as parameters and return values, not just predefined data types. In other words, complex types such as Java hashtable can be passed as a parameter. 2. Removable attributes: RMI can move attributes from client to server or from server to client. 3. Design method: the object transfer function enables you to make full use of the powerful functions of object-oriented technology in distributed computing, such as two-tier and three-tier structure systems. If users can pass attributes, they can use object-oriented design in their own solutions. All object-oriented design methods rely on different attributes to function. If you can't pass the complete object - including implementation and type - you will lose the advantages provided by the design method. 4. Security: RMI uses Java's built-in security mechanism to ensure the security of the user's system when downloading and executing programs. RMI uses security management programs designed specifically to protect the system from malicious applets. 5. It is easy to write and use RMI, which makes the writing of Java remote service programs and Java client programs accessing these service programs easy and simple. A remote interface is actually a java interface.

5. Coding practice

How to implement (switching between serers)

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
分享
二维码
< <上一篇
下一篇>>